Zum Hauptinhalt springen

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.

EigenschaftWert
Serverhttps://api.go-lumen.ai
AuthentifizierungAn 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-Dateiplatform-v1.json
Operationen5

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.

Anfragetext application/json

FeldTypStandardwertBeschreibung
attempterforderlichinteger-
contentTypeerforderlichstring-
nameerforderlichstring-pattern `^[A-Za-z0-9_-][A-Za-z0-9._-]{0,127}$`
sizeerforderlichinteger-minimum 1
taskIderforderlichstring-
request body (built from the schema)
{
"attempt": 1,
"contentType": "string",
"name": "string",
"size": 1,
"taskId": "string"
}

Antworten

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)

Antwort 200

FeldTypStandardwertBeschreibung
expiresAterforderlichstring-
headerserforderlichmap of string-
methoderforderlichstring-one of PUT
nameerforderlichstring-
urlerforderlichstring-
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.

Anfragetext application/json

FeldTypStandardwertBeschreibung
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
workererforderlichstring-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"
}

Antworten

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)

Antwort 200

FeldTypStandardwertBeschreibung
taskserforderlichlist of object-
tasks[].attempterforderlichinteger-This claim's attempt; later calls name it.
tasks[].configobject-The node's settings.
tasks[].iderforderlichstring-Opaque; names the task in every later call.
tasks[].idempotencyKeyerforderlichstring-Stable across attempts.
tasks[].inputerforderlichlist of object-
tasks[].input[].fieldsmap of object-
tasks[].input[].fileslist of object-
tasks[].input[].files[].contentTypeerforderlichstring-
tasks[].input[].files[].nameerforderlichstring-
tasks[].input[].files[].sizeerforderlichinteger-
tasks[].input[].files[].urlstring-A signed GET
tasks[].input[].textstring-
tasks[].leaseExpiresAterforderlichstring-
tasks[].maxAttemptserforderlichinteger-
tasks[].nodeIderforderlichstring-
tasks[].runIderforderlichstring-
tasks[].steperforderlichstring-The ClusterStep's name.
tasks[].workspaceerforderlichstring-
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.

Anfragetext application/json

FeldTypStandardwertBeschreibung
leaseSecondsinteger60minimum 30; maximum 600
refserforderlichlist of object-maxItems 200
refs[].attempterforderlichinteger-
refs[].iderforderlichstring-
request body (built from the schema)
{
"leaseSeconds": 60,
"refs": [
{
"attempt": 1,
"id": "string"
}
]
}

Antworten

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)

Antwort 200

FeldTypStandardwertBeschreibung
refserforderlichlist of object-
refs[].attempterforderlichinteger-
refs[].iderforderlichstring-
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.

Parameter

NameInTypeDescription
taskIderforderlichpathstringThe task id a claim returned (opaque).
attempterforderlichpathinteger<nil>

Anfragetext application/json

FeldTypStandardwertBeschreibung
artifactslist of object-
artifacts[].nameerforderlichstring-The name presigned for this attempt.
outputerforderlichobject-
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
}

Antworten

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.

Parameter

NameInTypeDescription
taskIderforderlichpathstringThe task id a claim returned (opaque).
attempterforderlichpathinteger<nil>

Anfragetext application/json

FeldTypStandardwertBeschreibung
backoffSecondsinteger0minimum 0; maximum 3600
errorerforderlichstring-maxLength 2000
retryablebooleanfalse
request body (built from the schema)
{
"backoffSeconds": 0,
"error": "string",
"retryable": false
}

Antworten

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​

FeldTypStandardwertBeschreibung
nameerforderlichstring-The name presigned for this attempt.
example (built from the schema)
{
"name": "string"
}

ClaimRequest​

FeldTypStandardwertBeschreibung
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
workererforderlichstring-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​

FeldTypStandardwertBeschreibung
taskserforderlichlist of object-
tasks[].attempterforderlichinteger-This claim's attempt; later calls name it.
tasks[].configobject-The node's settings.
tasks[].iderforderlichstring-Opaque; names the task in every later call.
tasks[].idempotencyKeyerforderlichstring-Stable across attempts.
tasks[].inputerforderlichlist of object-
tasks[].input[].fieldsmap of object-
tasks[].input[].fileslist of object-
tasks[].input[].files[].contentTypeerforderlichstring-
tasks[].input[].files[].nameerforderlichstring-
tasks[].input[].files[].sizeerforderlichinteger-
tasks[].input[].files[].urlstring-A signed GET
tasks[].input[].textstring-
tasks[].leaseExpiresAterforderlichstring-
tasks[].maxAttemptserforderlichinteger-
tasks[].nodeIderforderlichstring-
tasks[].runIderforderlichstring-
tasks[].steperforderlichstring-The ClusterStep's name.
tasks[].workspaceerforderlichstring-
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​

