Strand AI Jobs API

The Jobs API from Strand AI — 4 operation(s) for jobs.

OpenAPI Specification

strand-ai-jobs-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Strand AI Platform Jobs API
  version: v1
  description: 'REST surface for uploading WSIs, submitting Lattice inference jobs, and streaming results. All endpoints require an `Authorization: Bearer sk-strand-...` header. Generate keys at `/settings/api-keys`.'
servers:
- url: https://app.strandai.com/api/v1
  description: Production
security:
- ApiKey: []
tags:
- name: Jobs
paths:
  /jobs/{id}:
    get:
      summary: Get job status
      tags:
      - Jobs
      operationId: getJob
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Job
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Job'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /jobs/{id}/stream:
    get:
      summary: Stream job status (SSE)
      description: Server-Sent Events stream emitting JSON snapshots of `{status, progress, resultGcsPath}` on each pg_notify. Keep-alive heartbeats every 15s. Closes on terminal status.
      tags:
      - Jobs
      operationId: streamJob
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: text/event-stream
          content:
            text/event-stream:
              schema:
                type: string
  /jobs/{id}/results:
    get:
      summary: Get signed download URL for results
      description: Returns a signed GCS URL for the OME-Zarr root metadata (`zarr.json`) plus the `resultBasePath` of the zarr store. Useful for clients that already have GCS credentials. SDK clients should generally prefer `GET /jobs/{id}/results/files/{path}` (API-key authenticated) for walking the tree.
      tags:
      - Jobs
      operationId: getJobResults
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Signed URL
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Results'
        '409':
          description: Job has not completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /jobs/{id}/results/files/{path}:
    get:
      summary: Stream a single result file (API-key authenticated)
      description: Proxies a single file from the OME-Zarr result store. `path` is the path within the zarr store (e.g. `zarr.json`, `CD3/zarr.json`, `CD3/c/0/0/0`). Authenticated via the same bearer API key as the rest of `/api/v1/`; org-scoped to the job. Use this when walking the zarr tree from a client that does not have direct GCS credentials.
      tags:
      - Jobs
      operationId: getJobResultFile
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      - name: path
        in: path
        required: true
        description: Path within the zarr store; slashes are not URL-encoded.
        schema:
          type: string
      responses:
        '200':
          description: File bytes (binary for chunks, JSON for metadata).
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
            application/json:
              schema:
                type: object
        '404':
          description: Job or file not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Job has not completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Job:
      type: object
      required:
      - id
      - status
      - markers
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
        progress:
          type: number
          nullable: true
        reservedCredits:
          type: integer
          nullable: true
        markers:
          type: array
          items:
            type: string
        model:
          type: string
          nullable: true
          description: Canonical Lattice version the job ran under (e.g. `"v0.4"`, `"v0.5"`). Always a `v0.X` label — the platform normalizes legacy aliases (`"v10-fullpanel"` → `"v0.4"`, `"v10-fullpanel-v2"` → `"v0.5"`) before persisting. Historical jobs may surface `"v0.3"` (sunset; readable but not dispatchable). `null` only on very old rows that predate the field.
        metadata:
          type: object
          nullable: true
          description: Free-form job metadata. SDK-relevant fields include `modal.endpoint_url` (the Modal URL the dispatcher hit) and `modal.model` (mirror of the top-level `model`).
          properties:
            modal:
              type: object
              properties:
                endpoint_url:
                  type: string
                  nullable: true
                model:
                  type: string
                  nullable: true
        createdAt:
          type: string
          format: date-time
          nullable: true
        startedAt:
          type: string
          format: date-time
          nullable: true
        completedAt:
          type: string
          format: date-time
          nullable: true
        errorMessage:
          type: string
          nullable: true
        resultsAvailable:
          type: boolean
    Results:
      type: object
      required:
      - resultUrl
      - expiresAt
      properties:
        resultUrl:
          type: string
        resultBasePath:
          type: string
        expiresAt:
          type: string
          format: date-time
    Error:
      type: object
      required:
      - error
      - message
      properties:
        error:
          type: string
        message:
          type: string
        required:
          type: integer
          nullable: true
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: sk-strand-XXXXXXXXXXXXXXXXXXXXXXXX