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

# Image Face Swap

> Replace the primary face in an image without a prior detection step.

## Overview

Single image face swap replaces the primary face in an image with a new face image. This endpoint does not require face detection first; submit the original image URL and the new face image URL directly.

<Tip>
  Multi-face swap still requires a detection step and a `detect_id`.
</Tip>

## Request Example

```json theme={null}
{
  "model": "image-face-swap",
  "callback_url": "https://your-domain.com/api/callback",
  "input": {
    "image_url": "https://example.com/target-image.png",
    "new_face": "https://example.com/new-face.jpg"
  }
}
```

## Parameters

<ParamField body="image_url" type="string" required>
  URL of the target image where the face will be replaced.
</ParamField>

<ParamField body="new_face" type="string" required>
  URL of the new face image.
</ParamField>

## Query Task Status

After submitting a task, use the unified query endpoint to check progress and retrieve results:

<Card title="Get Task Info" icon="magnifying-glass" href="/models/common/get-task-info">
  Learn how to query task status and retrieve generation results
</Card>

<Tip>
  For production use, we recommend using `callback_url` to receive automatic notifications when the task completes, rather than polling the status endpoint.
</Tip>

## Related Resources

<CardGroup cols={2}>
  <Card title="Image Multi-Face Swap" icon="image" href="/ai-tools/face-swap/image-face-swap-multi">
    Replace selected faces in an image using detection results
  </Card>

  <Card title="Face Detection Result" icon="search" href="/ai-tools/face-swap/detect-face-result">
    Query detection status and retrieve `detect_id` with detected faces
  </Card>

  <Card title="Common API" icon="gear" href="/common-api/get-account-credits">
    Check credits and account usage
  </Card>
</CardGroup>


## OpenAPI

````yaml ai-tools/face-swap/image-face-swap.json post /api/v1/client/job/CreateTask
openapi: 3.0.0
info:
  title: Crun Image Face Swap API
  description: crun.ai Image Face Swap API Documentation
  version: 1.0.0
  contact:
    name: Technical Support
    email: support@crun.ai
servers:
  - url: https://api.crun.ai
    description: API Server
security:
  - ApiKeyAuth: []
paths:
  /api/v1/client/job/CreateTask:
    post:
      summary: Image face swap
      operationId: image-face-swap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - input
              properties:
                model:
                  type: string
                  enum:
                    - image-face-swap
                  description: >-
                    The model name to use for this endpoint. Must be
                    `image-face-swap`.
                callback_url:
                  type: string
                  format: uri
                  description: >-
                    Optional. Callback URL for receiving task completion
                    notifications.
                  example: https://your-domain.com/api/callback
                input:
                  $ref: '#/components/schemas/ImageFaceSwapInput'
            example:
              model: image-face-swap
              callback_url: https://your-domain.com/api/callback
              input:
                image_url: https://example.com/target-image.png
                new_face: https://example.com/new-face.jpg
                disable_safety_checker: false
      responses:
        '200':
          description: Request successful
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          task_id:
                            type: string
                            description: >-
                              Task ID, can be used with Get Task Details
                              endpoint to query task status
                            example: task_12345678
              example:
                code: 200
                message: success
                data:
                  task_id: task_12345678
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      errors:
                        type: array
                        description: Detailed validation error messages
                        items:
                          type: string
                        example:
                          - specific error field message
              example:
                code: 422
                message: Missing Params or Type Error
                errors:
                  - specific error field message
        '500':
          $ref: '#/components/responses/Error'
components:
  schemas:
    ImageFaceSwapInput:
      type: object
      description: Input parameters for single image face swap.
      properties:
        image_url:
          type: string
          format: uri
          description: URL of the target image where the face will be replaced.
          example: https://example.com/target-image.png
        new_face:
          type: string
          format: uri
          description: URL of the new face image.
          example: https://example.com/new-face.jpg
        disable_safety_checker:
          type: boolean
          nullable: true
          description: Disable the safety filter.
          default: null
          example: false
      required:
        - image_url
        - new_face
    ApiResponse:
      type: object
      properties:
        code:
          type: integer
          enum:
            - 200
            - 401
            - 402
            - 404
            - 422
            - 429
            - 455
            - 500
            - 501
            - 505
          description: >-
            Response status code


            - **200**: Success - Request has been processed successfully

            - **401**: Unauthorized - Authentication credentials are missing or
            invalid

            - **402**: Insufficient Credits - Account does not have enough
            credits to perform the operation

            - **404**: Not Found - The requested resource or endpoint does not
            exist

            - **422**: Validation Error - The request parameters failed
            validation checks

            - **429**: Rate Limited - Request limit has been exceeded for this
            resource

            - **455**: Service Unavailable - System is currently undergoing
            maintenance

            - **500**: Server Error - An unexpected error occurred while
            processing the request

            - **501**: Generation Failed - Content generation task failed

            - **505**: Feature Disabled - The requested feature is currently
            disabled
        message:
          type: string
          description: Response message, error description when failed
          example: success
  responses:
    Error:
      description: Server Error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        All APIs require authentication via API Key.


        Get API Key:

        1. Visit [API Key Management Page](https://crun.ai/user-api-key) to get
        your API Key


        Usage:

        Add to request header:


        x-api-key: YOUR_API_KEY


        Note:

        - Keep your API Key secure and do not share it with others

        - If you suspect your API Key has been compromised, reset it immediately
        in the management page

````