> ## 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.

# Lips Color Changer API

> Lips Color Changer API applies realistic virtual lipstick colors to portraits using facial recognition and precise lip detection.

## Request

* **URL**: `https://www.ailabapi.com/api/portrait/effects/lips-color-changer`
* **Method**: `POST`
* **Content-Type**: `multipart/form-data`

### Image requirements

* **Image format**: `JPEG` `JPG` `PNG` `BMP`
* **Image size**: No more than 5 MB.
* **Image resolution**: Less than 2000x2000px.

### Headers

| Field              | Required | Type     | Description                                           |
| :----------------- | :------- | :------- | :---------------------------------------------------- |
| `ailabapi-api-key` | YES      | `string` | Application API KEY. [Get API KEY](/docs/get-api-key) |

### Body

| Field             | Required | Type          | Description                                                                                                                                           |
| :---------------- | :------- | :------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `image`           | YES      | `file`        |                                                                                                                                                       |
| `lip_color_infos` | YES      | `json string` | Lip Color Info. You can enter up to 3 lip\_color\_info to enable changing the lip color for up to 3 faces in a graph. [Description](#lip_color_infos) |

#### `lip_color_infos`

| Field       | Required | Type      | Scope     | Description                                                                                                                                                                                                                                                                |
| :---------- | :------- | :-------- | :-------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `rgba`      | YES      | `object`  |           | Lip color.                                                                                                                                                                                                                                                                 |
| +`r`        | YES      | `integer` | \[0, 255] | R channel values.                                                                                                                                                                                                                                                          |
| +`g`        | YES      | `integer` | \[0, 255] | G channel values.                                                                                                                                                                                                                                                          |
| +`b`        | YES      | `integer` | \[0, 255] | B channel values.                                                                                                                                                                                                                                                          |
| +`a`        | YES      | `integer` | \[0, 100] | A channel values. Transparency, the smaller the value, the more transparent.                                                                                                                                                                                               |
| `face_rect` | NO       | `object`  |           | Face box position. If not entered the face with the largest area in the image is selected. You can use the [Face Analyzer](ai-portrait/analysis/face-analyzer) API or [Facial Landmarks](ai-portrait/analysis/face-key-points) API to get face frame position information. |
| +`x`        | YES      | `integer` |           | Horizontal coordinate of the upper left corner of the face box.                                                                                                                                                                                                            |
| +`y`        | YES      | `integer` |           | The vertical coordinate of the upper left corner of the face box.                                                                                                                                                                                                          |
| +`width`    | YES      | `integer` |           | Face frame width.                                                                                                                                                                                                                                                          |
| +`height`   | YES      | `integer` |           | Face frame height.                                                                                                                                                                                                                                                         |

###### Example

```json theme={null}
{
  "lip_color_infos": '[{"rgba":{"r":246,"g":27,"b":91,"a":100}}]'
}
```

```json theme={null}
{
  "lip_color_infos": '[{"rgba":{"r":246,"g":27,"b":91,"a":100},"face_rect":{"x":0,"y":0,"width":0,"height":0}}]'
}
```

## Response

<Warning>
  **Response Field Handling Flow**

  1. **Handle `Public Response Fields`**

     Parse and validate the `Public Response Fields`, checking the status code or response message to ensure the request is successful and error-free.

  2. **Handle `Business Response Fields`**

     If the `Public Response Fields` are valid and error-free, proceed with processing the business logic in the `Business Response Fields`.
</Warning>

### Public Response Fields

<a href="/docs/response-description" target="_blank">Viewing Public Response Fields and Error Codes</a>

### Business Response Fields

| Field          | Type     | Description                                     |
| :------------- | :------- | :---------------------------------------------- |
| `result_image` | `string` | Returns the base64 data of the processed image. |

### Response Example

```json theme={null}
{
  "request_id":     "",
  "log_id":         "",
  "error_code":     0,
  "error_msg":      "",
  "error_detail":   {
    "status_code":  200,
    "code":         "",
    "code_message": "",
    "message":      ""
  },
  "result_image":   ""
}
```


## OpenAPI

````yaml POST /api/portrait/effects/lips-color-changer
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/portrait/effects/lips-color-changer:
    post:
      tags:
        - AI PORTRAIT > Portrait Effects
      summary: Lips Color Changer
      description: >-
        Lips Color Changer API applies realistic virtual lipstick colors to
        portraits using facial recognition and precise lip detection.
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                lip_color_infos:
                  type: string
                  description: >-
                    Lip Color Info. You can enter up to 3 lip_color_info to
                    enable changing the lip color for up to 3 faces in a graph.
      responses:
        '200':
          headers:
            Content-Type:
              schema:
                type: string
                example: application/json
          content:
            application/json:
              schema:
                type: object
              example:
                request_id: ''
                log_id: ''
                error_code: 0
                error_code_str: ''
                error_msg: ''
                error_detail:
                  status_code: 200
                  code: ''
                  code_message: ''
                  message: ''
                result_image: ''
          description: Success
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: ailabapi-api-key
      description: API Key for authentication

````