דלג לתוכן הראשי

Lumen Platform API

APIplatform-v1OpenAPI v1

The API an application built on Lumen uses, with an app key: the worker API its remote steps' workers call.

מאפייןערך
Serverhttps://api.go-lumen.ai
AuthenticationAn app key issued to your application: Authorization: Bearer lak_<id>_<secret>. App keys (lak_) are separate from the workspace API keys (lmn_) of the Runtime API.
OpenAPI fileplatform-v1.json
Operations5

Overview​

The API an application built on Lumen uses, authenticated by a key of its AppClient (Authorization: Bearer lak_<id>_<secret>).

Worker API (/worker/v1): an app's own workers pull the tasks of its remote steps (ClusterStep executor.remote.app) from the region the workspace lives in. A worker claims tasks, heartbeats them every lease/3, uploads any files through artifacts:presign, and completes or fails each attempt. An attempt it no longer holds (its lease ran out and the task was claimed again, or it finished) answers 409, and the worker must stop working on it. The task idempotencyKey is stable across attempts: key side effects on it.

Errors are a Status object (code, reason, message).

Operations​

MethodPathOperation
POST/worker/v1/artifacts:presignSign an upload of one artifact of a held attempt
POST/worker/v1/claimsClaim tasks of the app's remote steps
POST/worker/v1/heartbeatsExtend the leases of held tasks
POST/worker/v1/tasks/{taskId}/attempts/{attempt}:completeComplete a held attempt
POST/worker/v1/tasks/{taskId}/attempts/{attempt}:failFail a held attempt

Request and response bodies below are described by the schemas in Schemas; the example bodies are built from those schemas.

Sign an upload of one artifact of a held attempt​

POST/worker/v1/artifacts:presign

Returns a PUT to the region's store, among the run's files. Send exactly the returned headers: Content-Type and Content-Length are signed, so the store refuses any other body. The size and type are checked again when the attempt completes.

Request body application/json

Fieldסוגברירת מחדלתיאור
attemptחובהinteger-
contentTypeחובהstring-
nameחובהstring-pattern `^[A-Za-z0-9_-][A-Za-z0-9._-]{0,127}$`
sizeחובהinteger-minimum 1
taskIdחובהstring-
request body (built from the schema)
{
"attempt": 1,
"contentType": "string",
"name": "string",
"size": 1,
"taskId": "string"
}

Responses

StatusMeaning
200The signed upload.
400The request is malformed or breaks a limit. (BadRequest)
401No valid app key. (Unauthorized)
403The key lacks the scope, the region, or a label it presented; or the task is not the app's. (Forbidden)
409The attempt is not held by this worker any more; stop working on it. (NotHeld)

Response 200

Fieldסוגברירת מחדלתיאור
expiresAtחובהstring-
headersחובהmap of string-
methodחובהstring-one of PUT
nameחובהstring-
urlחובהstring-
response 200 (built from the schema)
{
"expiresAt": "2026-01-02T15:04:05Z",
"headers": {},
"method": "PUT",
"name": "string",
"url": "string"
}

Claim tasks of the app's remote steps​

POST/worker/v1/claims

Takes up to limit tasks the worker may run, from the workspaces the app is installed in, each leased for leaseSeconds. With waitSeconds the call waits that long for a task when none is ready (a long poll). The labels a worker presents must be granted by the AppClient's spec.workerLabels; the app label is set for it.

Request body application/json

Fieldסוגברירת מחדלתיאור
labelsmap of string-What the worker carries, each granted by the AppClient's spec.workerLabels.
leaseSecondsinteger60minimum 30; maximum 600
limitinteger1minimum 1; maximum 50
waitSecondsinteger0minimum 0; maximum 25
workerחובהstring-The worker's own name, a DNS label; the same for every call about its tasks.pattern `^[a-z0-9]([-a-z0-9.]{0,61}[a-z0-9])?$`
request body (built from the schema)
{
"labels": {},
"leaseSeconds": 60,
"limit": 1,
"waitSeconds": 0,
"worker": "string"
}

Responses

