Picsart Remove Background API

The Remove Background API from Picsart — 2 operation(s) for remove background.

OpenAPI Specification

picsart-remove-background-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  version: '1.0'
  title: Picsart GenAI Ads Remove Background API
  description: '[Official technical documentation portal](https://docs.picsart.io/)

    [Developer Guidelines](https://picsart.io/terms)

    '
servers:
- url: https://genai-api.picsart.io/v1
  description: Production
security:
- apiKey: []
tags:
- name: Remove Background
paths:
  /removebg:
    post:
      summary: Remove & Change Background
      operationId: image-remove-background
      description: "Discover the magic of seamless background removal with our removebg service, powered by cutting-edge AI technology. Our sophisticated algorithm effortlessly identifies and isolates the foreground,  ensuring every detail from the delicate intricacies of jewelry to the finest strands of hair is captured with unparalleled precision.  Designed to excel across a vast array of use cases, our service guarantees immaculate cutouts,  whether for professional product photos, dynamic campaign graphics, or personal images meant for creative exploration.  Experience flawless edges and exceptional detail preservation every time, elevating your images beyond the ordinary. \n"
      tags:
      - Remove Background
      requestBody:
        content:
          multipart/form-data:
            schema:
              allOf:
              - $ref: '#/components/schemas/ImageParameters'
              - $ref: '#/components/schemas/RemoveBackgroundParameters'
      responses:
        '200':
          $ref: '#/components/responses/200'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '402':
          $ref: '#/components/responses/402'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '405':
          $ref: '#/components/responses/405'
        '413':
          $ref: '#/components/responses/413'
        '415':
          $ref: '#/components/responses/415'
        '422':
          $ref: '#/components/responses/422'
        '429':
          $ref: '#/components/responses/429'
        '431':
          $ref: '#/components/responses/431'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
  /remove-background:
    post:
      summary: Remove & Change Background from Videos
      operationId: video-remove-background
      description: 'Remove Background from videos, or replace with custom backdrops.

        '
      tags:
      - Remove Background
      requestBody:
        content:
          multipart/form-data:
            schema:
              allOf:
              - $ref: '#/components/schemas/VideoParameters'
              - $ref: '#/components/schemas/RemoveBackgroundParameters_2'
      responses:
        '202':
          $ref: '#/components/responses/202'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '405':
          $ref: '#/components/responses/405'
        '413':
          $ref: '#/components/responses/413'
        '415':
          $ref: '#/components/responses/415'
        '429':
          $ref: '#/components/responses/429'
        '431':
          $ref: '#/components/responses/431'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
components:
  schemas:
    RemoveBackgroundParameters_2:
      type: object
      properties:
        bg_color:
          type: string
          nullable: true
          description: 'Can be a hexcolor code (e.g., #82d5fa, #fff) or a color name (e.g., blue). For full transparency, use ''transparent'' or ''#00000000''. In this case, the export format .webm will be enforced and applied. For semi-transparency, 4-/8-digit hexcodes are also supported (e.g., #18d4ff87 or #00000066). The default is greenscreen''s ''#008800''. Use either bg_color or bg_image_url.

            '
          default: '#008800'
        bg_image_url:
          type: string
          nullable: true
          description: 'The background image URL. Use either bg_color or bg_image_url. When not provided the default value of the bg_color=#008800 will be applied to the background.

            '
          maxLength: 2083
          minLength: 1
          format: uri
    Error:
      type: object
      properties:
        message:
          type: string
        detail:
          type: string
      required:
      - detail
    VideoParameters:
      type: object
      properties:
        video_url:
          type: string
          description: Source video URL.
          maxLength: 2083
          minLength: 1
          format: uri
    ImageParameters:
      type: object
      properties:
        image:
          description: Source image file (binary). (If this parameter is present, the other image source parameters must be empty.)
          type: string
          format: binary
        image_url:
          type: string
          description: Source image URL. (If this parameter is present, the other image source parameters must be empty.)
          maxLength: 2083
          minLength: 1
          format: uri
        image_id:
          type: string
          deprecated: true
          description: Deprecated. Source image ID of an image previously uploaded to Picsart or result image ID from a different API. (If this parameter is present, the other image source parameters must be empty.)
    401_Error:
      type: object
      properties:
        code:
          type: integer
          example: 401
        message:
          type: string
          example: Unauthorized
        detail:
          type: string
      required:
      - detail
    RemoveBackgroundParameters:
      type: object
      properties:
        output_type:
          type: string
          default: cutout
          enum:
          - mask
          - cutout
          description: 'Select one of the two output options. If you submit a photo of a person, **cutout** returns the person as a sticker while **mask** returns a mask photo of the person.

            '
        bg_image:
          description: Source image file (binary). (If this parameter is present, the other image source parameters must be empty.) This only has an effect when output=cutout.
          type: string
          format: binary
          nullable: true
        bg_image_url:
          type: string
          nullable: true
          description: Source image URL. (If this parameter is present, the other image source parameters must be empty.) If this has a value, the output value is dismissed.
          maxLength: 2083
          minLength: 1
          format: uri
        bg_image_id:
          type: string
          nullable: true
          deprecated: true
          description: Deprecated. Source image ID of an image previously uploaded to Picsart or result image ID from a different API. (If this parameter is present, the other image source parameters must be empty.) See /upload method. If this has a value, the output value is dismissed.
        bg_color:
          type: string
          nullable: true
          description: 'Can be a hexcolor code (e.g., #82d5fa, #fff) or a color name (e.g., blue). For semi-transparency, 4-/8-digit hexcodes are also supported (e.g., #18d4ff87). (If this parameter is present, the other bg_ parameters must be empty).

            '
        bg_blur:
          type: integer
          default: 0
          minimum: 0
          maximum: 100
          description: Enter an integer value from 0 to +100.
        bg_width:
          type: integer
          description: 'Size, in pixels, for the width. If left blank, the background is left at its original width.

            '
        bg_height:
          type: integer
          description: 'Size, in pixels, for the height. If left blank, the background is left at its original height.

            '
        scale:
          type: string
          enum:
          - fit
          - fill
          default: fit
          description: 'Fit is where the longer side (width/height) fits the background. Fill is where the shorter side fits the background. Fit is the default.

            '
        auto_center:
          type: boolean
          default: false
          description: "Automatically center the object. Works only, when output_type=cutout.\n  We don't recommend using this flag when the object is visible only partially (e.g. half-cup or half-shoe is in the image).\n"
        stroke_size:
          type: integer
          nullable: true
          default: 0
          minimum: 0
          maximum: 100
          description: 'Add a solid stroke (border) around the cutout result. Works when output_type=cutout. Set 0 to remove. Takes values from 0 to 100.

            '
        stroke_color:
          type: string
          nullable: true
          default: FFFFFF
          description: "Define the color of the stroke. \n  Can be a hexcolor code (e.g., #82d5fa, #fff; with or without #) or a color name (e.g., blue; in English).\n  For semi-transparency, 4-/8-digit hexcodes are also supported (e.g., #18d4ff87).\n  Gets applied if the stroke_size is 1 and above.\n"
        stroke_opacity:
          type: integer
          nullable: true
          default: 100
          minimum: 0
          maximum: 100
          description: "Define the opacity of the stroke added to the cutout result. Works when output_type=cutout and stroke_size is 1 and above.\n  Takes values from 0 to 100. Default is 100 (opaque). Set to 0 to make it transparent.\n"
        shadow:
          type: string
          enum:
          - disabled
          - custom
          - bottom-right
          - bottom
          - bottom-left
          - left
          - right
          - top-left
          - top
          - top-right
          default: disabled
          description: 'A universal parameter to configure the shadow. The default value is "disabled" and it will make sure that the shadow is not rendered. The "custom" value allows to define custom position for the shadow, when this value is chosen, the shadow_offset_x and the shadow_offset_y will get applied. Other values are shadow directions with preset shadow setup (10px).

            '
        shadow_opacity:
          type: integer
          default: 20
          nullable: true
          minimum: 0
          maximum: 100
          description: Shadow Opacity. Works when shadow is enabled (a non-disabled value).
        shadow_blur:
          type: integer
          default: 50
          nullable: true
          minimum: 0
          maximum: 100
          description: Shadow Blur. Works when shadow is enabled.
        shadow_offset_x:
          type: integer
          nullable: true
          minimum: -100
          maximum: 100
          description: Shadow Offset X. This is mandatory to specify when shadow=custom.
        shadow_offset_y:
          type: integer
          nullable: true
          minimum: -100
          maximum: 100
          description: Shadow Offset Y. This is mandatory to specify when shadow=custom.
        model:
          type: string
          enum:
          - urn:air:picsart:model:picsart:sod@8.2
          - urn:air:picsart:model:picsart:sod@10
          - urn:air:picsart:model:picsart:sod@10.1
          - urn:air:picsart:model:picsart:sod@11
          default: urn:air:picsart:model:picsart:sod@10
          nullable: true
          description: 'Optionally choose a specific AI model to use for this request.

            If not specified, a default model will be applied. Please note that the default model may change over time as Picsart continues to improve performance and accuracy. Any change to the default will be made only after thorough testing and validation to ensure it delivers better results.

            If you require consistent behavior or wish to evaluate different models on your own, we recommend explicitly setting this parameter.

            '
        format:
          type: string
          enum:
          - JPG
          - PNG
          - WEBP
          default: PNG
          description: "Optionally select one of the image formats (PNG is chosen if left blank). Options are as follows:\n  * JPG\n  * PNG\n  * WEBP\n"
  responses:
    '400':
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '402':
      description: Payment Required
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '401':
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/401_Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '429':
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '422':
      description: Unprocessable Entity
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '431':
      description: Request Header Fields Too Large
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '413':
      description: Request Entity Too Large
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '200':
      description: Success.
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: object
                properties:
                  id:
                    type: string
                    nullable: true
                  url:
                    type: string
                    format: uri
                    nullable: false
              status:
                type: string
                nullable: false
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '202':
      description: Request successfully accepted for an asynchronous transformation.
      content:
        application/json:
          schema:
            type: object
            properties:
              transaction_id:
                type: string
                nullable: true
              status:
                type: string
                enum:
                - success
                - error
                - processing
                - queued
                nullable: false
          example:
            value:
              transaction_id: 931aed0a-5efd-4b62-9712-069b7147eec5
              status: processing
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '403':
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '405':
      description: Method Not Allowed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '503':
      description: Service Unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '404':
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
    '415':
      description: Unsupported Media Type
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      headers:
        X-Picsart-Correlation-Id:
          schema:
            type: string
          description: The id which will help for troubleshooting request chain in the system.
        X-Picsart-Ratelimit-Available:
          schema:
            type: integer
          description: The number of available calls within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Limit:
          schema:
            type: integer
          description: The total number of requests that can be done within the timeframe. See the X-Picsart-Ratelimit-Reset-Time.
        X-Picsart-Ratelimit-Reset-Time:
          schema:
            type: integer
          description: The time when the used request count resets and the number of available calls gets equal to the total number.
        X-Picsart-Credit-Available:
          schema:
            type: integer
          description: The remaining number of the credits on the balance.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-Picsart-API-Key