openapi: 3.0.3
servers:
  - url: https://prod.api.market/api/v1/magicapi/faceswap-capix
info:
  title: Faceswap Image & Video API (Capix Compatible)
  version: 1.0.1
  description: "FaceSwap Image & Video API: Affordable, Reliable, and Easy-to-Use."
components:
  securitySchemes: {}
security: {}
paths:
  /image/run:
    post:
      tags:
        - Image
      summary: Enqueue an **image** face-swap job
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - target_url
                - swap_url
              properties:
                target_url:
                  type: string
                  format: uri
                  description: Public URL of the target image
                  default: https://storage.ws.pho.to/s2/7aa4876bc1f50bc92fc54cb3c326181ac5bbf5ef_m.jpeg
                swap_url:
                  type: string
                  format: uri
                  description: Public URL of the source face image
                  default: https://storage.ws.pho.to/s2/818f3e408ee37c090cf23a3d12e15a08ada80ad9_m.jpeg
                target_face_index:
                  type: integer
                  description: Index of the face in the target (default 0)
                  default: 0
            example:
              target_url: https://storage.ws.pho.to/s2/7aa4876bc1f50bc92fc54cb3c326181ac5bbf5ef_m.jpeg
              swap_url: https://storage.ws.pho.to/s2/818f3e408ee37c090cf23a3d12e15a08ada80ad9_m.jpeg
              target_face_index: 0
      responses:
        "200":
          description: Job accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  image_process_response:
                    type: object
                    properties:
                      request_id:
                        type: string
                      status:
                        type: string
                      description:
                        type: string
                        nullable: true
                      err_code:
                        type: string
              example:
                image_process_response:
                  request_id: db0a1524-161a-4223-b46f-29a13f6eee57-u2
                  status: OK
                  description: null
                  err_code: "0"
    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
  /image/result/:
    post:
      tags:
        - Image
      summary: Poll an image job for status / result
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - request_id
              properties:
                request_id:
                  type: string
                  default: db0a1524-161a-4223-b46f-29a13f6eee57-u2
            example:
              request_id: db0a1524-161a-4223-b46f-29a13f6eee57-u2
      responses:
        "200":
          description: Current job state or final output
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Processing
                    properties:
                      image_process_response:
                        type: object
                        properties:
                          request_id:
                            type: string
                          status:
                            type: string
                          err_code:
                            type: string
                  - type: object
                    description: Finished
                    properties:
                      image_process_response:
                        type: object
                        properties:
                          request_id:
                            type: string
                          status:
                            type: string
                          duration:
                            type: string
                          total_duration:
                            type: string
                          result_url:
                            type: string
                            format: uri
              examples:
                processing:
                  summary: Still processing
                  value:
                    image_process_response:
                      request_id: db0a1524-161a-4223-b46f-29a13f6eee57-u2
                      status: PROCESSING
                      err_code: "0"
                done:
                  summary: Finished
                  value:
                    image_process_response:
                      request_id: db0a1524-161a-4223-b46f-29a13f6eee57-u2
                      status: OK
                      duration: 10.725000000s
                      total_duration: 10.725000000s
                      result_url: https://d3tx3wg2jy0sui.cloudfront.net/face_swap/20250514_170336_73d644fd.jpg
    parameters:
      - *a1
  /video/run:
    post:
      tags:
        - Video
      summary: Enqueue a **video** face-swap job
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - target_url
                - swap_url
              properties:
                target_url:
                  type: string
                  format: uri
                  description: Public URL of the target video
                  default: https://blog.api.market/wp-content/uploads/2024/10/video_input.mp4
                swap_url:
                  type: string
                  format: uri
                  description: Public URL of the source face image
                  default: https://blog.api.market/wp-content/uploads/2024/06/Elon_Musk.png
                target_face_index:
                  type: integer
                  description: Index of the face in the target (default 0)
                  default: 0
            example:
              target_url: https://blog.api.market/wp-content/uploads/2024/10/video_input.mp4
              swap_url: https://blog.api.market/wp-content/uploads/2024/06/Elon_Musk.png
              target_face_index: 0
      responses:
        "200":
          description: Job accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  image_process_response:
                    type: object
                    properties:
                      request_id:
                        type: string
                      status:
                        type: string
                      description:
                        type: string
                        nullable: true
                      err_code:
                        type: string
              example:
                image_process_response:
                  request_id: 13e4ea06-9d95-4177-ad01-c8f65c845fa3-u2
                  status: OK
                  description: null
                  err_code: "0"
    parameters:
      - *a1
  /video/result/:
    post:
      tags:
        - Video
      summary: Poll a video job for status / result
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
                - request_id
              properties:
                request_id:
                  type: string
                  default: 13e4ea06-9d95-4177-ad01-c8f65c845fa3-u2
            example:
              request_id: 13e4ea06-9d95-4177-ad01-c8f65c845fa3-u2
      responses:
        "200":
          description: Current job state or final output
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    description: Processing
                    properties:
                      image_process_response:
                        type: object
                        properties:
                          request_id:
                            type: string
                          status:
                            type: string
                          err_code:
                            type: string
                  - type: object
                    description: Finished
                    properties:
                      image_process_response:
                        type: object
                        properties:
                          request_id:
                            type: string
                          status:
                            type: string
                          duration:
                            type: string
                          total_duration:
                            type: string
                          result_url:
                            type: string
                            format: uri
              examples:
                processing:
                  summary: Still processing
                  value:
                    image_process_response:
                      request_id: 13e4ea06-9d95-4177-ad01-c8f65c845fa3-u2
                      status: PROCESSING
                      err_code: "0"
                done:
                  summary: Finished
                  value:
                    image_process_response:
                      request_id: 13e4ea06-9d95-4177-ad01-c8f65c845fa3-u2
                      status: OK
                      duration: 77.230000000s
                      total_duration: 77.230000000s
                      result_url: https://d3tx3wg2jy0sui.cloudfront.net/face_swap/20250514_170539_1dda397b.mp4
    parameters:
      - *a1
tags:
  - name: artificial-intelligence
    description: Operations related to artificial-intelligence
  - name: image
    description: Operations related to image
  - name: visual-recognition
    description: Operations related to visual-recognition
  - name: image-to-image
    description: Operations related to image-to-image
  - name: image-to-video
    description: Operations related to image-to-video