StatusMeaning
200The tasks claimed; none when nothing was ready.
400The request is malformed or breaks a limit. (BadRequest)
401No valid app key. (Unauthorized)
403The key lacks the scope, the region, or a label it presented; or the task is not the app's. (Forbidden)
429The key holds as many open claims as it may; retry after Retry-After. (TooManyRequests)

Response 200

Fieldסוגברירת מחדלתיאור
tasksחובהlist of object-
tasks[].attemptחובהinteger-This claim's attempt; later calls name it.
tasks[].configobject-The node's settings.
tasks[].idחובהstring-Opaque; names the task in every later call.
tasks[].idempotencyKeyחובהstring-Stable across attempts.
tasks[].inputחובהlist of object-
tasks[].input[].fieldsmap of object-
tasks[].input[].fileslist of object-
tasks[].input[].files[].contentTypeחובהstring-
tasks[].input[].files[].nameחובהstring-
tasks[].input[].files[].sizeחובהinteger-
tasks[].input[].files[].urlstring-A signed GET
tasks[].input[].textstring-
tasks[].leaseExpiresAtחובהstring-
tasks[].maxAttemptsחובהinteger-
tasks[].nodeIdחובהstring-
tasks[].runIdחובהstring-
tasks[].stepחובהstring-The ClusterStep's name.
tasks[].workspaceחובהstring-
response 200 (built from the schema)
{
"tasks": [
{
"attempt": 1,
"config": {},
"id": "string",
"idempotencyKey": "string",
"input": [
{
"fields": {},
"files": [
null
],
"text": "string"
}
],
"leaseExpiresAt": "2026-01-02T15:04:05Z",
"maxAttempts": 1,
"nodeId": "string",
"runId": "string",
"step": "string",
"workspace": "string"
}
]
}

Extend the leases of held tasks​

POST/worker/v1/heartbeats

Extends the lease of every attempt the worker still holds and returns those. An attempt missing from the answer was lost: stop working on it.

Request body application/json

Fieldסוגברירת מחדלתיאור
leaseSecondsinteger60minimum 30; maximum 600
refsחובהlist of object-maxItems 200
refs[].attemptחובהinteger-
refs[].idחובהstring-
request body (built from the schema)
{
"leaseSeconds": 60,
"refs": [
{
"attempt": 1,
"id": "string"
}
]
}

Responses

StatusMeaning
200The attempts still held.
400The request is malformed or breaks a limit. (BadRequest)
401No valid app key. (Unauthorized)
403The key lacks the scope, the region, or a label it presented; or the task is not the app's. (Forbidden)

Response 200

Fieldסוגברירת מחדלתיאור
refsחובהlist of object-
refs[].attemptחובהinteger-
refs[].idחובהstring-
response 200 (built from the schema)
{
"refs": [
{
"attempt": 1,
"id": "string"
}
]
}

Complete a held attempt​

POST/worker/v1/tasks/{taskId}/attempts/{attempt}:complete

Finishes the attempt with its output, and the run goes on. The output's fields are set over the first input document's, its text replaces the text when given, and each artifact (uploaded first through artifacts:presign) is added as a file.

Parameters

NameInTypeDescription
taskIdחובהpathstringThe task id a claim returned (opaque).
attemptחובהpathinteger<nil>

Request body application/json

Fieldסוגברירת מחדלתיאור
artifactslist of object-
artifacts[].nameחובהstring-The name presigned for this attempt.
outputחובהobject-
output.fieldsmap of object-
output.textstring-
weightMilliinteger-Work done, in milli-credits; the step's catalog weight is the least charged.
request body (built from the schema)
{
"artifacts": [
{
"name": "string"
}
],
"output": {
"fields": {},
"text": "string"
},
"weightMilli": 1
}

Responses

StatusMeaning
204Completed.
400The request is malformed or breaks a limit. (BadRequest)
401No valid app key. (Unauthorized)
403The key lacks the scope, the region, or a label it presented; or the task is not the app's. (Forbidden)
409The attempt is not held by this worker any more; stop working on it. (NotHeld)

Fail a held attempt​

POST/worker/v1/tasks/{taskId}/attempts/{attempt}:fail

