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

# Try On (Beta)

> **BETA** - This endpoint is currently in beta and may change without notice.<br/><br/>
Places a garment onto a person image.<br/><br/>
**For Best Results:**
  - Person Image:
      - There should only be one person in the image.
      - Plain backgrounds and no accessories are best
      - The person should take up most of the frame, a 3/4 body view works best.
      - The person should be standing facing forward, side/seated views work less well.
  - Garment Image:
      - The garment image should only contain a single garment.
      - Plain "stock photos" of garments work best, however the model is capable of transferring garments from one person to another.
      - The garment should take up most of the frame.
      - **Note:** If the garment image contains a person wearing the garment or other objects, garment extraction will be required, which costs an additional 5 credits.

**Limitations:**
  - The API may not work with all garments, it works best with top garments like t-shirts, blouses, etc.
  - Text and fine details in the garment image may not be reproduced perfectly in the resulting image.
  - Colors in the resulting image may be slightly different to the colors in the garment image.

**Input Image Limits:**
  - Max size: 25MB
  - Min resolution: 64x64px
  - Max resolution: 6000x6000px




## OpenAPI

````yaml POST /v1/try-on
openapi: 3.1.0
info:
  description: >-
    The Pixelcut API specification, learn more about the API at at
    https://www.pixelcut.ai/docs
  version: 0.0.2
  title: Pixelcut API
  termsOfService: >-
    https://pixelcut.notion.site/Pixelcut-API-Terms-of-Service-11b3b550490080d89a91e943d010efdf
  contact:
    name: API Support
    email: api@pixelcut.ai
servers:
  - url: https://api.developer.pixelcut.ai
    description: Pixelcut API server