FeldTypStandardwertBeschreibung
artifactslist of object-
artifacts[].nameerforderlichstring-The name presigned for this attempt.
outputerforderlichobject-
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​

FeldTypStandardwertBeschreibung
fieldsmap of object-
fileslist of object-
files[].contentTypeerforderlichstring-
files[].nameerforderlichstring-
files[].sizeerforderlichinteger-
files[].urlstring-A signed GET
textstring-
example (built from the schema)
{
"fields": {},
"files": [
{
"contentType": "string",
"name": "string",
"size": 1,
"url": "string"
}
],
"text": "string"
}

FailRequest​

FeldTypStandardwertBeschreibung
backoffSecondsinteger0minimum 0; maximum 3600
errorerforderlichstring-maxLength 2000
retryablebooleanfalse
example (built from the schema)
{
"backoffSeconds": 0,
"error": "string",
"retryable": false
}

Field​

FeldTypStandardwertBeschreibung
rawstring-What the document said; defaults to the value as text.
typeerforderlichstring-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​

FeldTypStandardwertBeschreibung
leaseSecondsinteger60minimum 30; maximum 600
refserforderlichlist of object-maxItems 200
refs[].attempterforderlichinteger-
refs[].iderforderlichstring-
example (built from the schema)
{
"leaseSeconds": 60,
"refs": [
{
"attempt": 1,
"id": "string"
}
]
}

HeartbeatResponse​

FeldTypStandardwertBeschreibung
refserforderlichlist of object-
refs[].attempterforderlichinteger-
refs[].iderforderlichstring-
example (built from the schema)
{
"refs": [
{
"attempt": 1,
"id": "string"
}
]
}

InputFile​

FeldTypStandardwertBeschreibung
contentTypeerforderlichstring-
nameerforderlichstring-
sizeerforderlichinteger-
urlstring-A signed GET
example (built from the schema)
{
"contentType": "string",
"name": "string",
"size": 1,
"url": "string"
}

Output​

FeldTypStandardwertBeschreibung
fieldsmap of object-
textstring-
example (built from the schema)
{
"fields": {},
"text": "string"
}

PresignRequest​

FeldTypStandardwertBeschreibung
attempterforderlichinteger-
contentTypeerforderlichstring-
nameerforderlichstring-pattern `^[A-Za-z0-9_-][A-Za-z0-9._-]{0,127}$`
sizeerforderlichinteger-minimum 1
taskIderforderlichstring-
example (built from the schema)
{
"attempt": 1,
"contentType": "string",
"name": "string",
"size": 1,
"taskId": "string"
}

PresignResponse​

FeldTypStandardwertBeschreibung
expiresAterforderlichstring-
headerserforderlichmap of string-
methoderforderlichstring-one of PUT
nameerforderlichstring-
urlerforderlichstring-
example (built from the schema)
{
"expiresAt": "2026-01-02T15:04:05Z",
"headers": {},
"method": "PUT",
"name": "string",
"url": "string"
}

Status​

FeldTypStandardwertBeschreibung
codeinteger-
messagestring-
reasonstring-
example (built from the schema)
{
"code": 1,
"message": "string",
"reason": "string"
}

Task​

FeldTypStandardwertBeschreibung
attempterforderlichinteger-This claim's attempt; later calls name it.
configobject-The node's settings.
iderforderlichstring-Opaque; names the task in every later call.
idempotencyKeyerforderlichstring-Stable across attempts.
inputerforderlichlist of object-
input[].fieldsmap of object-
input[].fileslist of object-
input[].files[].contentTypeerforderlichstring-
input[].files[].nameerforderlichstring-
input[].files[].sizeerforderlichinteger-
input[].files[].urlstring-A signed GET
input[].textstring-
leaseExpiresAterforderlichstring-
maxAttemptserforderlichinteger-
nodeIderforderlichstring-
runIderforderlichstring-
steperforderlichstring-The ClusterStep's name.
workspaceerforderlichstring-
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​

FeldTypStandardwertBeschreibung
attempterforderlichinteger-
iderforderlichstring-
example (built from the schema)
{
"attempt": 1,
"id": "string"
}