client.projects.wait(...) or client.exports.wait(...) and only reach for client.tasks.* when they need low-level task inspection.
client.tasks.get(taskId, options?)
Fetch the current state of a task by ID.
Task statuses
| Status | Terminal? | Meaning |
|---|---|---|
created | No | Task was created but not yet queued. |
queued | No | Task is waiting to run. |
in-progress | No | Task is currently executing. |
completed | Yes | Task finished successfully. |
finalized | Yes | Task finished and post-processing is done. |
failed | Yes | Task failed with an error. |
cancelled | Yes | Task was cancelled. |
timed-out | Yes | Task hit its time limit. |
client.tasks.wait(taskId, options?)
Poll a task until it reaches a terminal state. Returns the final task on success, throws YoukaTaskError on failure.
Options
Milliseconds between polls. Defaults to
2000.Abort the wait. The in-flight request and any pending delay are cancelled
immediately.
Errors
client.tasks.wait(...) throws YoukaTaskError when the task ends in failed, cancelled, or timed-out:
client.projects.wait(operation, options?)
Wait for a project-scoped operation to finish, then refetch the project. Returns the operation handle, the terminal task, and the updated project.
Usually the result of
client.projects.create(...),
client.projects.separateStems(...), or client.projects.syncLyrics(...).client.exports.wait(operationOrId, options?)
Wait for a cloud export to reach a terminal state. Pass either the ExportOperation returned by client.exports.create(...) or an exportId string.
Cancellation
Pass anAbortSignal to cancel a long-running wait:
What’s next
- Errors — handle
YoukaTaskErrorand retryable errors - Exports — wait for an export to finish
- API async jobs — the same pattern in raw HTTP
