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

# Swap

> Create face swap service, this endpoint interaction is the same as TTAPI Midjourney API interaction mode (Async)

### Face Swap Feature Description

The face swap feature leverages Midjourney’s image editing capabilities, allowing you to upload a portrait image along with a reference style image to generate a face swap effect according to the specified proportions. Before using, please ensure:

1. The reference image is clear, with recognizable facial features.

2. Do not upload illegal or copyrighted content.

3. Generated results are intended for legal and compliant use only.

<img src="https://mintcdn.com/acme-ce820e56/3BhrtPa-2pJn8c5Y/images/swapimg.png?fit=max&auto=format&n=3BhrtPa-2pJn8c5Y&q=85&s=1579463ac6fca1ba97134285658f4c95" alt="Example of Face Swap Result" style={{width: "200px", height: "auto"}} width="394" height="670" data-path="images/swapimg.png" />


## OpenAPI

````yaml openapi/en/swapface.json POST /insightFace/v1/swap
openapi: 3.1.0
info:
  title: Swapface API DOCS
  version: 1.0.0
  description: >-
    TTAPI Swapface API service, currently integrating the most advanced video
    large model Sora2.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /insightFace/v1/swap:
    post:
      description: >-
        Create face swap service, this endpoint interaction is the same as TTAPI
        Midjourney API interaction mode (Async)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapRequest'
      responses:
        '200':
          $ref: '#/components/responses/SuccessResponse'
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - CustomApiKey: []
components:
  schemas:
    SwapRequest:
      type: object
      properties:
        targetImage:
          type: string
          description: 'Template image: URL of the face swap template image'
        swapImage:
          type: string
          description: 'Face image: URL of the image to be face swapped'
        hookUrl:
          type: string
          description: >-
            Callback URL address. When the task completes or fails,
            notifications will be sent to this address. The <a href="fetch"
            target="_self">notification data structure</a> is consistent with
            the fetch structure. If not set, you need to call the <a
            href="fetch" target="_self">fetch</a> endpoint to query the result.
      required:
        - targetImage
        - swapImage
  responses:
    SuccessResponse:
      description: Request successful
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: success
              data:
                type: object
                example:
                  jobId: jobId
            required:
              - status
              - message
              - data
    400Response:
      description: Parameter error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: Authorization failed
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    CustomApiKey:
      type: apiKey
      in: header
      name: TT-API-KEY
      description: >-
        You can obtain your API key from the <a
        href='https://dashboard.ttapi.io' target='_blank'>TTAPI Dashboard</a>.

````