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

# Analyze Source Material

> Analyze Source Material for Clothing Swap V5.

```
POST https://openapi.akool.com/api/open/v5/clothingSwap/analyze
```

Use the same authorization headers as task creation.

**Body Attributes**

| **Parameter** | **Type** | **Required** | **Description** |
| - | - | - | - |
| url | String | true | Public source material URL. Use the identical URL during task creation. |
| media\_type | String | true | image or video. Use the same media type and URL when creating an analysis-driven task. |
| type | String | false | Analysis category: person, head or outfit; defaults to person. |

## Request examples

Select a source scenario to view matching request and queued response examples. URLs and IDs are illustrative; replace them with your accessible source material.

<Tabs>
  <Tab title="Source image">
    **Body**

    ```json theme={null}
    {
      "url": "https://example.com/source.jpg",
      "media_type": "image",
      "type": "person"
    }
    ```
  </Tab>

  <Tab title="Source video">
    **Body**

    ```json theme={null}
    {
      "url": "https://example.com/source.mp4",
      "media_type": "video",
      "type": "person"
    }
    ```
  </Tab>
</Tabs>

**Response Attributes**

| **Parameter** | **Type** | **Description** |
| - | - | - |
| code | Integer | Business response code. |
| msg | String | Response message. |
| data | Object | Newly created analysis. |
| - \_id | String | Analysis ID. |
| - task\_id | String | Downstream algorithm/provider task ID; may be empty until submission. Use `_id`, not this value, for task-detail queries. It may change between workflow stages. |
| - status | Integer | Initially 1 (queueing). |
| - media\_type | String | Source media type. |

Save `data._id` as the analysis ID.

<Note>For input limits, billing, callbacks, and error codes, see the [Clothing Swap V5 overview](/ai-tools-suite/swap-studio/clothing-swap-v5).</Note>

<RequestExample>
  ```bash Source image theme={null}
  curl --request POST \
  --url 'https://openapi.akool.com/api/open/v5/clothingSwap/analyze' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "url": "https://example.com/source.jpg",
    "media_type": "image",
    "type": "person"
  }'
  ```

  ```bash Source video theme={null}
  curl --request POST \
  --url 'https://openapi.akool.com/api/open/v5/clothingSwap/analyze' \
  --header 'x-api-key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "url": "https://example.com/source.mp4",
    "media_type": "video",
    "type": "person"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Source image theme={null}
  {
    "code": 1000,
    "msg": "OK",
    "data": {
      "_id": "670000000000000000000001",
      "task_id": "",
      "status": 1,
      "media_type": "image"
    }
  }
  ```

  ```json Source video theme={null}
  {
    "code": 1000,
    "msg": "OK",
    "data": {
      "_id": "670000000000000000000001",
      "task_id": "",
      "status": 1,
      "media_type": "video"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /api/open/v5/clothingSwap/analyze
openapi: 3.0.3
info:
  title: Swap Studio V5 API
  version: 5.0.0
  description: Asynchronous character, motion, head, hair and clothing replacement APIs.
servers:
  - url: https://openapi.akool.com
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /api/open/v5/clothingSwap/analyze:
    post:
      tags:
        - Clothing Swap
      summary: Analyze Source Material — Clothing Swap
      description: >-
        image or video. Use the same media type and URL when creating an
        analysis-driven task. Analysis category: person, head or outfit;
        defaults to person. Wait for status=3 before using the analysis _id for
        creation. Creation must use the same source URL and media type.
      operationId: clothingSwap_analyze
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: >-
                    Public source material URL. Use the identical URL during
                    task creation.
                  format: uri
                media_type:
                  type: string
                  description: >-
                    image or video. Use the same media type and URL when
                    creating an analysis-driven task.
                  enum:
                    - image
                    - video
                type:
                  type: string
                  description: >-
                    Analysis category: person, head or outfit; defaults to
                    person.
                  enum:
                    - person
                    - head
                    - outfit
              required:
                - url
                - media_type
            examples:
              image:
                summary: Analyze source image
                value:
                  url: https://example.com/source.jpg
                  media_type: image
                  type: person
              video:
                summary: Analyze source video
                value:
                  url: https://example.com/source.mp4
                  media_type: video
                  type: person
      responses:
        '200':
          description: >-
            Business response. Code 1000 means the request succeeded; inspect
            task status or data.errors for generation/submission outcomes.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    example: 1000
                  msg:
                    type: string
                    example: OK
                  data:
                    type: object
                    additionalProperties: true
                    properties:
                      _id:
                        type: string
                      task_id:
                        type: string
                        description: >-
                          Downstream algorithm/provider task ID; may be empty
                          until submission. Use `_id`, not this value, for
                          task-detail queries. It may change between workflow
                          stages.
                      status:
                        type: integer
                        enum:
                          - 1
                          - 2
                          - 3
                          - 4
                      media_type:
                        type: string
              examples:
                image:
                  summary: Analyze source image queued
                  value:
                    code: 1000
                    msg: OK
                    data:
                      _id: '670000000000000000000001'
                      task_id: ''
                      status: 1
                      media_type: image
                video:
                  summary: Analyze source video queued
                  value:
                    code: 1000
                    msg: OK
                    data:
                      _id: '670000000000000000000001'
                      task_id: ''
                      status: 1
                      media_type: video
      x-codeSamples:
        - lang: bash
          label: Analyze source image
          source: |-
            curl --request POST \
            --url 'https://openapi.akool.com/api/open/v5/clothingSwap/analyze' \
            --header 'x-api-key: <api-key>' \
            --header 'Content-Type: application/json' \
            --data '{
              "url": "https://example.com/source.jpg",
              "media_type": "image",
              "type": "person"
            }'
        - lang: bash
          label: Analyze source video
          source: |-
            curl --request POST \
            --url 'https://openapi.akool.com/api/open/v5/clothingSwap/analyze' \
            --header 'x-api-key: <api-key>' \
            --header 'Content-Type: application/json' \
            --data '{
              "url": "https://example.com/source.mp4",
              "media_type": "video",
              "type": "person"
            }'
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.