openapi: 3.0.0
info:
  title: YouCam API
  version: v1.9
  termsOfService: https://www.makeupar.com/perfectbeauty/youcam/terms-of-service-api
  contact:
    email: YouCamOnlineEditor_API@perfectcorp.com
  license:
    name: Privacy policy
    url: https://www.makeupar.com/youcamapps/youcam/privacy-policy.html
  x-logo:
    url: >-
      https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/API_header_ef809971e3.svg
    altText: YouCam API
    href: https://yce.makeupar.com/ai-api/
  description: "# API Document\nLast modified: Feb. 4, 2026 af99e44\n\nThe YouCam APIs are series of AI effects that let you beautify your photos, as well as generate amazing aesthetic creations beyond human imagination. Let the magic begin.\n\nPLEASE NOTE that by reading this API documentation, or by setting up code pursuant to the instructions in this API documentation, you acknowledge it adheres to Perfect Corp's [Privacy policy](https://www.makeupar.com/youcamapps/youcam/privacy-policy.html), and [Terms of Service](https://www.makeupar.com/perfectbeauty/youcam/terms-of-service-api). And If you have any issue, please contact: [YouCamOnlineEditor_API@perfectcorp.com](mailto:YouCamOnlineEditor_API@perfectcorp.com)\n\n\n![YouCam API](https://bcw-media.s3.ap-northeast-1.amazonaws.com/strapi/assets/YCO_AI_API.png \"YouCam API\")\n\n## Introduction\n[YouCam API](https://yce.makeupar.com/) is a powerful and easy-to-use AI platform that provides beautiful and true-to-life visual effects thanks to the latest AI technology. This API document will briefly introduce how to integrate these awesome AI effects into your business. YouCam API are standard RESTful APIs to let you easily integrate to your website, e-commerce platforms, iOS/Android APP, applets, mini-programs, and more.\n\n![YouCam API](https://d3anovxlgi5hpq.cloudfront.net/assets/images/aiApi/banner/yce-topbanner-dt.png \"YouCam API\")\n\n## API Server\nThe YouCam APIs are built on top of RESTful web APIs. The API server is the host of all APIs. Once you complete the authentication, you can start your AI tasks through the API Server.\n- ### YouCam API server:\n    https://yce-api-01.makeupar.com\n\n## Rate Limit\nTo ensure fair usage and prevent abuse, our API implements rate limiting. There are two types of rate limits:\n\n- ### Per IP Address\n    Each IP address is allowed a maximum of 250 requests per 300 seconds with 5 queries per second(QPS). If this limit is exceeded, subsequent requests will receive a `429 Too Many Requests` error.\n\n- ### Per Access Token\n    Each access token is allowed a maximum of 250 requests per 300 seconds with 5 queries per second(QPS). If this limit is exceeded, subsequent requests will receive a `429 Too Many Requests` error.\n\nBoth conditions must be met for a request to be accepted. If either condition is not met, the request will receive a `429 Too Many Requests` error. Please note that each query related to unit will be processed real-time. Other APIs can use the access token util expired.\n\nIt is recommended that you handle rate limit errors gracefully in your application by implementing the appropriate backoff and retry mechanisms.\n\n\n## File Retention Period\n\nAny files you upload are stored on our server for **24 hours**, and then they're automatically deleted.\nProcessed results are retained for **24 hours** after completion.\n\n> **Warning:** Even though those result files are still good for 7 days, the link to download them might only be active for about two hours after they're created. If that download link expires, you can still access the file using its file ID – you can use that ID with another feature to get it.\n\n\n## Supported Formats & Dimensions\n|AI Photo Editing|Supported Dimensions|Supported File Size|Supported Formats|\n|  ----  | ----  | ----  | ----  |\n|AI Photo Enhance|Input: long side <= 4096, Output: long side <= 4096|< 10MB|jpg/jpeg/png|\n|AI Photo Colorize|Input: long side <= 4096, Output: long side <= 4096|< 10MB|jpg/jpeg/png|\n|AI Photo Color Correction|Input: long side <= 4096, Output: long side <= 4096|< 10MB|jpg/jpeg/png|\n|AI Photo Lighting|4096x4096 (long side <= 4096, short side >= 256)|< 10MB|jpg/jpeg/png|\n|AI Image Extender|Input: long side <= 4096, Output: short side <= 1024, long side <= 2048|< 10MB|jpg/jpeg/png|\n|AI Replace|Input: long side <= 4096, Output: short side <= 1024, long side <= 2048|< 10MB|jpg/jpeg/png|\n|AI Object Removal|Input: long side <= 4096, Output: long side <= 4096|< 10MB|jpg/jpeg/png|\n|AI Image Generator|Input: long side <= 4096, Output: long side <= 1024|< 10MB|jpg/jpeg/png|\n|Al Photo Background Removal|Input: long side <= 4096, Output: long side <= 4096|< 10MB|jpg/jpeg/png|\n|AI Photo Background Blur|Input: long side <= 4096, Output: long side <= 4096|< 10MB|jpg/jpeg/png|\n|AI Photo Background Change|Input: long side <= 4096, Output: long side <= 4096|< 10MB|jpg/jpeg/png|\n\n|AI Portrait|Supported Dimensions|Supported File Size|Supported Formats|\n|  ----  | ----  | ----  | ----  |\n|AI Avatar Generator|Input: long side <= 4096, Output: long side <= 1024|< 10MB|jpg/jpeg/png|\n|AI Face Swap|4096x4096 (long side <= 4096), single face only, need to show full face|< 10MB|jpg/jpeg/png|\n\n|AI Video Editing|Supported Dimensions|Supported File Size|Supported Formats|\n|  ----  | ----  | ----  | ----  |\n|AI Video Enhance|input: long side <= 1920; output: max 2x input resolution, up to 60 sec, 30 FPS, 8 bit|<100MB|container: mov, mp4; video codec: MPEG-4, H.264 AVC; audio codec: aac, mp3;|\n|AI Video Face Swap|input: long side <= 4096; output: 1280x720, 30 FPS, up to 30 sec, 8 bit, single face only|<100MB|container: mov, mp4; video codec: MPEG-4, H.264 AVC; audio codec: aac, mp3|\n|AI Video Style Transfer|input: long side <= 4096; output: long side <= 1280, 16 FPS, up to 30 sec, 8 bit|<100MB|container: mov, mp4; video codec: MPEG-4, H.264 AVC; audio codec: aac, mp3|\n\n## Error Codes\n- Successful responses (100 - 399)\n- Client error responses (400 - 499)\n- Server error response (500 - 599)\n\n| General Error Code | Description |\n| ------------------ | ----------- |\n| exceed_max_filesize | The input file size exceeds the maximum limit |\n| invalid_parameter | The parameter value is invalid |\n| error_download_image | There was an error downloading the source image |\n| error_download_mask | There was an error downloading the mask image |\n| error_decode_image | There was an error decoding the source image |\n| error_decode_mask | There was an error decoding the mask image |\n| error_download_video | There was an error downloading the source video |\n| error_decode_video | There was an error decoding the source video |\n| error_nsfw_content_detected | NSFW content was detected in the source image |\n| error_no_face | No face was detected in the source image |\n| error_pose | Failed to detect pose in the source image |\n| error_face_parsing | Failed to perform face parsing on the source image |\n| error_inference | An error occurred in the inference pipeline |\n| exceed_nsfw_retry_limits | Retry limits exceeded to avoid generating NSFW image |\n| error_upload | There was an error uploading the result image |\n| error_multiple_people | Multiple people were detected in the source image |\n| error_no_shoulder | Shoulders are not visible in the source image |\n| error_large_face_angle | The face angle in the uploaded image is too large |\n| error_hair_too_short | The input hair is too short |\n| error_unexpected_video_duration | The video duration does not match the expected duration |\n| error_bald_image | The input hairstyle is bald |\n| error_unsupport_ratio | The aspect ratio of the input image is unsupported |\n| unknown_internal_error | Other internal errors |\n\n---\n\n# Quick Start Guide\nFirst, you need to register a YouCam API account for free at [https://yce.makeupar.com/](https://yce.makeupar.com/). You can then purchase or subscribe to get your units to use the service. You can see your subscription plan, pay as you go units, and your usage record at [https://yce.makeupar.com/api-console/en/api-keys/](https://yce.makeupar.com/api-console/en/api-keys/). You can go to the API Key tab under your account page to generate and maintain your API keys to start using the YouCam API.\n\n\n## V2 API\n\n### **Overview**\nStarting from **API version v1.5**, we have introduced a **simplified V2 API** to streamline integration processes.\n\n**Scope:**\nStarting from **API version v1.7**, all YouCam APIs are supported V2 API.\n\n> **Note:** V2 API is designed for workflow simplification only. It does not introduce advanced functionality. Both V1 APIs and V2 APIs use the same underlying AI models.\n\nV1 API legacy API document: [https://yce.makeupar.com/document/v1.x/index.html](https://yce.makeupar.com/document/v1.x/index.html)\n\n---\n\n### **Key Changes in V2 API**\n\n#### **1. Endpoint Reduction**\nThere is no need to call a separate authentication API to complete the authentication process.\n  - **V1 API Endpoints:**\n    - `POST /s2s/v1.0/client/auth` – Authentication\n    - `POST /s2s/v1.1/file/ai-task` – Upload a file\n    - `POST /s2s/v1.0/task/ai-task` – Run an AI task\n    - `GET /s2s/v1.0/task/ai-task` – Get the result\n\n  - **V2 API Endpoints:**\n    - `POST /s2s/v2.0/file/ai-task` – Upload a file or provide a file URL\n    - `POST /s2s/v2.0/task/ai-task` – Run an AI task\n    - `GET /s2s/v2.0/task/ai-task` – Get the result\n\n> **Warning:** Ensure that you replace the placeholder **`ai-task`** with the exact AI feature name supported by the API (for example, **`skin-analysis`**, **`cloth`**, **`hair-style`**, **`makeup-vto`**, or **`skin-tone-analysis`**). Using an incorrect or generic placeholder will result in an invalid request or API error. Always refer to the latest API specification for the list of valid feature identifiers.\n\n#### **2. Authentication**\n- **V1 API:** Requires explicit call to Authentication endpoint.- **V2 API:** No separate authentication endpoint.  - Include your API key in the request header using **Bearer Token**:\n    ```\n    Authorization: Bearer YOUR_API_KEY\n    ```\nYou can find your API Key at https://yce.makeupar.com/api-console/en/api-keys/.\n\n#### **3. Image Input**\n- Supports **both file upload and file URL** as input sources.\n\n#### **4. Polling Mechanism**\n- Processed results are retained for **24 hours** after completion.\n- No need for short-interval polling.\n- Flexible polling intervals within the 24-hour window.\n- **Important:** Polling is still required to check task status, as execution time is not guaranteed.\n\n#### **5. JSON Structure Simplification**\n- **List Style API** now uses a simplified JSON parameter structure.\n  - AI Hairstyle Generator: https://yce-api-01.makeupar.com/s2s/v2.0/task/template/hair-style\n  - AI Clothes: https://yce-api-01.makeupar.com/s2s/v2.0/task/template/cloth\n\n---\n\n### **Summary**\n- **V2 API = Simplified workflow, same AI models.**- Reduced endpoints, easier authentication, flexible input options, improved polling, and cleaner JSON.\n\n---\n\n# FAQ\n## Q&A Hub\n1. **Q: What does 'Unit' mean, and how is it used?**\n    </br>**A:** Please note that credits are exclusively used within the YouCam Online Editor UI, whereas units are designated solely for AI API usage. Throughout this document, all references to 'credit' or 'unit' pertain to the Unit.\n    </br>\n    Please check the page https://yce.makeupar.com/ai-api for details on how many units each AI feature consumes.\n    </br></br>\n\n1. **Q: Why am I getting InvalidTaskId error?**\n    </br>**A:** You will get a ***InvalidTaskId*** error once you check the status of a timed out task. So, once you run an AI task, you need to **polling** to check the status within the ***polling_interval*** until the status become either *success* or *error*.\n    </br></br>\n\n1. **Q: What is client_id, client_secret and id_token?**\n    </br>**A:** Your API Key is the ***client_id*** and the Secret key is the ***client_secret***. And please follow the Quick start guide to get the ***id_token*** to complete the authentication process.\n\n    For more information and questions, please refer to our [blog page](https://www.makeupar.com/consumer/blog) and the [FAQ page](https://yce.makeupar.com/faq). Or send an e-mail to [YouCamOnlineEditor_API@perfectcorp.com](mailto:YouCamOnlineEditor_API@perfectcorp.com). Our customer success team are very happy to help. ;)\n    </br></br>\n\n1. **Q: How to uplaod an image through curl?**\n    </br>**A:** curl --location --request PUT '{url_api_response}' --header '{headers_in_api_response}' --data-binary @'{local_file_path}'\n    ```\n    curl --location --request PUT 'https://example.com/sample-result-url' --header 'Content-Type: image/jpg' --header 'Content-Length: 50000' \_--data-binary @'./test.jpg'\n    ```\n    </br></br>\n\n1. **Q: What platforms does the AI API support? Can it be used on mobile devices?**\n    </br>**A:** The AI API works seamlessly across different platforms. Since it's built on a standard RESTful API, you can use it for server-to-server communication, on mobile devices, or in a web browser - whatever best fits your needs.\n    </br></br>\n\n1. **Q: Is it possible to use the AI API with Flutter on both Android and iOS?**\n    </br>**A:**\n        Absolutely. Since AI APIs are standard RESTful APIs, you can access them using Flutter's built-in HTTP APIs to make requests.\n\n    Here are some official Flutter documents on making network queries.\n    * https://docs.flutter.dev/cookbook/networking/fetch-data\n    * https://pub.dev/packages/http\n\n    And here’s a simple way to call a http GET with Bearer Authentication using Flutter’s http package:\n    ```dart\n    import 'dart:convert';\n    import 'package:http/http.dart' as http;\n\n    Future<void> fetchData() async {\n        String token = \"your_bearer_token_here\"; // Replace with your actual token\n\n        final response = await http.get(\n            Uri.parse(\"https://yce-api-01.makeupar.com/s2s/v1.0/task/ai-task\"), // Replace the `ai-task` with the AI feature you intend to use.\n            headers: {\n            \"Content-Type\": \"application/json\",\n            \"Authorization\": \"Bearer $token\",\n            },\n        );\n\n        if (response.statusCode == 200) {\n            print(\"Data fetched successfully: ${response.body}\");\n        } else {\n            print(\"Failed to fetch data: ${response.statusCode}\");\n        }\n    }\n    ```\n    Key Steps to Auth:\n    - Retrieve the Token – You can store and retrieve the token using SharedPreferences or another secure storage method.\n    - Include the Token in Headers – Use \"Authorization\": \"Bearer $token\" in the request headers.\n    - Handle Expired Tokens – If the API returns a 401 InvalidAccessToken error, refresh the token if needed.\n    </br></br>\n\n1. **Q: API key is the API key,  Where can I find the secret key?**\n    </br>**A:** The secret key is created only when you first generate it. So make sure to save it right away, you won't be able to see it again later.\n    </br></br>\n\n1. **Q: Is it possible to integrate AI APIs into your website using Wix?**\n    </br>**A:** We do not currently have an official integration guide for using AI APIs with Wix. However, the RESTful API itself does not impose any restrictions on the platform, provided it supports standard web queries.\n\n    We strongly recommend to begin by reading the official documentation provided by Wix: https://dev.wix.com/docs/develop-websites/articles/get-started/integrate-with-3rd-parties\n\n    Wix offers several methods for integrating with third-party APIs, primarily through its Velo development platform:\n\n    * Fetch API:\n    This is the most common method and an implementation of the standard JavaScript Fetch API. It allows you to make HTTP requests to external APIs from your Wix site's frontend or backend code.\n        Backend calls: Recommended for security (especially for APIs requiring keys) and to avoid CORS issues. Use the Secrets Manager to securely store API keys.\n        Frontend calls: Possible but less secure and may encounter CORS restrictions.\n\n    * npm Packages:\n    Velo supports the use of approved npm packages, allowing you to leverage a wide array of prebuilt JavaScript modules to extend your site's functionality with third-party features.\n\n    * Service Plugins (formerly SPIs/Custom Extensions):\n    These enable you to inject custom logic or integrate third-party services directly into Wix's business solutions (e.g., Wix Stores, Wix Bookings). Service plugins allow you to customize specific parts of existing app flows or integrate external services for functionalities like custom shipping rates, dynamic pricing, or alternative payment providers.\n\n    * HTTP Functions:\n    You can expose your site's functionality as an API, allowing third-party services to call your Wix site''s backend functions and interact with your site's data or logic.\n\n    Steps for Integration (using Fetch API as an example):\n\n    * Store API Keys: If the third-party API requires authentication, store sensitive credentials like API keys securely in Wix's Secrets Manager.\n    Import wix-fetch: In your Velo backend or frontend code, import the wixFetch module.\n\n        ```JavaScript\n        import { fetch } from 'wix-fetch';\n        ```\n\n    * Make API Calls: Use the fetch function to send requests to the third-party API, including necessary headers and body data.\n\n        ```JavaScript\n        export async function getWeatherData() {\n            const apiKey = await getSecret(\"yourApiKeyName\"); // Retrieve from Secrets Manager\n            const response = await fetch(`https://api.weatherapi.com/v1/current.json?key=${apiKey}&q=London`, {\n                method: 'GET',\n                headers: {\n                    'Content-Type': 'application/json'\n                }\n            });\n            const data = await response.json();\n            return data;\n        }\n        ```\n\n    * Handle Responses: Process the data received from the API and integrate it into your site's design or functionality.\n    </br></br>\n\n1. **Q: Is it possible to integrate AI APIs into WooCommerce?**\n    </br>**A:** We do not currently have an official integration guide for using AI APIs with WooCommerce. However, the RESTful API itself does not impose any restrictions on the platform, provided it supports standard web queries.\n\n    We strongly recommend to begin by reading the official documentation provided by WooCommerce: https://woocommerce.com/document/woocommerce-rest-api/\n\n    Integrating third-party APIs with WooCommerce enhances store functionality and streamlines operations. This can be achieved through various methods:\n\n    * Utilizing WooCommerce REST API:\n\n        WooCommerce provides a robust REST API that allows external applications to interact with your store data.\n        You can create API keys with specific permissions (Read, Write, or Read/Write) in WooCommerce > Settings > Advanced > REST API.\n        This enables you to automate tasks like inventory syncing, order processing, customer data synchronization, and more, by building custom integrations or using third-party services that leverage this API.\n\n    * Employing Plugins:\n\n        Many WordPress and WooCommerce plugins are designed specifically for integrating with popular third-party services like payment gateways, shipping carriers, CRM systems, and accounting software.\n        Plugins often offer pre-built integrations, simplifying the setup process and reducing the need for custom coding.\n        Examples include plugins for specific payment processors (e.g., Stripe, PayPal), shipping solutions (e.g., FedEx, USPS), or general API integration tools like WPGet API.\n\n    * Custom Code and Webhooks:\n\n        For unique integration needs or when a suitable plugin isn't available, you can implement custom code within your WordPress theme or a custom plugin.\n        This involves using WordPress/WooCommerce hooks and filters to trigger API calls at specific events (e.g., woocommerce_payment_complete for post-purchase actions).\n        Webhooks can also be used to send real-time data from WooCommerce to a third-party service when certain events occur (e.g., new order, product update).\n    </br></br>\n\n## Debugging Guide\n1. **Invalid TaskId Error**\n    </br>**Why:** You’ll receive an InvalidTaskId error if you attempt to check the status of a task that has timed out. Therefore, once an AI task is initiated, you’ll need to poll for its status within the polling_interval until the status changes to either success or error.\n    </br>**Solution:** To avoid the task becoming invalid, it’s necessary to implement a timed loop that queries the task status at regular intervals within the allowed polling window.\n\n1. **500 Server Error / unknown_internal_error**\n    </br>**A:** ***Important***: Simply calling the File API does not upload your file. You must manually upload the file to the URL provided in the File API response. That URL is your upload destination, make sure the file is successfully transferred there before proceeding.<br>\n    Before calling the AI API, ensure your file has been successfully uploaded. Use the File API to retrieve an upload URL, then upload your file to that location. Once the upload is complete, you'll receive a ***file_id*** in the response, this ID is what you'll use to access AI features related to that file.\n    </br></br>\n\n1. **404 Not Found error when using AI APIs**\n    </br>**A:** ***Important***: Simply calling the File API does not upload your file. You must manually upload the file to the URL provided in the File API response. That URL is your upload destination, make sure the file is successfully transferred there before proceeding.<br>\n    Before calling the AI API, ensure your file has been successfully uploaded. Use the File API to retrieve an upload URL, then upload your file to that location. Once the upload is complete, you'll receive a ***file_id*** in the response, this ID is what you'll use to access AI features related to that file.\n    </br></br>\n\n1. **The API response returns the same style ID on the Postman**\n    </br>**A:** The is because Postman (Pretty view) and Chrome use JavaScript to parse JSON responses. In JavaScript, numbers larger than 9007199254740991 (2^53-1) cannot be represented precisely. They are rounded to the nearest representable value, which makes different IDs appear identical (e.g., 219691778809271815 → 219691778809271800).</br>\n    * Precision Loss in JavaScript/JSON Error Handling\n      * Cause: JavaScript's Number type cannot safely handle integers beyond 2^53 - 1, leading to silent truncation or rounding.\n      * Solution: Use a JSON parser like ***json-bigint*** to treat IDs as strings and retain full precision.\n    </br></br>\n\n1. **Beard Authentication 400 Error**\n    </br>**A:** When using the V2 API, you must include your API key in every request by adding a Bearer authorization header. Failure to do so will result in authentication errors.\n    **Valid Request Header Format**\n    ```\n    Authorization: Bearer YOUR_API_KEY\n    ```\n    **Common Issues**\n\n    1.  **Missing Bearer Prefix**\n        The `Authorization` header must start with `Bearer` followed by the API key.\n        Example:\n        ```\n        Authorization: YOUR_API_KEY\n        ```\n\n    1.  **Unnecessary Characters**\n        Do not include angle brackets `<` or `>` around the API key. These characters are not required and will cause the request to fail.\n        Example:\n        ```\n        Authorization: Bearer <YOUR_API_KEY>\n        ```\n\n    2.  **Incorrect API Key**\n        Ensure that the API key provided in the `Authorization` header is correct and active.\n"
