> ## 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.

# Recuperare un job di rimozione dello sfondo

> Interroga un job di rimozione dello sfondo per lo stato e, una volta completato, il PNG trasparente.

Recupera lo stato di un job di rimozione dello sfondo. Finché è `pending` o
`processing`, continua a interrogare; una volta `completed`, la risposta include un
singolo oggetto risultato `image` — un PNG trasparente con un presigned `url` valido
per **24 ore**. Un job in cache hit nasce `completed` con il suo risultato già
allegato. Sono visibili solo i job creati dalla tua organizzazione; qualsiasi altro
id restituisce [`404 not_found`](/it/guides/errors#not_found). Richiede lo scope
`images.transform`.

## Esempio: job completato

L'`image` è un oggetto risultato di formato derivato; per la rimozione dello sfondo,
`model`, `width` e `height` sono sempre `null`. Questo esempio è un cache hit, quindi
`credits_used` è `0` (un miss normale mostra `1`):

```json 200 OK theme={null}
{
  "id": "f7a8b9c0-1d2e-4f3a-4b5c-6d7e8f9a0b1c",
  "status": "completed",
  "created_at": "2026-07-18T10:12:00Z",
  "credits_used": 0,
  "image": {
    "id": "3c4d5e6f-7a8b-4c9d-0e1f-2a3b4c5d6e7f",
    "source_image_id": "123e4567-e89b-12d3-a456-426614174000",
    "format_type": "background_removal",
    "mime_type": "image/png",
    "url": "https://cdn.samsa.ai/user-.../no-bg.png?X-Amz-Signature=...",
    "width": null,
    "height": null,
    "resolution_class": null,
    "model": null
  },
  "error": null
}
```

<Tip>
  Passa un `webhook_url` nella
  [richiesta di rimozione dello sfondo](/it/api-reference/image-ops/remove-background)
  originale per ricevere una callback firmata invece di interrogare — su un cache hit
  l'evento `completed` scatta immediatamente. Vedi [Webhook](/it/guides/webhooks).
</Tip>


## OpenAPI

````yaml api-reference/openapi.json GET /images/background-removals/{background_removal_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/background-removals/{background_removal_id}:
    get:
      tags:
        - Images
      summary: Retrieve a background-removal job's status and result
      description: >-
        Returns the job status (`pending`, `processing`, `completed`, `failed`,
        `cancelled`), and — once `completed` — the produced transparent PNG as a
        single `image` object with a presigned (24h) URL
        (`model`/`width`/`height` are always null for background removal). A
        cache-hit job is born `completed`. Only background-removal jobs your
        organization submitted through the public API are visible; anything else
        returns `404`. Requires the `images.transform` scope.
      operationId: >-
        get_image_background_removal_images_background_removals__background_removal_id__get
      parameters:
        - name: background_removal_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Background Removal Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicBackgroundRemovalDetail'
        '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:
    PublicBackgroundRemovalDetail:
      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: >-
            Net credits charged for this job, after any refunds (0 for a cache
            hit).
          examples:
            - 1
        image:
          anyOf:
            - $ref: '#/components/schemas/PublicImageFormatResult'
            - type: 'null'
          description: >-
            The produced transparent PNG (presigned URL); null 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: PublicBackgroundRemovalDetail
      description: >-
        `GET /images/background-removals/{id}` body (SAM-820 / S8.8 — ADR §7.2).


        The standard async-job envelope plus ONE nullable `image` result object
        (an

        `image_formats` derivative — a transparent PNG — built by the S8.2
        egress

        builder; `model`/`width`/`height` are always null for background
        removal).

        `created_at` is the job's submit time from the credit ledger (the

        `image_generation_tasks` table has no `created_at` column). A cache-hit
        job is

        born `completed` with a frozen result; a normal job progresses

        pending → processing → completed/failed.
    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``).
    PublicImageFormatResult:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Stable id of the produced format (not the job id).
        source_image_id:
          type: string
          format: uuid
          title: Source Image Id
          description: Id of the source image this result derives from.
        format_type:
          type: string
          enum:
            - upscale
            - background_removal
          title: Format Type
          description: The derived-format kind.
        mime_type:
          type: string
          title: Mime Type
          description: MIME type of the produced file.
          examples:
            - image/png
        url:
          type: string
          title: Url
          description: Presigned, time-limited (24h) HTTPS URL of the produced file.
          examples:
            - https://cdn.samsa.ai/user-.../abc.png?X-Amz-Signature=...
        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.
        resolution_class:
          anyOf:
            - type: string
            - type: 'null'
          title: Resolution Class
          description: Resolution class of the produced file (e.g. `2K`), when known.
          examples:
            - 2K
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Model that produced the format (upscale only; null otherwise).
          examples:
            - crystal
      type: object
      required:
        - id
        - source_image_id
        - format_type
        - mime_type
        - url
      title: PublicImageFormatResult
      description: |-
        A raster derived-format result (upscale / background removal).

        `id` is the `image_formats` ROW id (stable result identity — NOT the job
        id); `source_image_id` is the image the format derives from.
    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_...`.

````