openapi: 3.1.0
info:
  title: Undress API
  description: API for undressing images with different styles.
  version: 1.2.2
  contact:
    name: DeepStrip
    url: https://deepstrip.com/
servers:
  - url: https://deepstrip.com/api/v1
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    UndressRequest:
      type: object
      required:
        - source_image
        - style
      properties:
        source_image:
          type: string
          description: Base64 encoded source image in jpeg format.
        mask:
          type: string
          description: >-
            Base64 encoded mask image in png format. Contains two colors: white
            for undressing regions, black for the rest.
        automask:
          type: boolean
          description: If set to true, mask will be automatically generated.
        style:
          type: string
          description: The style to apply for undressing.
          enum:
            - standard
            - premium
            - premium_v2
            - nurse
            - bdsm
            - underwear_white
            - underwear_black
            - underwear_pink
    FaceSwapRequest:
      type: object
      required:
        - image
        - face
      properties:
        image:
          type: string
          description: Base64 encoded image.
        face:
          type: string
          description: Base64 encoded face image.
        version:
          type: string
          description: Version of the face swap model.
          enum:
            - v1
            - v2
    UndressResponse:
      type: object
      properties:
        id:
          type: string
          description: Identifier for the job.
    FaceSwapResponse:
      type: object
      properties:
        id:
          type: string
          description: Identifier for the job.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        errors:
          type: array
          items:
            type: string
    UndressResultResponse:
      type: object
      properties:
        status:
          type: string
          description: Status of the undress job.
          enum:
            - pending
            - completed
            - failed
        image:
          type: string
          description: URL of the generated image, if the job is completed.
    FaceSwapResultResponse:
      type: object
      properties:
        status:
          type: string
          description: Status of the face swap job.
          enum:
            - pending
            - completed
            - failed
        image:
          type: string
          description: URL of the generated image, if the job is completed.
    FaceSwapVideoAnalyzeRequest:
      type: object
      required:
        - video_url
      properties:
        video_url:
          type: string
          description: HTTPS URL of the video to analyze.
        preview:
          type: boolean
          description: Whether to create a preview (shorter) version.
        version:
          type: string
          description: Version of the face swap model.
          enum:
            - v1
            - v2
    FaceSwapVideoAnalyzeResponse:
      type: object
      properties:
        price:
          type: number
          description: Calculated price for the face swap video.
        version:
          type: string
          description: Version that will be used.
          enum:
            - v1
            - v2
        preview:
          type: boolean
          description: Whether this is a preview version.
    FaceSwapVideoRequest:
      type: object
      properties:
        video_url:
          type: string
          description: HTTPS URL of the video to process.
        face_url:
          type: string
          description: HTTPS URL of the face image.
        preview:
          type: boolean
          description: Whether to create a preview version.
        version:
          type: string
          description: Version of the face swap model.
          enum:
            - v1
            - v2
    FaceSwapVideoResponse:
      type: object
      properties:
        id:
          type: string
          description: Identifier for the face swap video job.
        status:
          type: string
          description: Initial status of the job.
        message:
          type: string
          description: Additional information about the job.
    FaceSwapVideoStatusResponse:
      type: object
      properties:
        id:
          type: string
          description: Identifier for the face swap video job.
        status:
          type: string
          description: Status of the face swap video job.
          enum:
            - initial
            - sent
            - processing
            - completed
            - failed
        progress:
          type: number
          description: Progress percentage of the processing.
        step:
          type: string
          description: Current processing step.
          enum:
            - queued
            - downloading
            - fps
            - analysing
            - working
            - sound
            - reencoding_step_1
            - reencoding_step_2
            - postprocessing
            - uploading
        result_url:
          type: string
          description: URL of the processed video, if completed.
        error_details:
          type: object
          description: Error information if the job failed.
security:
  - bearerAuth: []
paths:
  /undress:
    post:
      summary: Create an undress job
      operationId: createUndress
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UndressRequest'
      responses:
        '201':
          description: Job created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UndressResponse'
        '400':
          description: Invalid parameters or no credits.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /face_swap_videos/analyze:
    post:
      summary: Analyze a video for face swap processing
      operationId: analyzeFaceSwapVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FaceSwapVideoAnalyzeRequest'
      responses:
        '200':
          description: Analysis completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FaceSwapVideoAnalyzeResponse'
        '400':
          description: Invalid parameters or URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Analysis failed due to video constraints.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: ANALYSIS_FAILED
                  details:
                    type: string
                    example: too_large
        '500':
          description: Internal server error.
  /face_swap_videos:
    post:
      summary: Create a face swap video job
      operationId: createFaceSwapVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FaceSwapVideoRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/FaceSwapVideoRequest'
      responses:
        '201':
          description: Job created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FaceSwapVideoResponse'
        '400':
          description: Invalid parameters, files, or URLs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
  /face_swap_videos/{id}:
    get:
      summary: Get the status of a face swap video job
      operationId: getFaceSwapVideoStatus
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Identifier of the face swap video job.
      responses:
        '200':
          description: Current status of the face swap video job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FaceSwapVideoStatusResponse'
        '404':
          description: Job not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
  /undress/{id}:
    get:
      summary: Get the result of an undress job
      operationId: getUndressResult
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Identifier of the undress job.
      responses:
        '200':
          description: Status or result of the undress job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UndressResultResponse'
        '404':
          description: Job not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /face_swaps:
    post:
      summary: Create a face swap job
      operationId: createFaceSwap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FaceSwapRequest'
      responses:
        '201':
          description: Job created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FaceSwapResponse'
        '400':
          description: Invalid parameters or no credits.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error.
  /face_swaps/{id}:
    get:
      summary: Get the result of a face swap job
      operationId: getFaceSwapResult
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Identifier of the face swap job.
      responses:
        '200':
          description: Status or result of the face swap job.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FaceSwapResultResponse'
        '404':
          description: Job not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