servers:
  - url: https://yce-api-01.makeupar.com
tags:
  - name: Unit system
    description: >-
      Check your unit details and usage history. Please note that credits are
      exclusively used within the YouCam Online Editor UI, whereas units are
      designated solely for AI API usage. Throughout this document, all
      references to 'credit' or 'unit' pertain to the Unit.
paths:
  /s2s/v1.0/client/credit:
    get:
      summary: Get unit info
      tags:
        - Unit system
      security:
        - BearerAuthentication: []
      responses:
        '200':
          description: Successful retrieval of unit info
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    description: Response status
                    example: 200
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: Unique identifier of this unit
                          example: 13105541279084536
                        type:
                          type: string
                          enum:
                            - SubsToken
                            - PaygToken
                          description: Type of this unit
                        amount:
                          type: integer
                          description: Current unit balance
                          example: 10
                        expiry:
                          type: integer
                          description: Unix timestamp of the expiry of this unit (ms)
                          example: 1704789135000
        '401':
          $ref: '#/components/responses/Unauthorized'
  /s2s/v1.0/client/credit/history:
    get:
      summary: View unit history
      tags:
        - Unit system
      security:
        - BearerAuthentication: []
      parameters:
        - name: page_size
          in: query
          schema:
            type: integer
            example: 20
          description: >-
            Number of results to return in a page. Valid value should be between
            1 and 30. Default 20.
        - name: starting_token
          in: query
          schema:
            type: string
            example: 13045969587275114
          description: >-
            Token for current page. Start with `null` for the first page, and
            use `next_token` from the previous response to start next page
      responses:
        '200':
          description: Successful retrieval of the unit usage history
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 200
                    description: Response status
                  result:
                    type: object
                    properties:
                      next_token:
                        type: string
                        example: 13045969587275114
                        description: Token to query next page.
                      history:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 38173479337460984
                              description: Unique identifier of the history
                            timestamp:
                              type: integer
                              example: 1703146067000
                              description: Unix timestamp of the history (ms)
                            action:
                              type: string
                              example: photo_enhance
                              enum:
                                - photo_enhance
                                - api_photo_enhance
                                - object_removal
                                - api_object_removal
                                - background_removal
                                - api_background_removal
                                - colorize
                                - api_colorize
                                - text_to_image
                                - api_text_to_image
                                - hair_style
                                - api_hair_style
                                - blur_background
                                - change_background
                                - wig
                                - trial_gift_text_to_image
                                - sign_up_gift
                                - subscription_credits
                                - subscriber_gift
                                - permanent_credits
                                - compensation_from_customer_service
                                - renew
                                - expire
                              description: Action of this history
                            target_id:
                              type: string
                              example: >-
                                7TWFkuE2Z9uR0NOxSmQ1rh4PJ5Zx7YJ5U9SAz51q0QHVwMP+Jb1XbjPsf7ZgUgLY
                              description: >-
                                Id of the target for this unit. For example,
                                when running AI Photo Enhance task, `target_id`
                                for this history will be `task_id` of the AI
                                Photo Enhance task. When purchasing unit, the
                                `target_id` for this history will be `order_id`
                            info:
                              type: object
                              properties:
                                credits:
                                  type: array
                                  example:
                                    - id: 24409059381740548
                                      amount: -2
                                    - id: 27297116883780870
                                      amount: 0
                                  description: Detailed information for each unit
                                  items:
                                    type: object
                                    properties:
                                      id:
                                        type: integer
                                        description: Id of the unit
                                      amount:
                                        type: integer
                                        description: Total amount changed from this unit
                                dst_actions:
                                  type: array
                                  description: The dst_actions of skin analysis
                                  items:
                                    type: string
                                  example: '[ "hd_wrinkle", "hd_pore", "hd_texture" ]'
        '400':
          $ref: '#/components/responses/InvalidParameters'
        '401':
          $ref: '#/components/responses/InvalidAccessToken'
components:
  responses:
    InvalidParameters:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 400
                description: Response status
              error:
                type: string
                description: Error message
                example: The operation could not be completed
              error_code:
                type: string
                enum:
                  - InvalidParameters
                description: |
                  Error code:
                    * InvalidParameters - Invalid request parameters or body
    InvalidAccessToken:
      description: Invalid access token
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 401
                description: Response status
              error_code:
                type: string
                enum:
                  - InvalidAccessToken
                description: |
                  Error code:
                    * InvalidAccessToken - Access token is not given or not valid
    Unauthorized:
      description: Authentication failed or user does not have necessary permissions
  securitySchemes:
    BearerAuthentication:
      type: http
      scheme: bearer
      description: >-
        Use the `access_token` obtained from authentication and pass it in
        header: `Authorization:Bearer <access_token>`
    BearerAuthenticationV2:
      type: http
      scheme: bearer
      description: >-
        Use the standard 'Bearer authentication'. Put your 'API Key' in header:
        `Authorization:Bearer YOUR_API_KEY`. Notice that there is ' ' a space
        between 'Bearer' and the 'YOUR_API_KEY'.
