Skip to content

Execute workflow

Viewing v1— superseded by v2

POST
/v1/workspaces/{workspace_id}/workflows/{workflow_id}/runs
curl --request POST \
--url https://api.app.layer.ai/api/v1/workspaces/:workspace_id/workflows/:workflow_id/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"inputs": {},
"session_id": "<uuid>",
"session_name": "<string>",
"webhook": {
"url": "<string>",
"events": [
"inference.completed"
],
"metadata": {}
}
}'

v1 is superseded. v1 was superseded by v2 on 2026-08-26. A sunset date has not been announced yet; v1 will be deprecated as a whole before removal. Migrate with the v2 migration guide.

Start a workflow execution. Returns immediately with a run ID. Poll with GET /workspaces/{workspace_id}/workflows/{workflow_id}/runs/{run_id} for results. Creative Units are not checked here: an underfunded workspace is still accepted and the run then reports FAILURE with error_code BlueprintInsufficientBalanceError. Use the estimate endpoint’s has_sufficient_creative_units to check before submitting.

workspace_id
required
Workspace Id

Id of the workspace that owns the resource.

string format: uuid

Id of the workspace that owns the resource.

workflow_id
required
Workflow Id

Id of the workflow.

string format: uuid

Id of the workflow.

Idempotency-Key
string
<= 255 characters

Opaque key making a retry of this request return the first result. A 2xx response is replayed for 24 hours with Idempotent-Replayed: true. A 4xx releases the key. A 5xx, or a request still running, holds the key for 120 seconds, during which a retry gets 409; after that a retry executes again. The key covers the method, path, query, and byte-identical body it was first used with; reusing it for a different request is rejected with 422. Protection is best effort: if the key store is unavailable, or a record is lost early, a retry can execute again even after an earlier 409. See the Idempotency section of the API description.

Media typeapplication/json
ExecuteWorkflowRequest
object
inputs
required
Inputs

Input values matching the workflow’s input schema.

object
key
additional properties
any
session_id
Session Id

Existing session ID. Takes precedence over session_name if both are provided.

string format: uuid
nullable
session_name
Session Name

Session name. Creates a new session if not found in the workspace. Ignored if session_id is set.

string
nullable
webhook
Any of:
WebhookInput

Where to POST this request’s terminal events, and what to include with them.

object
url
required
Url

HTTPS URL that receives a POST when this request reaches a terminal state. Must be publicly reachable; must not redirect. Acknowledge with any 2xx within 10 seconds and do the work asynchronously. Reply 410 to stop delivery permanently.

string
<= 2048 characters
events
Events

Narrows what is delivered. Omit to receive every event this request can produce, which is what expected_events on the response lists.

Array<string>
nullable
Allowed values: inference.completed inference.failed inference.cancelled training.succeeded training.failed scoring_run.completed scoring_run.failed workflow_run.succeeded workflow_run.failed workflow_run.cancelled
metadata
Metadata

Opaque key/value pairs echoed back verbatim in every delivery, for correlating a callback with your own records. At most 10 keys and 1024 bytes in total.

object
key
additional properties
string

Successful Response

Media typeapplication/json
ExecuteWorkflowOutput
object
run_id
required
Run Id

Unique identifier for this workflow run.

string format: uuid
status
required
BlueprintRunStatus

Current run status: PENDING or RUNNING.

string
Allowed values: pending running success failure cancelled
estimated_price_creative_units
required
Estimated Price Creative Units

Estimated price in Creative Units.

number
poll_interval_seconds
required
Poll Interval Seconds

Suggested polling interval in seconds.

integer
created_at
required
Created At

Timestamp of when the run was created.

string format: date-time
session_id
Session Id

Session ID the run was added to, if a session was specified.

string format: uuid
nullable
expected_events
Expected Events

Deliveries this run will produce. Empty when no webhook was supplied.

Array<string>
default:
Allowed values: inference.completed inference.failed inference.cancelled training.succeeded training.failed scoring_run.completed scoring_run.failed workflow_run.succeeded workflow_run.failed workflow_run.cancelled
Example
{
"status": "pending",
"expected_events": []
}

Unauthenticated — missing or invalid Bearer token.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Forbidden — insufficient permissions, or the access token lacks the scope the operation requires.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Resource not found.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

The outcome of the request with this Idempotency-Key is not known yet: it is still running, or it failed without a stored response. Retry after the number of seconds in Retry-After.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Invalid input parameters, or an Idempotency-Key reused for a different request.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Rate limited — retry after the number of seconds in Retry-After.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}

Internal server error.

Media typeapplication/problem+json
object
type
required
string
title
required
string
status
required
integer
detail
required
string
Example
{
"type": "https://api.layer.ai/errors/ERROR_CODE",
"title": "Error Title",
"status": 400,
"detail": "Human-readable description."
}