Strand AI Samples API

The Samples API from Strand AI — 3 operation(s) for samples.

OpenAPI Specification

strand-ai-samples-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Strand AI Platform Jobs Samples 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: Samples
paths:
  /samples/{id}/expiration:
    patch:
      summary: Set sample expiration
      description: Set a sample to expire on a specific date, set it to never expire, or clear any custom expiration and follow the org default. Caller must be the sample's creator, an org owner/admin, or a Strand admin.
      tags:
      - Samples
      operationId: setSampleExpiration
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExpirationUpdate'
      responses:
        '200':
          description: Updated sample
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sample'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not allowed for this sample
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Sample not found in this org
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /samples/expiration:
    patch:
      summary: Set sample expiration (bulk)
      description: 'All-or-nothing: if any sample fails the permission gate the whole call is rejected before any writes. Max 500 IDs per call.'
      tags:
      - Samples
      operationId: setSamplesExpirationBulk
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
              - $ref: '#/components/schemas/ExpirationUpdate'
              - type: object
                required:
                - sampleIds
                properties:
                  sampleIds:
                    type: array
                    minItems: 1
                    maxItems: 500
                    items:
                      type: string
                      format: uuid
      responses:
        '200':
          description: Bulk update result
          content:
            application/json:
              schema:
                type: object
                required:
                - updated
                - batchId
                properties:
                  updated:
                    type: integer
                  batchId:
                    type: string
                    format: uuid
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: One or more samples are not in the API key's org
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Invalid input
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /samples/{id}/restore:
    post:
      summary: Restore a sample from Trash
      description: Available within the 7-day Trash window. Brings the sample back to the active list and extends its expiration so it isn't immediately re-trashed. Same permission gate as the expiration endpoints.
      tags:
      - Samples
      operationId: restoreSample
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
      responses:
        '200':
          description: Restored sample
          content:
            application/json:
              schema:
                type: object
                required:
                - id
                properties:
                  id:
                    type: string
                    format: uuid
                  archivedAt:
                    type: 'null'
                  expiresAt:
                    type: string
                    format: date-time
                    nullable: true
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Not allowed for this sample
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Sample not found in this org
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '412':
          description: Sample is not archived
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ExpirationUpdate:
      type: object
      description: 'Provide exactly one of `expiresAt`, `neverExpire: true`, or `useOrgDefault: true`. `neverExpire: true` is sugar for `expiresAt: null` (custom). `useOrgDefault: true` clears the custom expiration and follows the org''s default policy.'
      properties:
        expiresAt:
          type: string
          format: date-time
          nullable: true
        neverExpire:
          type: boolean
        useOrgDefault:
          type: boolean
        reason:
          type: string
          maxLength: 500
    Error:
      type: object
      required:
      - error
      - message
      properties:
        error:
          type: string
        message:
          type: string
        required:
          type: integer
          nullable: true
    Sample:
      type: object
      required:
      - id
      properties:
        id:
          type: string
          format: uuid
        expiresAt:
          type: string
          format: date-time
          nullable: true
        expiresAtSource:
          type: string
          nullable: true
          enum:
          - org_default
          - custom
          - null
        retentionChangedAt:
          type: string
          format: date-time
          nullable: true
        retentionChangedBy:
          type: string
          nullable: true
        batchId:
          type: string
          format: uuid
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: sk-strand-XXXXXXXXXXXXXXXXXXXXXXXX