API referenceInfrastructure
API reference
Claim a run (worker)
Have a token? Manage tokens in the console
POST
For the account's agent: claim the oldest queued run it can execute, with a lease it keeps by reporting. Nothing to claim is an empty answer.
Needs scope infra:worker.
bearerheader
AuthorizationBearer <JWT>An access token from the identity provider: a person's, or a customer's from the client credentials grant with an API key (developers.inorbit.hr). The gateway verifies it; the audience is iohr-api.
iohr.infra.v1.ClaimRunRequest; path variables override their fields
application/json- body
iohr.infra.v1.ClaimRunRequest
branch_heads?can_run?array<string>iohr.infra.v1.ClaimRunResponse
application/json- response
iohr.infra.v1.ClaimRunResponse
lease_until*stringrun?iohr.infra.v1.Run
stack?iohr.infra.v1.Stack
SDK
HTTP
import { ApiError, Public } from "@inorbithr/sdk";// Reads INORBIT_TOKEN, or INORBIT_KEY_ID and INORBIT_KEY_SECRET.const api = Public.fromEnv();try { const { value } = await api.infra.claimRun({ can_run: ["<can_run>"] }); console.log(value);} catch (e) { if (!(e instanceof ApiError)) throw e; console.error(`${e.code}: ${e.problem} (request id ${e.raw.requestId})`); process.exitCode = 1;}npm install @inorbithr/sdk. Calls the package's public surface; an operation newer than your package needs the next release or a client generated for your account. The SDKs.
Example Response
{ "lease_until": "string", "run": { "adds": 0, "approval_id": "string", "budget_seconds": 0, "changes": 0, "commit": "string", "created_at": "string", "destroys": 0, "diff_hash": "string", "engine": "string", "engine_version": "string", "evidence": [ "string" ], "exit_code": 0, "finished_at": "string", "plan_run_id": "string", "reason": "string", "requested_by": "string", "run_id": "string", "stack_id": "string", "started_at": "string", "state": "string", "stub": true, "verb": "string", "worker_id": "string" }, "stack": { "budget_seconds": 0, "cluster_id": "string", "engine": "string", "environment": "string", "host_ids": [ "string" ], "inventory": "string", "kind": "string", "name": "string", "path": "string", "playbook": "string", "ref": "string", "repository": "string", "stack_id": "string", "updated_at": "string", "updated_by": "string", "workspace": "string" }}