A retryable failure queues the task again after backoffSeconds while it has attempts left; otherwise the task and its run fail.

Parameters

NameInTypeDescription
taskIdחובהpathstringThe task id a claim returned (opaque).
attemptחובהpathinteger<nil>

Request body application/json

Fieldסוגברירת מחדלתיאור
backoffSecondsinteger0minimum 0; maximum 3600
errorחובהstring-maxLength 2000
retryablebooleanfalse
request body (built from the schema)
{
"backoffSeconds": 0,
"error": "string",
"retryable": false
}

Responses

StatusMeaning
204Failed.
400The request is malformed or breaks a limit. (BadRequest)
401No valid app key. (Unauthorized)
403The key lacks the scope, the region, or a label it presented; or the task is not the app's. (Forbidden)
409The attempt is not held by this worker any more; stop working on it. (NotHeld)

Schemas​

ArtifactRef​

Fieldסוגברירת מחדלתיאור
nameחובהstring-The name presigned for this attempt.
example (built from the schema)
{
"name": "string"
}

ClaimRequest​

Fieldסוגברירת מחדלתיאור
labelsmap of string-What the worker carries, each granted by the AppClient's spec.workerLabels.
leaseSecondsinteger60minimum 30; maximum 600
limitinteger1minimum 1; maximum 50
waitSecondsinteger0minimum 0; maximum 25
workerחובהstring-The worker's own name, a DNS label; the same for every call about its tasks.pattern `^[a-z0-9]([-a-z0-9.]{0,61}[a-z0-9])?$`
example (built from the schema)
{
"labels": {},
"leaseSeconds": 60,
"limit": 1,
"waitSeconds": 0,
"worker": "string"
}

ClaimResponse​

Fieldסוגברירת מחדלתיאור
tasksחובהlist of object-
tasks[].attemptחובהinteger-This claim's attempt; later calls name it.
tasks[].configobject-The node's settings.
tasks[].idחובהstring-Opaque; names the task in every later call.
tasks[].idempotencyKeyחובהstring-Stable across attempts.
tasks[].inputחובהlist of object-
tasks[].input[].fieldsmap of object-
tasks[].input[].fileslist of object-
tasks[].input[].files[].contentTypeחובהstring-
tasks[].input[].files[].nameחובהstring-
tasks[].input[].files[].sizeחובהinteger-
tasks[].input[].files[].urlstring-A signed GET
tasks[].input[].textstring-
tasks[].leaseExpiresAtחובהstring-
tasks[].maxAttemptsחובהinteger-
tasks[].nodeIdחובהstring-
tasks[].runIdחובהstring-
tasks[].stepחובהstring-The ClusterStep's name.
tasks[].workspaceחובהstring-
example (built from the schema)
{
"tasks": [
{
"attempt": 1,
"config": {},
"id": "string",
"idempotencyKey": "string",
"input": [
{
"fields": {},
"files": [
null
],
"text": "string"
}
],
"leaseExpiresAt": "2026-01-02T15:04:05Z",
"maxAttempts": 1,
"nodeId": "string",
"runId": "string",
"step": "string",
"workspace": "string"
}
]
}

CompleteRequest​

Fieldסוגברירת מחדלתיאור
artifactslist of object-
artifacts[].nameחובהstring-The name presigned for this attempt.
outputחובהobject-
output.fieldsmap of object-
output.textstring-
weightMilliinteger-Work done, in milli-credits; the step's catalog weight is the least charged.
example (built from the schema)
{
"artifacts": [
{
"name": "string"
}
],
"output": {
"fields": {},
"text": "string"
},
"weightMilli": 1
}

Document​

Fieldסוגברירת מחדלתיאור
fieldsmap of object-
fileslist of object-
files[].contentTypeחובהstring-
files[].nameחובהstring-
files[].sizeחובהinteger-
files[].urlstring-A signed GET
textstring-
example (built from the schema)
{
"fields": {},
"files": [
{
"contentType": "string",
"name": "string",
"size": 1,
"url": "string"
}
],
"text": "string"
}

FailRequest​

