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

# Costume Background Removal API

> Costume Background Removal API removes clothing backgrounds and isolates garments for apparel photos, e-commerce listings, and product displays.

<Tip>
  All result URLs are temporarily available and will expire after 24 hours.
</Tip>


## OpenAPI

````yaml POST /api/cutout/general/apparel-background-removal
openapi: 3.0.0
info:
  title: AILabAPI
  description: >-
    [<b>AILabTools</b>](https://www.ailabtools.com) is an advanced tool that
    offers a vast array of simple and flexible API endpoints to suit your
    specific needs. With just one [<b>API
    KEY</b>](https://www.ailabtools.com/doc/get-api-key), you can easily call
    any of the endpoints and integrate them quickly into your application or
    workflow, allowing for smooth and efficient operations. 
     
    [<b>AILabTools</b>](https://www.ailabtools.com) is continuously evolving,
    and you can anticipate even more API endpoints being added in the future,
    further enhancing its capabilities and usefulness for your artificial
    intelligence and machine learning requirements.
  version: 1.0.0
servers:
  - url: https://www.ailabapi.com
    description: Production server
security:
  - apiKeyAuth: []
tags:
  - name: AI IMAGE
  - name: AI IMAGE > Image Enhancement
  - name: AI IMAGE > Image Effects
  - name: AI IMAGE > Image Editing
  - name: AI IMAGE > Image Scoring
  - name: AI BACKGROUND REMOVAL
  - name: AI BACKGROUND REMOVAL > Portrait
  - name: AI BACKGROUND REMOVAL > General
  - name: AI PORTRAIT
  - name: AI PORTRAIT > Portrait Effects
  - name: AI PORTRAIT > Portrait Enhance
  - name: AI PORTRAIT > Portrait Editing
  - name: AI PORTRAIT > Portrait Analysis
  - name: AI COMMON
paths:
  /api/cutout/general/apparel-background-removal:
    post:
      tags:
        - AI BACKGROUND REMOVAL > General
      summary: Costume Background Removal
      description: >-
        Costume Background Removal API removes clothing backgrounds and isolates
        garments for apparel photos, e-commerce listings, and product displays.
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - image
              properties:
                image:
                  type: string
                  format: binary
                  description: >-
                    - Image format: `JPEG` `JPG` `BMP` `PNG`. 

                    - Image size: No more than 5 MB. 

                    - Image resolution: Larger than 50x50px and smaller than
                    3000x3000px.
                out_mode:
                  type: integer
                  enum:
                    - 0
                    - 1
                  default: 0
                  description: >-
                    Specifies the type of segmentation result to return, which
                    affects the content of the `image_url` field. 

                    - `0`: Default segmentation result of the main clothing. 

                    - `1`: Combined segmentation result based on the category
                    specified by `cloth_class`.
                cloth_class:
                  type: string
                  example: tops,coat,skirt,pants,bag,shoes,hat
                  description: >-
                    Clothing categories. Multiple values can be submitted at
                    once, separated by commas (,). 

                    - `tops`: Tops. 

                    - `coat`: Coat. 

                    - `skirt`: Skirt. 

                    - `pants`: Pants. 

                    - `bag`: Bag. 

                    - `shoes`: Shoes. 

                    - `hat`: Hat.
                return_form:
                  type: string
                  enum:
                    - mask
                    - whiteBK
                  description: >-
                    Specify the desired image format for the output. 

                    - `whiteBK`: Returns an image with a white background. 

                    - `mask`: Returns a single-channel mask. 

                    - If not specified, a four-channel PNG image will be
                    returned.
      responses:
        '200':
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/PublicResponseFields'
                  - type: object
                    properties:
                      data:
                        type: object
                        description: The content of the result data returned.
                        properties:
                          elements:
                            type: array
                            description: Returns an array of elements.
                            items:
                              oneOf:
                                - type: object
                                  properties:
                                    image_url:
                                      type: string
                                      description: Result image URL.
                                - type: object
                                  properties:
                                    class_url:
                                      type: object
                                      description: >-
                                        Return the URL corresponding to the
                                        clothing category based on the input
                                        `cloth_class`.
                                      properties:
                                        tops:
                                          type: string
                                          description: Tops URL.
                                        coat:
                                          type: string
                                          description: Coat URL.
                                        skirt:
                                          type: string
                                          description: Skirt URL.
                                        pants:
                                          type: string
                                          description: Pants URL.
                                        bag:
                                          type: string
                                          description: Bag URL.
                                        shoes:
                                          type: string
                                          description: Shoes URL.
                                        hat:
                                          type: string
                                          description: Hat URL.
              example:
                request_id: ''
                log_id: ''
                error_detail:
                  code: ''
                  code_message: ''
                  message: ''
                data:
                  elements:
                    - image_url: ''
                    - class_url:
                        tops: ''
                        coat: ''
                        skirt: ''
                        pants: ''
                        bag: ''
                        shoes: ''
                        hat: ''
          description: Success
components:
  schemas:
    PublicResponseFields:
      type: object
      required:
        - request_id
        - log_id
        - error_detail
      properties:
        request_id:
          type: string
          description: Request ID for debugging.
        log_id:
          type: string
          description: Log ID for debugging.
        error_detail:
          $ref: '#/components/schemas/ErrorDetail'
    ErrorDetail:
      type: object
      required:
        - code
        - code_message
        - message
      properties:
        code:
          type: string
          description: >-
            Error Code. See [Error
            Codes](/docs/response-description#error-codes).
        code_message:
          type: string
          description: Error summary.
        message:
          type: string
          description: Detailed error message.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: ailabapi-api-key
      description: API Key for authentication

````