openapi: 3.0.1
servers:
  - url: https://prod.api.market/api/v1/magicapi/faceswap-v2
info:
  title: "[V2] FaceSwap Image & Video API! New & Improved!"
  description: "New FaceSwap Image & Video API: 240-Seconds (4 min) Video Swaps &
    High-Res Image API. Affordable, Improved Quality, Reliable, and Easy to
    Use."
  version: 1.0.0
paths:
  /faceswap/image/run:
    post:
      summary: Swap faces between two images
      description: This endpoint takes two images (swap_image and target_image) and
        performs a face swap.
      operationId: runFaceSwapImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                input:
                  type: object
                  required:
                    - swap_image
                    - target_image
                  properties:
                    swap_image:
                      type: string
                      format: uri
                      example: https://blog.api.market/wp-content/uploads/2024/06/Elon_Musk.png
                      description: URL of the image that will replace the face.
                    target_image:
                      type: string
                      format: uri
                      example: https://blog.api.market/wp-content/uploads/2024/06/Shahrukh_khan.png
                      description: URL of the image where the face will be swapped.
      responses:
        "200":
          description: The face swap request has been queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 53de9d60-2831-46ce-857c-ed7be0c57794-e1
                    description: Unique identifier for the request.
                  status:
                    type: string
                    example: IN_QUEUE
                    description: The status of the face swap request.
        "400":
          description: Bad request, typically due to missing or invalid input data.
        "401":
          description: Unauthorized, API key is invalid or missing.
      security:
        - ApiKeyAuth: []
    parameters:
      - &a1
        description: API.market API Key
        in: header
        name: x-api-market-key
        value: Please Login/Signup to get an API Key
        required: true
        schema:
          type: string
  /faceswap/image/status/{id}:
    get:
      summary: Check the status of a face swap image request
      description: This endpoint returns the current status of the face swap request
        along with its output if completed.
      operationId: getFaceSwapImageStatus
      parameters:
        - name: id
          in: path
          required: true
          description: The unique identifier of the face swap request.
          schema:
            type: string
            example: bb931810-1472-44c3-b4a0-518f358962dd-e1
      responses:
        "200":
          description: The status of the face swap request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  delayTime:
                    type: integer
                    example: 1485
                    description: Time in milliseconds the task waited before being processed.
                  executionTime:
                    type: integer
                    example: 1975
                    description: Time in milliseconds taken to process the face swap request.
                  id:
                    type: string
                    example: 53de9d60-2831-46ce-857c-ed7be0c57794-e1
                    description: Unique identifier of the face swap request.
                  output:
                    type: string
                    format: byte
                    example: data:image/jpeg;base64,/uELuzOD8LagPDfi
                    description: The base64 encoded output image.
                  status:
                    type: string
                    example: COMPLETED
                    description: Current status of the face swap request.
                  workerId:
                    type: string
                    example: y4kxc16d8r1ppp
                    description: ID of the worker that processed the request.
                  estimated_completion:
                    type: string
                    format: date-time
                    example: 2024-10-29T09:14:02.076Z
                    description: Estimated completion time for the face swap request.
        "400":
          description: Bad request, typically due to invalid ID.
        "401":
          description: Unauthorized, API key is invalid or missing.
      security:
        - ApiKeyAuth: []
    parameters:
      - *a1
  /faceswap/video/run:
    post:
      summary: Swap face in a video
      description: This endpoint takes a swap image and a target video and performs a
        face swap in the video.
      operationId: runFaceSwapVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                input:
                  type: object
                  required:
                    - swap_image
                    - target_video
                  properties:
                    swap_image:
                      type: string
                      format: uri
                      example: https://blog.api.market/wp-content/uploads/2024/06/Elon_Musk.png
                      description: URL of the image that will replace the face in the video.
                    target_video:
                      type: string
                      format: uri
                      example: https://blog.api.market/wp-content/uploads/2024/10/video_input.mp4
                      description: URL of the video where the face will be swapped.
      responses:
        "200":
          description: The face swap request has been queued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: 88f075d6-85cf-40bf-94f8-15b75dff624f-e1
                    description: Unique identifier for the request.
                  status:
                    type: string
                    example: IN_QUEUE
                    description: The status of the face swap request.
        "400":
          description: Bad request, typically due to missing or invalid input data.
        "401":
          description: Unauthorized, API key is invalid or missing.
      security:
        - ApiKeyAuth: []
    parameters:
      - *a1
  /faceswap/video/status/{id}:
    get:
      summary: Check the status of a face swap video request
      description: This endpoint returns the current status of the face swap video
        request along with its output if completed.
      operationId: getFaceSwapVideoStatus
      parameters:
        - name: id
          in: path
          required: true
          description: The unique identifier of the face swap request.
          schema:
            type: string
            example: 88f075d6-85cf-40bf-94f8-15b75dff624f-e1
      responses:
        "200":
          description: The status of the face swap video request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  delayTime:
                    type: integer
                    example: 1276
                    description: Time in milliseconds the task waited before being processed.
                  executionTime:
                    type: integer
                    example: 120700
                    description: Time in milliseconds taken to process the face swap request.
                  id:
                    type: string
                    example: 88f075d6-85cf-40bf-94f8-15b75dff624f-e1
                    description: Unique identifier of the face swap request.
                  output:
                    type: object
                    properties:
                      video_url:
                        type: string
                        format: uri
                        example: https://blog.api.market/wp-content/uploads/2024/10/video_input.mp4
                        description: URL of the output video.
                  status:
                    type: string
                    example: COMPLETED
                    description: Current status of the face swap request.
                  workerId:
                    type: string
                    example: yzli3k2dwjxad8
                    description: ID of the worker that processed the request.
                  estimated_completion:
                    type: string
                    format: date-time
                    example: 2024-10-29T09:22:41.356Z
                    description: Estimated completion time for the face swap request.
        "400":
          description: Bad request, typically due to invalid ID.
        "401":
          description: Unauthorized, API key is invalid or missing.
      security:
        - ApiKeyAuth: []
    parameters:
      - *a1
components:
  securitySchemes: {}
security: {}
tags:
  - name: tools
    description: Operations related to tools
  - name: video
    description: Operations related to video
  - name: visual-recognition
    description: Operations related to visual-recognition
  - name: artificial-intelligence
    description: Operations related to artificial-intelligence
  - name: image-to-image
    description: Operations related to image-to-image
  - name: image-to-video
    description: Operations related to image-to-video
