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

# Get Task Result

> Get Task Result for Hair Swap V5.

```
GET https://openapi.akool.com/api/open/v5/hairswap/task/detail?_id={{id}}
```

**Request Headers**

| **Parameter** | **Value** | **Description** |
| - | - | - |
| x-api-key | API Key | API key used for authorization. Authorization takes precedence when both headers are supplied. |
| Authorization | Bearer `{token}` | [Get Token](/authentication/usage#get-the-token). |
| Content-Type | application/json | Required for JSON requests. |

**Query Attributes**

| **Parameter** | **Type** | **Required** | **Description** |
| - | - | - | - |
| \_id | String | true | A task ID from the creation response. Only tasks belonging to your user/team are accessible. |

**Response Attributes**

| **Parameter** | **Type** | **Description** |
| - | - | - |
| code | Integer | `1000` for a successful query. |
| msg | String | Response message. |
| data | Object | Task detail, including the task fields returned by creation. |
| - \_id | String | Stable local task ID used for this query. |
| - 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 | 1 = queueing, 2 = processing, 3 = completed, 4 = failed. |
| - url | String | Output URL, available after completion. |
| - progress | Number | Processing progress, when available. |
| - error\_reason | String | Failure reason, when available. |
| - multi\_shot\_results | Array | Additional hairstyle views; empty for other operations. |

```bash cURL theme={null}
curl --location 'https://openapi.akool.com/api/open/v5/hairswap/task/detail?_id=670000000000000000000002' \
--header 'x-api-key: {{API Key}}'
```

The `url` field may be empty before completion. Use it only when `status` is 3. Poll until `status` is 3 or 4. A query with `code: 1000` may still describe a failed generation task; inspect `data.status` and `data.error_reason`.

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


## OpenAPI

````yaml GET /api/open/v5/hairswap/task/detail
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/hairswap/task/detail:
    get:
      tags:
        - Hair Swap
      summary: Get Task Result — Hair Swap
      description: >-
        See the Hair Swap V5 reference for model-specific constraints and
        conditional parameters. Authorization takes precedence when both
        authentication headers are supplied.
      operationId: hairswap_get_result
      parameters:
        - name: _id
          in: query
          required: true
          description: >-
            Stable task data.list[]._id returned by create, not downstream
            task_id; the record must belong to your user/team.
          schema:
            type: string
            pattern: ^[a-fA-F0-9]{24}$
          example: '670000000000000000000002'
      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:
                    $ref: '#/components/schemas/Task'
      x-codeSamples:
        - lang: bash
          label: cURL
          source: >-
            curl --request GET \

            --url
            'https://openapi.akool.com/api/open/v5/hairswap/task/detail?_id=670000000000000000000002'
            \

            --header 'x-api-key: <api-key>'
components:
  schemas:
    Task:
      type: object
      properties:
        _id:
          type: string
          description: ID used for task-detail queries.
        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
          enum:
            - image
            - video
        model_name:
          type: string
        deduction_credit:
          type: number
        create_time:
          type: number
        progress:
          type: number
        url:
          type: string
        error_reason:
          type: string
        multi_shot_results:
          type: array
          items:
            type: object
            additionalProperties: true
  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.