security: []
paths:
  /v1/try-on:
    post:
      tags:
        - Endpoints
      summary: Try On (Beta)
      description: >
        **BETA** - This endpoint is currently in beta and may change without
        notice.<br/><br/>

        Places a garment onto a person image.<br/><br/>

        **For Best Results:**
          - Person Image:
              - There should only be one person in the image.
              - Plain backgrounds and no accessories are best
              - The person should take up most of the frame, a 3/4 body view works best.
              - The person should be standing facing forward, side/seated views work less well.
          - Garment Image:
              - The garment image should only contain a single garment.
              - Plain "stock photos" of garments work best, however the model is capable of transferring garments from one person to another.
              - The garment should take up most of the frame.
              - **Note:** If the garment image contains a person wearing the garment or other objects, garment extraction will be required, which costs an additional 5 credits.

        **Limitations:**
          - The API may not work with all garments, it works best with top garments like t-shirts, blouses, etc.
          - Text and fine details in the garment image may not be reproduced perfectly in the resulting image.
          - Colors in the resulting image may be slightly different to the colors in the garment image.

        **Input Image Limits:**
          - Max size: 25MB
          - Min resolution: 64x64px
          - Max resolution: 6000x6000px
      operationId: try-on
      parameters:
        - in: header
          name: Accept
          required: false
          schema:
            type: string
          description: Acceptable response media type(s). `application/json`.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - image
              properties:
                person_image_url:
                  $ref: '#/components/schemas/TryOnPersonURLParameter'
                garment_image_url:
                  $ref: '#/components/schemas/TryOnGarmentURLParameter'
                garment_mode:
                  $ref: '#/components/schemas/GarmentModeParameter'
                  deprecated: true
                preprocess_garment:
                  $ref: '#/components/schemas/PreprocessGarmentParameter'
                remove_background:
                  $ref: '#/components/schemas/RemoveBackgroundParameter'
                wait_for_result:
                  $ref: '#/components/schemas/WaitForResultParameter'
          multipart/form-data:
            schema:
              type: object
              properties:
                person_image_url:
                  $ref: '#/components/schemas/TryOnPersonURLParameter'
                person_image:
                  $ref: '#/components/schemas/BinaryImageParameter'
                garment_image_url:
                  $ref: '#/components/schemas/TryOnGarmentURLParameter'
                garment_image:
                  $ref: '#/components/schemas/BinaryImageParameter'
                garment_mode:
                  $ref: '#/components/schemas/GarmentModeParameter'
                  deprecated: true
                preprocess_garment:
                  $ref: '#/components/schemas/PreprocessGarmentParameter'
                remove_background:
                  $ref: '#/components/schemas/RemoveBackgroundParameter'
                wait_for_result:
                  $ref: '#/components/schemas/WaitForResultParameter'
      responses:
        '200':
          description: >-
            Success - returned when wait_for_result is true and processing
            completes successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JpegImageJSONResponse'
        '202':
          description: >-
            Accepted - returned when wait_for_result is false, indicates that
            processing has started.
          content:
            application/json:
              schema:
                type: object
                properties:
                  job_id:
                    type: string
                    description: >-
                      A unique identifier for this job that can be used to check
                      status.
                    example: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
          headers:
            Location:
              description: Endpoint to poll for job status
              schema:
                type: string
                example: /v1/try-on/job/6ba7b810-9dad-11d1-80b4-00c04fd430c8
        '400':
          $ref: '#/components/responses/Error400'
        '401':
          $ref: '#/components/responses/Error401'
        '403':
          $ref: '#/components/responses/Error403'
        '429':
          $ref: '#/components/responses/Error429'
        '500':
          $ref: '#/components/responses/Error500'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TryOnPersonURLParameter:
      type: string
      format: url
      description: URL of the person's image.
      example: https://cdn3.pixelcut.app/virtual-try-on/person.png
    TryOnGarmentURLParameter:
      type: string
      format: url
      description: URL of the garment image.
      example: https://cdn3.pixelcut.app/virtual-try-on/garment.png
    GarmentModeParameter:
      type: string
      enum:
        - auto
        - full
        - upper
        - lower
      default: auto
      deprecated: true
      description: >
        > **⚠️ DEPRECATED**: This parameter is deprecated and will be removed in
        a future version.

        >

        > The API now automatically detects garment type without requiring
        manual specification.


        Indicates the garment type for the try-on service. Determines how the
        garment is applied on the person image.<br> - auto: Automatically
        detects if the garment is full-body, upper-body, or lower-body.<br> -
        full: Garment covers the full body (e.g., dresses, jumpsuits).<br> -
        upper: Garment covers the upper body (e.g., shirts, jackets).<br> -
        lower: Garment covers the lower body (e.g., pants, skirts).
    PreprocessGarmentParameter:
      type: string
      enum:
        - 'true'
        - 'false'
      default: 'true'
      description: >-
        When true, the garment will be preprocessed to remove background.
        Defaults to true. In some cases results of model will be improved by
        skipping pre-processing.
    RemoveBackgroundParameter:
      type: string
      description: >-
        When true, the background will be removed from the final result.
        Defaults to false.
      enum:
        - 'true'
        - 'false'
      default: 'false'
    WaitForResultParameter:
      type: string
      description: >-
        When true, the API will wait for processing to complete and return the
        result directly. When false, it returns a job ID for polling.
      default: 'true'
      enum:
        - 'true'
        - 'false'
    BinaryImageParameter:
      type: string
      format: binary
      description: >-
        Binary file of the image to be processed, this is mutually exclusive
        with image_url, if both are provided the image will be used.
    JpegImageJSONResponse:
      type: object
      properties:
        result_url:
          type: string
          description: >-
            A URL to access the resultant image which is valid for 1 hour. File
            format will be jpeg.
          example: >-
            https://assets.pixelcut.app/public/result/a16646be-91c8-4e3a-b359.jpg
  responses:
    Error400:
      description: >-
        The input could not be processed, often returned when the input image
        exceeds API limits.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                description: A description of the error.
                example: File size too large
              error_code:
                type: string
                enum:
                  - invalid_request_body
                  - missing_parameter
                  - invalid_parameter
                  - unsupported_content_type
                  - malformed_image
                  - unsupported_image_format
                  - file_size_too_large
                  - resolution_too_high
                  - unknown_foreground
                example: file_size_too_large
                description: >
                  The error codes provide a way to programmatically handle
                  errors.  


                  The following error codes are currently in use:  

                  - `invalid_request_body`: The request body was empty or
                  invalid.

                  - `missing_parameter`: A required parameter was not provided.

                  - `invalid_parameter`: A parameter was provided but it was
                  invalid.

                  - `unsupported_content_type`: The content type of the request
                  was not application/json or multipart/form-data.

                  - `malformed_image`: The image could not be decoded.

                  - `unsupported_image_format`: The image format is not
                  supported.

                  - `file_size_too_large`: The image file size is too large.

                  - `resolution_too_high`: The image resolution is too high.

                  - `unknown_foreground`: The foreground subject of the image
                  could not be detected.
    Error401:
      description: The authentication token is missing or invalid.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: API Token not found
              error_code:
                type: string
                enum:
                  - invalid_auth_token
    Error403:
      description: >-
        Returned when you have insufficient credits to perform the requested
        action.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Insufficient credits available
              error_code:
                type: string
                enum:
                  - insufficient_api_credits
    Error429:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Too many requests
              error_code:
                type: string
                enum:
                  - rate_limit_exceeded
    Error500:
      description: Internal service error
  securitySchemes:
    ApiKeyAuth:
      description: >
        All API requests require a valid api key. Include your token as a HTTP
        request header in the following format: `X-API-Key: skXXXXXXXXXXXXXXXX`.
        You can obtain an api key by signing up for developer access in your
        Pixelcut account.
      type: apiKey
      name: X-API-KEY
      in: header

````