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

# Run a job

> Run one model on its input. The files go to your Summer library. Short jobs come back done; long ones answer running with a job id to follow with GET /v1/jobs/{jobId}. A quoteId caps the charge.



## OpenAPI

````yaml scripts/api/sources/openapi.json POST /jobs
openapi: 3.1.0
info:
  title: Summer API
  version: '1'
  description: >-
    Curated, tested game-dev models: 3D, images, video, voice, sound and music,
    into your Summer assets.
servers:
  - url: https://www.summerengine.com/v1
security:
  - bearer: []
paths:
  /jobs:
    post:
      summary: Run a Summer API job
      description: >-
        Run a model on its input. Short jobs answer 201 with the finished job;
        long ones answer 202 with a job id: follow it with GET /v1/jobs/{jobId},
        its events, Prefer: wait=60 or a webhookUrl. The made files land in your
        Summer library. No rate limits on paid usage: past your running slots a
        job answers 202 queued at a held price and starts in order.
      operationId: models_run
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
            maxLength: 128
          description: >-
            A new key for each new request; the same key returns the first
            answer.
        - name: Prefer
          in: header
          required: false
          schema:
            type: string
            examples:
              - wait=60
          description: >-
            wait=<seconds, at most 60>: answer with the finished job when it
            finishes in time.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  description: >-
                    A Summer model id from models.list, such as 3d/hunyuan-3d or
                    3d/default.
                  type: string
                  minLength: 1
                  maxLength: 120
                input:
                  description: The model's input, matching its inputSchema.
                  default: {}
                  type: object
                  additionalProperties: {}
                quoteId:
                  description: 'From models.estimate: refuse to charge more than it quoted.'
                  type: string
                  minLength: 1
                  maxLength: 600
                webhookUrl:
                  description: >-
                    Summer POSTs here once, signed, when the job finishes. Needs
                    a signing secret: webhooks.rotate_secret.
                  type: string
                  maxLength: 2048
              required:
                - model
      responses:
        '201':
          description: Done.
          content:
            application/json:
              schema:
                type: object
                properties:
                  job:
                    type: object
                    properties:
                      id:
                        description: 'The job id: read it again until it finishes.'
                        type: string
                      state:
                        type: string
                        enum:
                          - queued
                          - running
                          - awaiting_approval
                          - done
                          - failed
                          - cancelled
                          - declined
                          - expired
                          - stale
                      model:
                        type: string
                      estimatedPrice:
                        description: US dollars as a decimal string.
                        type: string
                        pattern: ^\d+(\.\d+)?$
                      price:
                        description: What the job charged, once known.
                        type: string
                        pattern: ^\d+(\.\d+)?$
                      webhookId:
                        description: >-
                          The webhook delivery for webhookUrl
                          (webhooks.list_deliveries).
                        type: string
                      result:
                        description: 'The finished work: asset ids and Summer file URLs.'
                        type: object
                        additionalProperties: {}
                    required:
                      - id
                      - state
                      - model
                      - estimatedPrice
                    additionalProperties: false
                required:
                  - job
                additionalProperties: false
        '202':
          description: 'Still running: follow job.id with GET /v1/jobs/{jobId}.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  job:
                    type: object
                    properties:
                      id:
                        description: 'The job id: read it again until it finishes.'
                        type: string
                      state:
                        type: string
                        enum:
                          - queued
                          - running
                          - awaiting_approval
                          - done
                          - failed
                          - cancelled
                          - declined
                          - expired
                          - stale
                      model:
                        type: string
                      estimatedPrice:
                        description: US dollars as a decimal string.
                        type: string
                        pattern: ^\d+(\.\d+)?$
                      price:
                        description: What the job charged, once known.
                        type: string
                        pattern: ^\d+(\.\d+)?$
                      webhookId:
                        description: >-
                          The webhook delivery for webhookUrl
                          (webhooks.list_deliveries).
                        type: string
                      result:
                        description: 'The finished work: asset ids and Summer file URLs.'
                        type: object
                        additionalProperties: {}
                    required:
                      - id
                      - state
                      - model
                      - estimatedPrice
                    additionalProperties: false
                required:
                  - job
                additionalProperties: false
        default:
          description: An error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
            - param
            - request_id
            - doc_url
          properties:
            type:
              type: string
            code:
              type: string
              description: >-
                A stable code: invalid_input, not_signed_in, no_credits (the
                paid balance), over_limit (the app's own spend limit), ...
            message:
              type: string
            param:
              type:
                - string
                - 'null'
              description: The field to fix, such as input.prompt or Idempotency-Key.
            request_id:
              type: string
            doc_url:
              type: string
            fix_url:
              type: string
              description: Where the person fixes it, such as adding credits.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        A Summer sign-in: an OAuth 2.1 access token, valid one hour. Sign in
        once with npx -y summer-engine login, then print a token with summer
        token. Each app you sign in spends your paid credits up to the limit you
        set in Connected apps.

````

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