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

# Remove Background

> Remove or replace image backgrounds while preserving product edges.



## OpenAPI

````yaml /openapi.yaml post /remove-background
openapi: 3.1.0
info:
  title: AI Gen Studio Image API
  version: 1.0.0
  summary: Image automation API for ecommerce visuals.
  description: >-
    The AI Gen Studio Image API provides focused endpoints for removing
    backgrounds, editing product images, creating AI edits, generating scenes,
    generating images, and producing ad creatives. Sandbox keys validate
    requests and return simulated results; live keys reserve paid credits and
    create asynchronous jobs.
servers:
  - url: https://aigenstudio.app/api/v1
    description: Production
security:
  - bearerApiKey: []
tags:
  - name: Create
    description: Create asynchronous image jobs.
  - name: Jobs
    description: List and inspect asynchronous jobs.
  - name: Catalog
    description: Discover available tools and current public credit costs.
paths:
  /remove-background:
    post:
      tags:
        - Create
      summary: Remove Background
      description: Remove or replace image backgrounds while preserving product edges.
      operationId: removeBackground
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
        - $ref: '#/components/parameters/RequestIdHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RemoveBackgroundRequest'
            example:
              input:
                - image_url: https://client.example/images/shoe-001.jpg
                  external_id: shoe-001
              background:
                type: transparent
              output:
                format: png
      responses:
        '200':
          description: Existing idempotent job returned.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateJobResponse'
        '202':
          description: Job accepted and queued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateJobResponse'
        '400':
          $ref: '#/components/responses/InvalidPayload'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '402':
          $ref: '#/components/responses/InsufficientApiCredits'
        '403':
          $ref: '#/components/responses/ApiAccessNotEnabled'
        '409':
          $ref: '#/components/responses/IdempotencyConflict'
        '429':
          $ref: '#/components/responses/RateLimitExceeded'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 160
        pattern: ^[A-Za-z0-9._:-]+$
      description: Stable key for safely retrying one logical create request.
    RequestIdHeader:
      name: X-Request-Id
      in: header
      required: false
      schema:
        type: string
        maxLength: 160
      description: Optional client correlation id. AI Gen Studio also returns request_id.
  schemas:
    RemoveBackgroundRequest:
      type: object
      required:
        - input
      properties:
        input:
          $ref: '#/components/schemas/InputImages'
        background:
          type: object
          properties:
            type:
              type: string
              enum:
                - transparent
                - white
                - color
              default: transparent
            color:
              type: string
              maxLength: 80
        output:
          $ref: '#/components/schemas/OutputOptions'
        webhook_url:
          type: string
          format: uri
    CreateJobResponse:
      type: object
      required:
        - job
        - remaining_paid_credits
        - request_id
      properties:
        job:
          $ref: '#/components/schemas/JobSummary'
        remaining_paid_credits:
          type: integer
        request_id:
          type: string
    InputImages:
      type: array
      minItems: 1
      maxItems: 20
      items:
        $ref: '#/components/schemas/InputImage'
    OutputOptions:
      type: object
      properties:
        format:
          $ref: '#/components/schemas/Format'
        number_of_images:
          type: integer
          minimum: 1
          maximum: 4
          default: 1
    JobSummary:
      type: object
      required:
        - id
        - api
        - status
        - sandbox
        - total_results
        - credits_reserved
        - created_at
      properties:
        id:
          type: string
          format: uuid
        api:
          $ref: '#/components/schemas/ToolId'
        status:
          $ref: '#/components/schemas/JobStatus'
        sandbox:
          type: boolean
        total_results:
          type: integer
        completed_results:
          type: integer
        failed_results:
          type: integer
        credits_reserved:
          type: integer
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        completed_at:
          type: string
          format: date-time
          nullable: true
    ErrorResponse:
      type: object
      required:
        - error
        - request_id
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: object
        request_id:
          type: string
    InputImage:
      type: object
      required:
        - image_url
      properties:
        image_url:
          type: string
          format: uri
          maxLength: 2048
        external_id:
          type: string
          minLength: 1
          maxLength: 200
    Format:
      type: string
      enum:
        - jpg
        - png
        - webp
      default: png
    ToolId:
      type: string
      enum:
        - remove_background
        - image_editing
        - image_ai_edit
        - ai_background
        - image_generation
        - ad_creative
    JobStatus:
      type: string
      enum:
        - queued
        - processing
        - completed
        - failed
        - cancelled
        - partially_completed
  responses:
    InvalidPayload:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InvalidApiKey:
      description: Invalid or missing API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InsufficientApiCredits:
      description: Not enough paid credits.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ApiAccessNotEnabled:
      description: API access is not enabled or temporarily restricted.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    IdempotencyConflict:
      description: Same idempotency key used with a different request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimitExceeded:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      bearerFormat: AI Gen Studio API key

````