> ## Documentation Index
> Fetch the complete documentation index at: https://docs.strandai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Price or submit a prediction

> Validate and price a prediction with dryRun: true and no side effects, or omit dryRun to reserve credits and submit the run.



## OpenAPI

````yaml POST /predict
openapi: 3.1.0
info:
  title: Strand AI Platform API
  version: v1
  description: >-
    REST surface for uploading WSIs, submitting Lattice inference jobs, and
    streaming results. All endpoints require an API key or Strand AI OAuth
    access token in the `Authorization: Bearer` header.
servers:
  - url: https://app.strandai.com/api/v1
    description: Production
security:
  - ApiKey: []
  - OAuth2: []
paths:
  /predict:
    post:
      summary: Price or submit a prediction
      description: >-
        Set `dryRun: true` to validate and price the prediction without writes
        or credit reservation (200). Omit it or set it to false to reserve
        credits atomically and enqueue preprocessing (202). For an approved
        submission, send the prior estimate as `expectedEstimate` and a fresh
        UUID-v4 `Idempotency-Key`; exact retries return the original job without
        a second reservation while that job remains stored. Hard deletion of the
        job, its sample, organization, or account removes the mapping and ends
        the replay guarantee. The header is invalid on dry runs.
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            format: uuid
            pattern: >-
              ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89aAbB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
          description: >-
            Optional UUID-v4 exactly-once key for a non-dry-run submission,
            scoped to the authenticated organization and principal. Reusing it
            with a different request returns 409. Replay is retained while the
            resulting job remains stored; hard deletion of the job, sample,
            organization, or account removes the mapping.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
                - uploadId
                - markers
              properties:
                uploadId:
                  type: string
                  format: uuid
                markers:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  maxItems: 512
                model:
                  type: string
                  enum:
                    - v0.4
                    - v0.5
                    - v0.7
                  description: >-
                    Optional explicit Lattice version. Only `v0.7` is
                    dispatchable and is the current default; omit `model` to let
                    the platform pick it. `v0.4`/`v0.5` are READ-ONLY as of
                    2026-06-23: they remain in this enum because they still
                    appear on historical job records, but requesting one returns
                    400 `model_sunset` (with `currentDefault`). Legacy model
                    strings return 400 `unknown_model`.
                dryRun:
                  type: boolean
                  default: false
                  description: >-
                    When true, validates and returns the exact credit estimate
                    without reserving credits, creating a job, or dispatching
                    work.
                expectedEstimate:
                  type: object
                  additionalProperties: false
                  required:
                    - patchCount
                    - markerCount
                    - estimatedCredits
                  description: >-
                    Optional exact estimate returned by a prior dry run. Valid
                    only for submission; any mismatch returns `estimate_changed`
                    before writes.
                  properties:
                    patchCount:
                      type: integer
                      minimum: 1
                    markerCount:
                      type: integer
                      minimum: 1
                    estimatedCredits:
                      type: integer
                      minimum: 0
      responses:
        '200':
          description: Validated dry-run estimate with no side effects
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Estimate'
        '202':
          description: Job accepted and credits reserved
          headers:
            Idempotent-Replayed:
              description: >-
                Present with value `true` when this is a replay of the original
                accepted response.
              schema:
                type: string
                enum:
                  - 'true'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Submission'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Insufficient credits
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            One or more requested markers are outside this account's panel
            (`marker_not_available`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            Upload not ready, the approved estimate changed, or the idempotency
            key was reused for a different request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Estimate:
      type: object
      required:
        - dryRun
        - patchCount
        - markerCount
        - estimatedCredits
        - orgBalance
        - orgPending
      properties:
        dryRun:
          type: boolean
          enum:
            - true
        patchCount:
          type: integer
        markerCount:
          type: integer
        estimatedCredits:
          type: integer
        orgBalance:
          type: integer
        orgPending:
          type: integer
    Submission:
      type: object
      required:
        - jobId
        - reservedCredits
        - status
      properties:
        jobId:
          type: string
          format: uuid
        reservedCredits:
          type: integer
        status:
          type: string
          enum:
            - queued
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
        reason:
          type: string
          nullable: true
        required:
          type: integer
          nullable: true
        retryAfterSeconds:
          type: integer
          nullable: true
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: sk-strand-XXXXXXXXXXXXXXXXXXXXXXXX
    OAuth2:
      type: oauth2
      description: >-
        Strand AI authorization-code flow with S256 PKCE, explicit organization
        consent, and RFC 8707 resource binding.
      flows:
        authorizationCode:
          authorizationUrl: https://auth.strandai.com/oauth2/auth
          tokenUrl: https://auth.strandai.com/oauth2/token
          scopes:
            samples:read: Read slide metadata and estimates
            samples:write: Upload and change slides
            jobs:read: Read run status
            jobs:write: Start, export, or cancel runs
            results:read: Read and download results
            credits:spend: Reserve and spend organization credits

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.