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

# Get an image generation

> Poll an image-generation job for status and, once completed, the produced images.

Retrieve the status of a generation job. While it is `pending` or `processing`,
keep polling; once `completed`, the response carries the produced images, each with
a presigned `url` valid for **24 hours** — download the assets before they expire.
Only jobs your organization created are visible; any other id returns
[`404 not_found`](/guides/errors#not_found).

<Tip>
  Prefer push over polling? Pass a `webhook_url` on the original
  [generation request](/api-reference/images/generate) to receive a signed callback
  the moment the job reaches a terminal status. See [Webhooks](/guides/webhooks).
</Tip>


## OpenAPI

````yaml api-reference/openapi.json GET /images/generations/{generation_id}
openapi: 3.1.0
info:
  title: Samsa API
  description: >-
    The Samsa public REST API. Authenticate with an organization API key as a
    bearer token (`Authorization: Bearer samsa_sk_...`). Errors follow a single
    envelope shape; every response carries an `X-Request-ID`.
  version: 1.0.0
servers:
  - url: https://api.samsa.ai/public/v1
security:
  - BearerAuth: []
paths:
  /images/generations/{generation_id}:
    get:
      tags:
        - Images
      summary: Retrieve an image generation's status and results
      description: >-
        Returns the job status (`pending`, `processing`, `completed`, `failed`,
        `cancelled`), and — once `completed` — the produced images with
        presigned (24h) URLs. Only jobs your organization submitted through the
        public API are visible; anything else returns `404`. Requires the
        `images.generate` scope.
      operationId: get_image_generation_images_generations__generation_id__get
      parameters:
        - name: generation_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Generation Id
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicImageGenerationDetail'
        '401':
          description: Missing, invalid, expired, or revoked API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: The API key lacks the required scope for this operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: Generation, or a referenced model/palette, not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '422':
          description: Request validation failed (prompt, engine, resolution, ...).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '429':
          description: Per-key rate limit or per-org concurrency cap exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
components:
  schemas:
    PublicImageGenerationDetail:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        status:
          $ref: '#/components/schemas/PublicImageStatus'
          description: '`pending`, `processing`, `completed`, `failed`, or `cancelled`.'
          examples:
            - completed
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the job was submitted.
        credits_used:
          anyOf:
            - type: integer
            - type: 'null'
          title: Credits Used
          description: Credits charged for this job.
          examples:
            - 5
        images:
          items:
            $ref: '#/components/schemas/PublicImageAsset'
          type: array
          title: Images
          description: Produced images (presigned URLs); empty until `completed`.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Failure detail when `status` is `failed`; otherwise null.
      type: object
      required:
        - id
        - status
        - created_at
      title: PublicImageGenerationDetail
      description: >-
        `GET /images/generations/{id}` body (ADR §7.2).


        `created_at` is the job's submit time, sourced from the credit ledger —
        the

        `image_generation_tasks` table has no `created_at` column.
    ErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: ErrorEnvelope
      description: The complete public error body — an ``error`` object wrapper (ADR §5).
    PublicImageStatus:
      type: string
      enum:
        - pending
        - processing
        - completed
        - failed
        - cancelled
      title: PublicImageStatus
      description: >-
        Public image-job status — the lower-cased internal ``TaskStatus``.


        Deliberately the plain lower-cased internal value (NOT the ADR §7.2

        ``PENDING -> queued`` remap): the ticket's 202 uses ``status:
        "pending"`` and

        its fixtures say ``pending/processing/completed/failed``, and this keeps
        the

        public surface consistent with the already-shipped models API

        (``PublicModelStatus``).
    PublicImageAsset:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        url:
          type: string
          title: Url
          description: Presigned, time-limited (24h) HTTPS URL of the full image.
          examples:
            - https://cdn.samsa.ai/user-.../abc.png?X-Amz-Signature=...
        thumbnail_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Thumbnail Url
          description: Presigned (24h) thumbnail URL, when available.
        width:
          anyOf:
            - type: integer
            - type: 'null'
          title: Width
          description: Pixel width, when known.
        height:
          anyOf:
            - type: integer
            - type: 'null'
          title: Height
          description: Pixel height, when known.
        seed:
          anyOf:
            - type: integer
            - type: 'null'
          title: Seed
          description: Seed used, when known.
      type: object
      required:
        - id
        - url
      title: PublicImageAsset
      description: One produced image on a completed job (ADR §7.2).
    ErrorDetail:
      properties:
        type:
          type: string
          title: Type
          examples:
            - authentication_error
        code:
          type: string
          title: Code
          examples:
            - invalid_api_key
        message:
          type: string
          title: Message
          examples:
            - The provided API key is invalid, expired, or revoked.
        request_id:
          type: string
          title: Request Id
          examples:
            - 8f14e45fceea167a5a36dedd4bea2543
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
          description: Present on validation errors — names the offending field.
          examples:
            - aspect_ratio
      type: object
      required:
        - type
        - code
        - message
        - request_id
      title: ErrorDetail
      description: The ``error`` object of the public envelope (ADR §5).
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Organization API key as a bearer token: `Authorization: Bearer
        samsa_sk_...`.

````