openapi: 3.0.3
servers:
  - url: https://prod.api.market/api/v1/magicapi/hair-v2
info:
  title: "[NEW] Hair Changer API V2: Changes hair style and color for any Image."
  version: 2.0.0
  description: "Empower users to experiment with hairstyles and colors: Seamlessly
    integrate Hair Changer API into your app for interactive hair modification
    capabilities."
tags:
  - name: HairSwap
    description: Change hairstyle on a user‑supplied photo
  - name: artificial-intelligence
    description: Operations related to artificial-intelligence
  - name: image
    description: Operations related to image
  - name: media
    description: Operations related to media
  - name: image-to-image
    description: Operations related to image-to-image
  - name: text-to-image
    description: Operations related to text-to-image
security: {}
components:
  securitySchemes: {}
paths:
  /run:
    post:
      tags:
        - HairSwap
      summary: Start a hairstyle‑change job
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                input:
                  type: object
                  required:
                    - haircolor
                    - hairproperty
                    - hairstyle
                    - image
                  properties:
                    haircolor:
                      type: string
                      description: Desired hair colour (e.g. `"brunette"`, `"blonde"`)
                      example: blonde
                    hairproperty:
                      type: string
                      description: Hair texture or property (e.g. `"straight"`, `"curly"`)
                      example: curly
                    hairstyle:
                      type: string
                      description: Target hairstyle name
                      example: Spiral Curls
                    image:
                      type: string
                      format: uri
                      description: Public URL of the source image
                      example: https://blog.api.market/wp-content/uploads/2025/04/brazilian_blouwout.png
              required:
                - input
            example:
              input:
                haircolor: blonde
                hairproperty: curly
                hairstyle: Spiral Curls
                image: https://blog.api.market/wp-content/uploads/2025/04/brazilian_blouwout.png
      responses:
        "200":
          description: Job accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique job identifier
                    example: 67970bb1-765e-409f-8a37-01dcc503f170-u1
                  status:
                    type: string
                    enum:
                      - IN_QUEUE
                    example: IN_QUEUE
    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
  /status/{id}:
    get:
      tags:
        - HairSwap
      summary: Check status of a hairstyle‑change job
      parameters:
        - name: id
          in: path
          required: true
          description: Job identifier returned by **POST /run**
          schema:
            type: string
            example: a1169d63-1231-40be-86b3-760bd027532c-u2
      responses:
        "200":
          description: Current job state
          content:
            application/json:
              schema:
                type: object
                properties:
                  delayTime:
                    type: integer
                    description: Milliseconds before the next status update (present when queueing)
                    example: 25115
                  executionTime:
                    type: integer
                    description: Total milliseconds taken to complete the job (present on
                      completion)
                    example: 29384
                  id:
                    type: string
                    description: Job identifier
                    example: a1169d63-1231-40be-86b3-760bd027532c-u2
                  status:
                    type: string
                    enum:
                      - IN_QUEUE
                      - IN_PROGRESS
                      - COMPLETED
                      - FAILED
                    example: COMPLETED
                  output:
                    type: object
                    description: Present only when `status` is `COMPLETED`
                    properties:
                      started_at:
                        type: string
                        format: date-time
                        example: 2025-06-26T13:36:57.007020+00:00
                      completed_at:
                        type: string
                        format: date-time
                        example: 2025-06-26T13:37:26.192822+00:00
                      image_url:
                        type: string
                        format: uri
                        description: Final edited image
                        example: https://blog.api.market/wp-content/uploads/2026/01/20260126_102925_ef433d34.png
              examples:
                completed:
                  summary: Job finished
                  value:
                    delayTime: 25115
                    executionTime: 29384
                    id: a1169d63-1231-40be-86b3-760bd027532c-u2
                    status: COMPLETED
                    output:
                      started_at: 2025-06-26T13:36:57.007020+00:00
                      completed_at: 2025-06-26T13:37:26.192822+00:00
                      image_url: https://blog.api.market/wp-content/uploads/2026/01/20260126_102925_ef433d34.png
    parameters:
      - *a1