Fieldסוגברירת מחדלתיאור
backoffSecondsinteger0minimum 0; maximum 3600
errorחובהstring-maxLength 2000
retryablebooleanfalse
example (built from the schema)
{
"backoffSeconds": 0,
"error": "string",
"retryable": false
}

Field​

Fieldסוגברירת מחדלתיאור
rawstring-What the document said; defaults to the value as text.
typeחובהstring-one of string, number, boolean, date, money, object, array
valueany-The value; a money value is {amount, currency}, a date YYYY-MM-DD.
example (built from the schema)
{
"raw": "string",
"type": "string",
"value": "string"
}

HeartbeatRequest​

Fieldסוגברירת מחדלתיאור
leaseSecondsinteger60minimum 30; maximum 600
refsחובהlist of object-maxItems 200
refs[].attemptחובהinteger-
refs[].idחובהstring-
example (built from the schema)
{
"leaseSeconds": 60,
"refs": [
{
"attempt": 1,
"id": "string"
}
]
}

HeartbeatResponse​

Fieldסוגברירת מחדלתיאור
refsחובהlist of object-
refs[].attemptחובהinteger-
refs[].idחובהstring-
example (built from the schema)
{
"refs": [
{
"attempt": 1,
"id": "string"
}
]
}

InputFile​

Fieldסוגברירת מחדלתיאור
contentTypeחובהstring-
nameחובהstring-
sizeחובהinteger-
urlstring-A signed GET
example (built from the schema)
{
"contentType": "string",
"name": "string",
"size": 1,
"url": "string"
}

Output​

Fieldסוגברירת מחדלתיאור
fieldsmap of object-
textstring-
example (built from the schema)
{
"fields": {},
"text": "string"
}

PresignRequest​

Fieldסוגברירת מחדלתיאור
attemptחובהinteger-
contentTypeחובהstring-
nameחובהstring-pattern `^[A-Za-z0-9_-][A-Za-z0-9._-]{0,127}$`
sizeחובהinteger-minimum 1
taskIdחובהstring-
example (built from the schema)
{
"attempt": 1,
"contentType": "string",
"name": "string",
"size": 1,
"taskId": "string"
}

PresignResponse​

Fieldסוגברירת מחדלתיאור
expiresAtחובהstring-
headersחובהmap of string-
methodחובהstring-one of PUT
nameחובהstring-
urlחובהstring-
example (built from the schema)
{
"expiresAt": "2026-01-02T15:04:05Z",
"headers": {},
"method": "PUT",
"name": "string",
"url": "string"
}

Status​

Fieldסוגברירת מחדלתיאור
codeinteger-
messagestring-
reasonstring-
example (built from the schema)
{
"code": 1,
"message": "string",
"reason": "string"
}

Task​

Fieldסוגברירת מחדלתיאור
attemptחובהinteger-This claim's attempt; later calls name it.
configobject-The node's settings.
idחובהstring-Opaque; names the task in every later call.
idempotencyKeyחובהstring-Stable across attempts.
inputחובהlist of object-
input[].fieldsmap of object-
input[].fileslist of object-
input[].files[].contentTypeחובהstring-
input[].files[].nameחובהstring-
input[].files[].sizeחובהinteger-
input[].files[].urlstring-A signed GET
input[].textstring-
leaseExpiresAtחובהstring-
maxAttemptsחובהinteger-
nodeIdחובהstring-
runIdחובהstring-
stepחובהstring-The ClusterStep's name.
workspaceחובהstring-
example (built from the schema)
{
"attempt": 1,
"config": {},
"id": "string",
"idempotencyKey": "string",
"input": [
{
"fields": {},
"files": [
{
"contentType": "string",
"name": "string",
"size": 1,
"url": "string"
}
],
"text": "string"
}
],
"leaseExpiresAt": "2026-01-02T15:04:05Z",
"maxAttempts": 1,
"nodeId": "string",
"runId": "string",
"step": "string",
"workspace": "string"
}

TaskRef​

Fieldסוגברירת מחדלתיאור
attemptחובהinteger-
idחובהstring-
example (built from the schema)
{
"attempt": 1,
"id": "string"
}