Workflows API
Download OpenAPI DocumentChain translation, review and dubbing steps into one automated run.
Chain steps such as dubbing, document translation, quality checks, exports and human approvals into one workflow, then run it as often as you like. New here? Read Workflows for the whole flow and the graph format.
Every request
Send your organization API key in the x-api-key header; it starts with uvk_. Create one in the Universe app under Settings → API keys. The key and organization limits count requests over a rolling minute. See Authentication and Rate limits.
The typical flow: find the step types you need with List step types, save a workflow with Create a workflow (check it first with Validate a workflow), read what a run asks for in its inputSchema, then Start a run and poll it with Get a run. When a run reaches an Approval gate, Approve a step or Reject a step.
Runs work in the background, so every call returns straight away. Saving a workflow is free. A run is charged step by step, as each step starts, at the rate of the product that does the work; Start a run lists the rates. Without enough credits it returns 402 and nothing starts. See Credits.
Every route needs a cosmos permission on the role of the member who created the API key: read to look, create, update and delete to manage workflows, execute to run them. Each step also needs the permission of its own product, listed in its requires.
Workflows
A workflow is a saved graph of steps and the edges between them. Create, validate, update and delete your organization's workflows here; built-in workflows can be read and run but not changed.
List workflows
Get a workflow
Create a workflow
Validate a workflow
Check a graph against the save rules without saving it, and get every problem at once instead of only the first. An empty problems list means a save will pass these rules. Branching rules checked only when the flow is compiled (a Parallel without its Merge, a step on more than one branch, a loop) are not covered, nor are step permissions. Returns 201 because it is a POST; nothing is created.
Permission: cosmos:read. An API key acts with the role of the member who created it.
Bodyrequiredapplication/json
The graph to check, in the same shape as a save.
Show child attributes
Every step, including exactly one logic.start and one logic.end once the flow has a real step.
Show child attributes
Your id for the node, unique within the flow. Edges, inputBindings, run inputs and run steps refer to it. Letters, digits, - and _ keep run-input keys readable.
The step type, a key from List step types, such as tv.instant_clone, logic.approval or logic.start.
Canvas position, used only to draw the flow in the Universe app.
Show child attributes
Horizontal position on the canvas, in pixels.
Vertical position on the canvas, in pixels.
Values fixed when you save the flow, keyed by field key from the step type's inputSchema (and configSchema, for the LLM step). A field set here is not asked for when the flow runs. Gates keep their settings here too: a Delay's durationSeconds, an Approval's label and instructions, a Switch's cases and defaultCase.
Inputs read from an earlier step, keyed by input field key: { "<inputKey>": { "fromNodeId", "outputKey" } }. This is what the run reads; draw a matching binding edge so the canvas shows the wire.
Every connection between steps.
Show child attributes
id of the node the edge starts from.
id of the node the edge goes to.
Your id for the edge.
Where the edge leaves the source. For a control edge: __ctl_out, or case:<caseKey> from a Switch. For a binding edge: the source's output key. For a share edge: an input key of the source.
Where the edge enters the target. For a control edge: __ctl_in. For a binding or share edge: the target's input key.
control: run order and branching (Start → step → gate → … → End). binding: data from an output to an input (mirror it in the target's inputBindings). share: two inputs of the same type that take one value, asked for once when the flow runs. Left out, the edge is a binding.
Reserved. Stored with the flow but not used to route a run: branch with a Switch gate instead.
Show child attributes
Output key of the source node to test.
The value the output must equal.
Responses
201The problems found, if any.
Every problem a save would refuse, each as the message the save would give. Empty when none was found.
400Invalid request: a field failed validation, or a parameter is malformed (for example, an ID that is not a UUID).
HTTP status code, repeated in the body.
What went wrong, for people. Validation failures list one entry per problem. Do not branch on this text.
Short name of the status.
401The `x-api-key` header is missing, or the key is invalid, expired or deleted.
HTTP status code, repeated in the body.
What went wrong, for people. Validation failures list one entry per problem. Do not branch on this text.
Short name of the status.
403Not allowed: the API key's role lacks the permission (`PermissionDenied`), the product is not enabled for your organization, or it has been turned off.
HTTP status code, repeated in the body.
What went wrong, for people. Validation failures list one entry per problem. Do not branch on this text.
Short name of the status.
429Too many requests for this key. Wait the number of seconds in `Retry-After`, then retry.
HTTP status code, repeated in the body.
What went wrong, for people. Validation failures list one entry per problem. Do not branch on this text.
Short name of the status.
500Something failed on our side. Retry with backoff; if it persists, contact support with the `X-Request-Id`.
HTTP status code, repeated in the body.
What went wrong, for people. Validation failures list one entry per problem. Do not branch on this text.
Short name of the status.
curl '{{API_BASE_URL}}/v1/cosmos/flows/validate' \
--request POST \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"graph": {
"nodes": [
{
"id": "start",
"nodeTypeKey": "logic.start",
"position": {
"x": 0,
"y": 0
}
},
{
"id": "dub",
"nodeTypeKey": "tv.instant_clone",
"position": {
"x": 240,
"y": 0
},
"config": {
"sourceLanguage": "en-US",
"targetLanguage": "hi-IN",
"speakerCount": "2"
}
},
{
"id": "review",
"nodeTypeKey": "logic.approval",
"position": {
"x": 480,
"y": 0
},
"config": {
"label": "Review the Hindi dub",
"instructions": "Check names and numbers in the editor."
}
},
{
"id": "export",
"nodeTypeKey": "tv.export",
"position": {
"x": 720,
"y": 0
},
"config": {
"targetLanguage": "hi-IN",
"withSubtitles": true
},
"inputBindings": {
"parentProcessId": {
"fromNodeId": "dub",
"outputKey": "processId"
}
}
},
{
"id": "end",
"nodeTypeKey": "logic.end",
"position": {
"x": 960,
"y": 0
}
}
],
"edges": [
{
"id": "e1",
"source": "start",
"target": "dub",
"sourceHandle": "__ctl_out",
"targetHandle": "__ctl_in",
"kind": "control"
},
{
"id": "e2",
"source": "dub",
"target": "review",
"sourceHandle": "__ctl_out",
"targetHandle": "__ctl_in",
"kind": "control"
},
{
"id": "e3",
"source": "review",
"target": "export",
"sourceHandle": "__ctl_out",
"targetHandle": "__ctl_in",
"kind": "control"
},
{
"id": "e4",
"source": "export",
"target": "end",
"sourceHandle": "__ctl_out",
"targetHandle": "__ctl_in",
"kind": "control"
},
{
"id": "e5",
"source": "dub",
"target": "export",
"sourceHandle": "processId",
"targetHandle": "parentProcessId",
"kind": "binding"
}
]
}
}'{
"problems": [
"Connect the last step to the End node.",
"\"Export Video\" needs its \"Parent run\" wired from an upstream node."
]
}Update a workflow
Get your copy of a ready-made workflow
Step types
The building blocks of a workflow: product steps such as dubbing, translation and quality checks, and the logic.* gates that wait, branch, run in parallel and ask for approval. Read them first to learn each step's field keys.
List step types
Runs
A run is one execution of a workflow with its own inputs. Start it, poll it until it finishes, then retry or cancel it if you need to. You can also rename a run, file it in a folder and choose who owns each step.
- POST/v1/cosmos/flows/{id}/run
- GET/v1/cosmos/executions
- GET/v1/cosmos/executions/{id}
- POST/v1/cosmos/executions/{id}/retry
- POST/v1/cosmos/executions/{id}/rename
- GET/v1/cosmos/executions/{id}/images.zip
- PATCH/v1/cosmos/executions/{id}/project
- POST/v1/cosmos/executions/{id}/images/save-to-drive
- POST/v1/cosmos/executions/{id}/nodes/{nodeId}/step-owners
Start a run
List runs
Get a run
Retry a run
Rename a run
Download a run’s images
Move a run to a project
Save a run’s images to Drive
Set step owners
Approvals
An Approval gate pauses a run until someone decides. While it waits, the run's status is awaiting_action: approve the step to continue, or reject it to stop the run.