Skip to main content
Api

Jobs

List jobs for the caller's tenant

GET
/jobs
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Query Parameters

type?string

Filter by job type

status?string

Filter by status: queued|running|succeeded|failed|cancelled

limit?integer

Max jobs to return (default 25, max 200)

Formatint64
cursor?string

Opaque pagination cursor from a previous response

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/jobs"
{
  "$schema": "/api/v1/schemas/ListJobsOutputBody.json",
  "jobs": [
    {
      "$schema": "/api/v1/schemas/JobDTO.json",
      "created_at": "2019-08-24T14:15:22Z",
      "error": "string",
      "job_id": "string",
      "params": {
        "property1": null,
        "property2": null
      },
      "progress": {
        "message": "string",
        "pct": 0,
        "stage": "string"
      },
      "result": {
        "property1": null,
        "property2": null
      },
      "status": "string",
      "tenant_id": "string",
      "type": "string",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "next_cursor": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Enqueue an async job

POST
/jobs
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/jobs" \  -H "Content-Type: application/json" \  -d '{    "type": "string"  }'
{
  "$schema": "/api/v1/schemas/JobDTO.json",
  "created_at": "2019-08-24T14:15:22Z",
  "error": "string",
  "job_id": "string",
  "params": {
    "property1": null,
    "property2": null
  },
  "progress": {
    "message": "string",
    "pct": 0,
    "stage": "string"
  },
  "result": {
    "property1": null,
    "property2": null
  },
  "status": "string",
  "tenant_id": "string",
  "type": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Get a job (poll for status + results)

GET
/jobs/{jobId}
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

jobId*string

Job UUID

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/jobs/string"
{
  "$schema": "/api/v1/schemas/JobDTO.json",
  "created_at": "2019-08-24T14:15:22Z",
  "error": "string",
  "job_id": "string",
  "params": {
    "property1": null,
    "property2": null
  },
  "progress": {
    "message": "string",
    "pct": 0,
    "stage": "string"
  },
  "result": {
    "property1": null,
    "property2": null
  },
  "status": "string",
  "tenant_id": "string",
  "type": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Best-effort cancel a queued or running job

POST
/jobs/{jobId}/cancel
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

jobId*string

Job UUID

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/jobs/string/cancel"
{
  "$schema": "/api/v1/schemas/JobDTO.json",
  "created_at": "2019-08-24T14:15:22Z",
  "error": "string",
  "job_id": "string",
  "params": {
    "property1": null,
    "property2": null
  },
  "progress": {
    "message": "string",
    "pct": 0,
    "stage": "string"
  },
  "result": {
    "property1": null,
    "property2": null
  },
  "status": "string",
  "tenant_id": "string",
  "type": "string",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}