{
  "openapi": "3.1.0",
  "info": {
    "title": "Voiceswap API",
    "version": "1.1.0",
    "summary": "Swap the voice in a recording; isolate vocals or the backing track.",
    "description": "Voiceswap public API v1. Long-running work follows 202 + Location + conditional polling. All JSON errors use RFC 9457 problem details. Idempotency-Key is accepted on every mutation. Lists use cursor pagination. Clients must ignore unknown response fields and webhook types; removals, semantic changes, required-input additions, or enum narrowing require a new major API version. Deprecated operations receive at least 180 days notice with Deprecation, Sunset, and Link headers.",
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.voiceswap.dev",
      "description": "Production"
    },
    {
      "url": "{baseUrl}",
      "description": "Configured environment",
      "variables": {
        "baseUrl": {
          "default": "https://api-dev.voiceswap.dev"
        }
      }
    }
  ],
  "security": [
    {
      "bearerKey": []
    }
  ],
  "paths": {
    "/healthz": {
      "get": {
        "operationId": "healthz",
        "summary": "Aggregate fail-closed service health (no auth; NOT the taxonomy envelope)",
        "security": [],
        "responses": {
          "200": {
            "description": "All production-critical dependency signals are fresh and healthy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthReport"
                }
              }
            }
          },
          "503": {
            "description": "At least one dependency signal is missing, stale, or unhealthy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthReport"
                }
              }
            }
          }
        },
        "tags": [
          "System"
        ]
      }
    },
    "/livez": {
      "get": {
        "operationId": "livez",
        "summary": "Worker process liveness only; never use as the service dead-man",
        "security": [],
        "responses": {
          "200": {
            "description": "The Worker process can answer requests.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status",
                    "environment"
                  ],
                  "properties": {
                    "status": {
                      "const": "alive"
                    },
                    "environment": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "tags": [
          "System"
        ]
      }
    },
    "/v1/ping": {
      "get": {
        "operationId": "ping",
        "summary": "Verify a key: echoes workspace, actor, and scopes",
        "responses": {
          "200": {
            "description": "The authenticated context.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "workspace",
                    "actor",
                    "scopes"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "workspace": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "$ref": "#/components/schemas/WorkspaceId"
                        },
                        "plan": {
                          "type": "string",
                          "enum": [
                            "payg",
                            "starter",
                            "producer",
                            "scale"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "plan"
                      ]
                    },
                    "actor": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "const": "api_key"
                        },
                        "id": {
                          "$ref": "#/components/schemas/ApiKeyId"
                        }
                      },
                      "required": [
                        "type",
                        "id"
                      ]
                    },
                    "scopes": {
                      "$ref": "#/components/schemas/Scopes"
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "System"
        ]
      }
    },
    "/v1/swap": {
      "post": {
        "operationId": "createSwapJob",
        "summary": "Replace the singer in a recording (async; 202 + poll)",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CreateJobBase"
                  }
                ],
                "required": [
                  "input",
                  "voice"
                ],
                "properties": {
                  "voice": {
                    "type": "string",
                    "description": "Voice id from GET /v1/voices with status \"ready\". Out of key scope → 401; unknown → 404 voice_not_found; not ready → 409."
                  },
                  "params": {
                    "$ref": "#/components/schemas/SwapParams"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/JobAccepted"
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Jobs"
        ]
      }
    },
    "/v1/vocals": {
      "post": {
        "operationId": "createVocalsJob",
        "summary": "Isolate the vocal from a mix (async; 202 + poll)",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CreateJobBase"
                  }
                ],
                "required": [
                  "input"
                ],
                "properties": {
                  "params": {
                    "$ref": "#/components/schemas/SeparateParams"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/JobAccepted"
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Jobs"
        ]
      }
    },
    "/v1/instrumental": {
      "post": {
        "operationId": "createInstrumentalJob",
        "summary": "Backing track with the vocal removed (async; 202 + poll)",
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/CreateJobBase"
                  }
                ],
                "required": [
                  "input"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "$ref": "#/components/responses/JobAccepted"
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Jobs"
        ]
      }
    },
    "/v1/jobs/{id}": {
      "get": {
        "operationId": "getJob",
        "summary": "Poll a job",
        "parameters": [
          {
            "$ref": "#/components/parameters/JobId"
          },
          {
            "$ref": "#/components/parameters/IfNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "The job object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                },
                "description": "Present while queued or processing."
              }
            }
          },
          "304": {
            "description": "Representation unchanged.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              },
              "ETag": {
                "schema": {
                  "type": "string"
                }
              },
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Jobs"
        ]
      },
      "delete": {
        "operationId": "cancelJob",
        "summary": "Cancel a queued or processing job (never billed)",
        "description": "Releases the credit hold and terminates the GPU task. Repeat-cancel is an idempotent 200; a job that already succeeded or failed is 409. A late GPU completion after cancellation is discarded and reconciled — never billed.",
        "parameters": [
          {
            "$ref": "#/components/parameters/JobId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "The (now cancelled) job object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Jobs"
        ]
      }
    },
    "/v1/jobs/{id}/result": {
      "get": {
        "operationId": "getJobResult",
        "summary": "Signed download URL for a succeeded job's output",
        "description": "URL is valid 15 minutes and carries a download Content-Disposition; call again for a fresh one. Queued/processing → 409 (keep polling). Failed/cancelled → 409 (no result). Deleted by retention → 404 with an explicit message.",
        "parameters": [
          {
            "$ref": "#/components/parameters/JobId"
          }
        ],
        "responses": {
          "200": {
            "description": "Signed result URL.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "url",
                    "expires_at",
                    "format"
                  ],
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "format": {
                      "$ref": "#/components/schemas/AudioFormat"
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Jobs"
        ]
      }
    },
    "/v1/voices": {
      "get": {
        "operationId": "listVoices",
        "summary": "Voices this key can use (library + workspace, scope-filtered)",
        "responses": {
          "200": {
            "description": "Cursor page of usable voices.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoicePage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Voices"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ]
      }
    },
    "/v1/uploads": {
      "post": {
        "operationId": "createPresignedUpload",
        "summary": "Register an upload → presigned PUT URL (valid 1 h; primary path, mandatory > 50 MB)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "rights_attestation"
                ],
                "properties": {
                  "rights_attestation": {
                    "$ref": "#/components/schemas/RightsAttestation"
                  },
                  "content_length": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "File size in bytes — feeds the credit-hold floor."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Upload registered; PUT the bytes to put_url.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "upload_id",
                    "r2_key",
                    "put_url",
                    "expires_at"
                  ],
                  "properties": {
                    "upload_id": {
                      "$ref": "#/components/schemas/UploadId"
                    },
                    "r2_key": {
                      "type": "string"
                    },
                    "put_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Uploads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/v1/uploads/direct": {
      "put": {
        "operationId": "directUpload",
        "summary": "One-call raw-body upload, ≤ 50 MB (streamed, never buffered)",
        "description": "Content-Length and x-voiceswap-rights-attestation: true are required. Size is enforced before streaming; anything over 50 MB → 400 (use presigned or multipart).",
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Uploaded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "upload_id",
                    "r2_key"
                  ],
                  "properties": {
                    "upload_id": {
                      "$ref": "#/components/schemas/UploadId"
                    },
                    "r2_key": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Uploads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          },
          {
            "$ref": "#/components/parameters/ContentDigest"
          },
          {
            "$ref": "#/components/parameters/RightsAttestationHeader"
          }
        ]
      }
    },
    "/v1/uploads/multipart": {
      "post": {
        "operationId": "initiateMultipart",
        "summary": "Initiate a resumable multipart upload",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "rights_attestation"
                ],
                "properties": {
                  "rights_attestation": {
                    "$ref": "#/components/schemas/RightsAttestation"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Session opened.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "upload_id",
                    "r2_key"
                  ],
                  "properties": {
                    "upload_id": {
                      "$ref": "#/components/schemas/UploadId"
                    },
                    "r2_key": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Uploads"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/v1/uploads/multipart/{id}/parts": {
      "post": {
        "operationId": "signParts",
        "summary": "Presigned URLs for part numbers (1–100 per call; parts 1–10000; re-request to resume)",
        "parameters": [
          {
            "$ref": "#/components/parameters/UploadId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "part_numbers"
                ],
                "properties": {
                  "part_numbers": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 100,
                    "items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 10000
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Signed part URLs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "parts"
                  ],
                  "properties": {
                    "parts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "part_number",
                          "put_url"
                        ],
                        "properties": {
                          "part_number": {
                            "type": "integer"
                          },
                          "put_url": {
                            "type": "string",
                            "format": "uri"
                          }
                        }
                      }
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Uploads"
        ]
      }
    },
    "/v1/uploads/multipart/{id}/complete": {
      "post": {
        "operationId": "completeMultipart",
        "summary": "Complete the multipart upload with each part's ETag",
        "parameters": [
          {
            "$ref": "#/components/parameters/UploadId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "parts"
                ],
                "properties": {
                  "parts": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                      "type": "object",
                      "required": [
                        "part_number",
                        "etag"
                      ],
                      "properties": {
                        "part_number": {
                          "type": "integer"
                        },
                        "etag": {
                          "type": "string",
                          "description": "ETag returned by that part's PUT."
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Object assembled.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "r2_key"
                  ],
                  "properties": {
                    "r2_key": {
                      "type": "string"
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Uploads"
        ]
      }
    },
    "/v1/uploads/multipart/{id}/abort": {
      "post": {
        "operationId": "abortMultipart",
        "summary": "Abort a multipart session",
        "parameters": [
          {
            "$ref": "#/components/parameters/UploadId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Aborted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "aborted"
                  ],
                  "properties": {
                    "aborted": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Uploads"
        ]
      }
    },
    "/v1/webhooks": {
      "post": {
        "operationId": "createWebhookEndpoint",
        "summary": "Register a webhook endpoint (secret shown once)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Your HTTPS endpoint."
                  },
                  "event_types": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/WebhookEventType"
                    },
                    "description": "Default: [\"job.succeeded\", \"job.failed\"]."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Endpoint created. Store the secret now — it is never shown again.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "url",
                    "secret"
                  ],
                  "properties": {
                    "id": {
                      "$ref": "#/components/schemas/WebhookEndpointId"
                    },
                    "url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "secret": {
                      "type": "string",
                      "description": "whsec_… — HMAC-SHA256 signing key. Shown once."
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      },
      "get": {
        "operationId": "listWebhookEndpoints",
        "summary": "List webhook endpoints",
        "responses": {
          "200": {
            "description": "Cursor page of webhook endpoints.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointPage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ]
      }
    },
    "/v1/webhooks/{id}": {
      "delete": {
        "operationId": "deleteWebhookEndpoint",
        "summary": "Deactivate a webhook endpoint",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "deleted"
                  ],
                  "properties": {
                    "deleted": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/webhooks/{id}/deliveries": {
      "get": {
        "operationId": "listWebhookDeliveries",
        "summary": "Delivery log for an endpoint (latest 50)",
        "parameters": [
          {
            "$ref": "#/components/parameters/WebhookId"
          },
          {
            "$ref": "#/components/parameters/Limit"
          },
          {
            "$ref": "#/components/parameters/Cursor"
          }
        ],
        "responses": {
          "200": {
            "description": "Cursor page of delivery attempts.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookDeliveryPage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/webhooks/deliveries/{id}/replay": {
      "post": {
        "operationId": "replayWebhookDelivery",
        "summary": "Requeue a delivery now (works on dead-lettered ones)",
        "parameters": [
          {
            "$ref": "#/components/parameters/DeliveryId"
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Requeued.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "replayed"
                  ],
                  "properties": {
                    "replayed": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            },
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          }
        },
        "tags": [
          "Webhooks"
        ]
      }
    },
    "/v1/voices/imports": {
      "post": {
        "operationId": "startVoiceImport",
        "summary": "Create a private voice and obtain upload URLs",
        "description": "Requires an admin API key explicitly granted voices:import. PUT raw bytes to each returned URL within 15 minutes, with If-None-Match: * on each PUT. Send Content-Type: application/zip for the model and application/octet-stream for the preview. Omit x-amz-copy-source. The ZIP (up to 500 MiB) contains only model.pth (torch.save) and optional model.index (FAISS) at its root. Rename Applio files before uploading. Send the declared Content-Length on each PUT. Use a protocol-2 torch.save checkpoint with data.pkl up to 2 MiB. Use STORE or DEFLATE, without ZIP64, comments or data descriptors. Each entry may expand to 1 GiB. DEFLATE entries over 1 MiB expanded must stay within 20:1.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoiceImportRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Upload URLs issued.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceImportCreated"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          },
          "503": {
            "description": "Voice imports are disabled (import_unavailable, retryable=false).",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "tags": [
          "Voices"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ]
      }
    },
    "/v1/voices/imports/{voice_id}/complete": {
      "post": {
        "operationId": "completeVoiceImport",
        "summary": "Validate uploads and make the voice ready for swaps",
        "description": "Requires an admin API key explicitly granted voices:import. Send after all PUTs finish. Invalid uploads return 400 and retain a failed status with the reason. Repeated completion returns the terminal outcome.",
        "parameters": [
          {
            "name": "voice_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/VoiceId"
            }
          },
          {
            "$ref": "#/components/parameters/IdempotencyKey"
          }
        ],
        "responses": {
          "200": {
            "description": "Private voice ready.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceImportReady"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          },
          "503": {
            "description": "Voice imports are disabled (import_unavailable, retryable=false).",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "tags": [
          "Voices"
        ]
      }
    },
    "/v1/voices/imports/{voice_id}": {
      "get": {
        "operationId": "getVoiceImport",
        "summary": "Read a voice import's status",
        "description": "Requires an admin API key explicitly granted voices:import.",
        "parameters": [
          {
            "name": "voice_id",
            "in": "path",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/VoiceId"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current import status.",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VoiceImportStatus"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/InputInvalid"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Internal"
          },
          "503": {
            "description": "Voice imports are disabled (import_unavailable, retryable=false).",
            "headers": {
              "RateLimit-Limit": {
                "$ref": "#/components/headers/RateLimitLimit"
              },
              "RateLimit-Remaining": {
                "$ref": "#/components/headers/RateLimitRemaining"
              },
              "RateLimit-Reset": {
                "$ref": "#/components/headers/RateLimitReset"
              },
              "RateLimit-Policy": {
                "$ref": "#/components/headers/RateLimitPolicy"
              }
            },
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "tags": [
          "Voices"
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "vsk_<64 hex chars>",
        "description": "Scoped API key. Stored hashed; shown once at creation/rotation. Out-of-scope requests are 403 and never billed."
      }
    },
    "parameters": {
      "JobId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/JobId"
        }
      },
      "UploadId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/UploadId"
        },
        "description": "upload_id from the initiate call."
      },
      "WebhookId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/WebhookEndpointId"
        }
      },
      "DeliveryId": {
        "name": "id",
        "in": "path",
        "required": true,
        "schema": {
          "$ref": "#/components/schemas/WebhookDeliveryId"
        }
      },
      "IdempotencyKey": {
        "name": "Idempotency-Key",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255,
          "pattern": "^[\\x20-\\x7E]+$"
        },
        "description": "Recommended UUIDv4/ULID; never include secrets. For 24 hours, the same key and parameters replay the stored status/body/selected headers with Idempotency-Replayed: true; different parameters return 409. An abandoned execution lease is recoverable after 60 seconds. Validation failures are not retained."
      },
      "Limit": {
        "name": "limit",
        "in": "query",
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100,
          "default": 25
        },
        "description": "Page size (1–100; default 25)."
      },
      "Cursor": {
        "name": "cursor",
        "in": "query",
        "schema": {
          "type": "string"
        },
        "description": "Opaque next_cursor from the previous page."
      },
      "IfNoneMatch": {
        "name": "If-None-Match",
        "in": "header",
        "schema": {
          "type": "string"
        },
        "description": "Job ETag; a match returns 304 without a body."
      },
      "ContentDigest": {
        "name": "Content-Digest",
        "in": "header",
        "required": false,
        "schema": {
          "type": "string"
        },
        "description": "Required when Idempotency-Key is used for a direct binary upload; fingerprint of the request bytes."
      },
      "RightsAttestationHeader": {
        "name": "x-voiceswap-rights-attestation",
        "in": "header",
        "required": true,
        "schema": {
          "type": "string",
          "const": "true"
        },
        "description": "Must be literal true. Confirms the caller owns or has all permissions required to upload and process this conversion source. The server records immutable evidence under the current versioned Voice Rights Attestation."
      }
    },
    "schemas": {
      "AudioFormat": {
        "type": "string",
        "enum": [
          "wav",
          "mp3",
          "flac"
        ]
      },
      "ErrorCode": {
        "type": "string",
        "description": "Failure-taxonomy machine code. No class bills — failed and refused calls are free.",
        "enum": [
          "unauthorized",
          "forbidden",
          "insufficient_scope",
          "not_found",
          "conflict",
          "payment_required",
          "payments_disabled",
          "import_unavailable",
          "service_unavailable",
          "rate_limited",
          "queue_full",
          "input_invalid",
          "separation_failed",
          "voice_not_found",
          "safety_disabled",
          "oom_retry",
          "timeout",
          "quality_reject",
          "provider_rate_limited",
          "provider_rejected",
          "provider_auth_failed",
          "provider_degraded",
          "webhook_destination_blocked",
          "internal",
          "not_implemented"
        ]
      },
      "Error": {
        "type": "object",
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "instance",
          "code",
          "request_id",
          "retryable"
        ],
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://voiceswap\\.dev/docs/errors#[a-z_]+$"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          },
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "request_id": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          },
          "error": {
            "type": "object",
            "deprecated": true,
            "description": "Temporary compatibility extension; use top-level code/detail.",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "$ref": "#/components/schemas/ErrorCode"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      },
      "JobInput": {
        "type": "object",
        "description": "Provide upload_id or r2_key — an upload owned by the calling workspace whose object already exists. If both fields are present, upload_id takes precedence and r2_key is ignored.",
        "properties": {
          "upload_id": {
            "$ref": "#/components/schemas/UploadId",
            "description": "Typed upload id returned by an upload creation operation."
          },
          "r2_key": {
            "type": "string"
          }
        }
      },
      "CreateJobBase": {
        "type": "object",
        "properties": {
          "input": {
            "$ref": "#/components/schemas/JobInput"
          },
          "format": {
            "$ref": "#/components/schemas/AudioFormat",
            "default": "wav"
          },
          "duration_hint_seconds": {
            "type": "number",
            "exclusiveMinimum": 0,
            "maximum": 1800,
            "description": "Sizes the temporary credit hold only — any number greater than 0 up to 1800; fractions allowed, the hold rounds up to whole seconds. It can only enlarge the hold (floored by upload byte size). Ignored when a workspace spend cap (including the first-week ceiling) or a key minute/spend cap applies: the hold is then the 1800-second job maximum. Billing always uses the server-measured duration."
          }
        }
      },
      "SwapParams": {
        "type": "object",
        "properties": {
          "pitch": {
            "type": "integer",
            "minimum": -24,
            "maximum": 24,
            "default": 0,
            "description": "Semitone shift applied at conversion. Validated on the processing engine, not at the POST: an out-of-range or non-integer value is accepted with 202 and the job then fails with input_invalid (never billed)."
          },
          "preserve_timing": {
            "type": "boolean",
            "default": true,
            "description": "Currently NO effect — conversion is always frame-exact (timing is always preserved). Accepted for forward compatibility only."
          },
          "denoise": {
            "type": "boolean",
            "default": false,
            "description": "Applied only when the input is classified as speech (separation-bypass path); ignored for music mixes, which go through separation instead."
          }
        }
      },
      "SeparateParams": {
        "type": "object",
        "properties": {
          "denoise": {
            "type": "boolean",
            "default": false,
            "description": "Applied only when the input is classified as speech (separation-bypass path); ignored for music mixes, which go through separation instead."
          }
        }
      },
      "JobStatus": {
        "type": "string",
        "enum": [
          "queued",
          "processing",
          "succeeded",
          "failed",
          "cancelled"
        ],
        "description": "queued → processing → succeeded|failed; queued|processing may transition to cancelled."
      },
      "Job": {
        "type": "object",
        "required": [
          "id",
          "status",
          "endpoint",
          "voice_id",
          "format",
          "input_duration_seconds",
          "billed_duration_seconds",
          "failure",
          "created_at",
          "updated_at",
          "finished_at",
          "output_available",
          "status_url",
          "links"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/JobId"
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus"
          },
          "endpoint": {
            "type": "string",
            "enum": [
              "swap",
              "vocals",
              "instrumental"
            ]
          },
          "voice_id": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/VoiceId"
              },
              {
                "type": "null"
              }
            ]
          },
          "format": {
            "$ref": "#/components/schemas/AudioFormat"
          },
          "input_duration_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "billed_duration_seconds": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0
          },
          "failure": {
            "$ref": "#/components/schemas/JobFailure"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "output_available": {
            "type": "boolean"
          },
          "status_url": {
            "type": "string"
          },
          "links": {
            "type": "object",
            "required": [
              "self",
              "result"
            ],
            "properties": {
              "self": {
                "type": "string"
              },
              "result": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "Voice": {
        "type": "object",
        "required": [
          "id",
          "name",
          "status",
          "kind",
          "best_for",
          "library",
          "created_at",
          "preview_url"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/VoiceId"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "Only \"ready\" voices are usable in /v1/swap."
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "best_for": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "library": {
            "type": "boolean",
            "description": "True for published library voices; false for this workspace's own."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "preview_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Private samples have a five-minute signed GET URL. Bundled public demos use their asset URL. Null when no sample exists."
          }
        }
      },
      "Scopes": {
        "type": "object",
        "properties": {
          "endpoints": {
            "oneOf": [
              {
                "type": "string",
                "const": "all"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "voices": {
            "oneOf": [
              {
                "type": "string",
                "const": "all"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/VoiceId"
                }
              }
            ]
          }
        },
        "required": [
          "endpoints",
          "voices"
        ]
      },
      "WebhookEventType": {
        "type": "string",
        "enum": [
          "job.succeeded",
          "job.failed",
          "job.cancelled",
          "voice.ready",
          "voice.failed",
          "workspace.spend_alert",
          "workspace.payment_failed",
          "workspace.payment_method_saved",
          "workspace.topup_succeeded",
          "workspace.clone_paid",
          "workspace.refund_issued",
          "workspace.dispute_created"
        ],
        "description": "All event types implemented by the v1 event store. Consumers must ignore unknown future types."
      },
      "WebhookEndpoint": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/WebhookEndpointId"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "event_types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEventType"
            },
            "description": "Default: [\"job.succeeded\", \"job.failed\", \"job.cancelled\"]."
          },
          "active": {
            "type": "boolean"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "url",
          "event_types",
          "active",
          "created_at"
        ]
      },
      "WebhookDelivery": {
        "type": "object",
        "description": "Deliveries POST {id, type, created_at, data}, signed via vs-signature: t=<ts>,v1=<hex hmac_sha256(secret, \"<t>.<raw_body>\")> plus vs-event-type / vs-event-id / vs-delivery-id headers. At-least-once; retries 1m/5m/30m/2h/8h then dead-letter.",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/WebhookDeliveryId"
          },
          "event_id": {
            "$ref": "#/components/schemas/EventId"
          },
          "type": {
            "$ref": "#/components/schemas/WebhookEventType"
          },
          "attempt": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "failed",
              "succeeded",
              "dead"
            ]
          },
          "last_response_status": {
            "type": [
              "integer",
              "null"
            ]
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "next_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "delivered_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "event_id",
          "type",
          "attempt",
          "status",
          "last_response_status",
          "last_error",
          "next_attempt_at",
          "delivered_at",
          "created_at"
        ]
      },
      "HealthReport": {
        "type": "object",
        "required": [
          "status",
          "environment",
          "checked_at",
          "components"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "degraded"
            ]
          },
          "environment": {
            "type": "string"
          },
          "checked_at": {
            "type": "string",
            "format": "date-time"
          },
          "components": {
            "type": "object",
            "required": [
              "database",
              "gpu",
              "runpod_balance",
              "webhook_delivery",
              "reconciliation",
              "imports",
              "clerk_webhook"
            ],
            "properties": {
              "database": {
                "type": "object"
              },
              "gpu": {
                "type": "object"
              },
              "runpod_balance": {
                "type": "object"
              },
              "gpu_capacity": {
                "type": "object",
                "description": "RunPod idle scale-down guard: live endpoint workersMax vs the expected value. status ok | degraded (workersMax below expected; turns the aggregate degraded) | unknown (read failed or no expected value; advisory)."
              },
              "webhook_delivery": {
                "type": "object"
              },
              "reconciliation": {
                "type": "object"
              },
              "imports": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "enabled",
                      "disabled"
                    ]
                  }
                }
              },
              "clerk_webhook": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "enabled",
                      "disabled"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "JobFailure": {
        "type": [
          "object",
          "null"
        ],
        "required": [
          "code",
          "detail",
          "retryable"
        ],
        "properties": {
          "code": {
            "$ref": "#/components/schemas/ErrorCode"
          },
          "detail": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean"
          }
        }
      },
      "VoicePage": {
        "type": "object",
        "required": [
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Voice"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "WebhookEndpointPage": {
        "type": "object",
        "required": [
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookEndpoint"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "WebhookDeliveryPage": {
        "type": "object",
        "required": [
          "data",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WebhookDelivery"
            }
          },
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JobId": {
        "type": "string",
        "pattern": "^job_[0-9a-f-]{36}$"
      },
      "VoiceId": {
        "type": "string",
        "pattern": "^voice_[0-9a-f-]{36}$"
      },
      "UploadId": {
        "type": "string",
        "pattern": "^upl_[0-9a-f-]{36}$"
      },
      "WebhookEndpointId": {
        "type": "string",
        "pattern": "^whe_[0-9a-f-]{36}$"
      },
      "WebhookDeliveryId": {
        "type": "string",
        "pattern": "^whd_[0-9a-f-]{36}$"
      },
      "EventId": {
        "type": "string",
        "pattern": "^evt_[0-9a-f-]{36}$"
      },
      "WorkspaceId": {
        "type": "string",
        "pattern": "^ws_[0-9a-f-]{36}$"
      },
      "ApiKeyId": {
        "type": "string",
        "pattern": "^key_[0-9a-f-]{36}$"
      },
      "JobSucceededWebhookEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/EventId"
          },
          "type": {
            "type": "string",
            "const": "job.succeeded"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "job",
              "billing"
            ],
            "properties": {
              "job": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Job"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "status": {
                        "const": "succeeded"
                      }
                    }
                  }
                ]
              },
              "billing": {
                "type": "object",
                "required": [
                  "amount",
                  "currency"
                ],
                "properties": {
                  "amount": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "currency": {
                    "type": "string",
                    "const": "usd"
                  }
                }
              }
            }
          }
        }
      },
      "JobFailedWebhookEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/EventId"
          },
          "type": {
            "type": "string",
            "const": "job.failed"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "job"
            ],
            "properties": {
              "job": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Job"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "status": {
                        "const": "failed"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      },
      "JobCancelledWebhookEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/EventId"
          },
          "type": {
            "type": "string",
            "const": "job.cancelled"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object",
            "required": [
              "job"
            ],
            "properties": {
              "job": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/Job"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "status": {
                        "const": "cancelled"
                      }
                    }
                  }
                ]
              }
            }
          }
        }
      },
      "OtherWebhookEvent": {
        "type": "object",
        "required": [
          "id",
          "type",
          "created_at",
          "data"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/EventId"
          },
          "type": {
            "type": "string",
            "enum": [
              "voice.ready",
              "voice.failed",
              "workspace.spend_alert",
              "workspace.payment_failed",
              "workspace.payment_method_saved",
              "workspace.topup_succeeded",
              "workspace.clone_paid",
              "workspace.refund_issued",
              "workspace.dispute_created"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "data": {
            "type": "object"
          }
        }
      },
      "WebhookEvent": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/JobSucceededWebhookEvent"
          },
          {
            "$ref": "#/components/schemas/JobFailedWebhookEvent"
          },
          {
            "$ref": "#/components/schemas/JobCancelledWebhookEvent"
          },
          {
            "$ref": "#/components/schemas/OtherWebhookEvent"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "job.succeeded": "#/components/schemas/JobSucceededWebhookEvent",
            "job.failed": "#/components/schemas/JobFailedWebhookEvent",
            "job.cancelled": "#/components/schemas/JobCancelledWebhookEvent",
            "voice.ready": "#/components/schemas/OtherWebhookEvent",
            "voice.failed": "#/components/schemas/OtherWebhookEvent",
            "workspace.spend_alert": "#/components/schemas/OtherWebhookEvent",
            "workspace.payment_failed": "#/components/schemas/OtherWebhookEvent",
            "workspace.payment_method_saved": "#/components/schemas/OtherWebhookEvent",
            "workspace.topup_succeeded": "#/components/schemas/OtherWebhookEvent",
            "workspace.clone_paid": "#/components/schemas/OtherWebhookEvent",
            "workspace.refund_issued": "#/components/schemas/OtherWebhookEvent",
            "workspace.dispute_created": "#/components/schemas/OtherWebhookEvent"
          }
        }
      },
      "RightsAttestation": {
        "type": "boolean",
        "const": true,
        "description": "Must be literal true. Confirms the caller owns or has all permissions required to upload and process this conversion source. The server records immutable evidence under the current versioned Voice Rights Attestation."
      },
      "VoiceImportRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "rights_attestation": {
            "type": "boolean",
            "const": true
          },
          "rights_basis": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000,
            "description": "Describe your ownership or permission to use this voice model."
          },
          "model_size_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 524288000,
            "description": "Exact byte length of the ZIP."
          },
          "sample_size_bytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20971520,
            "description": "Exact preview byte length. Supply only when sample is true."
          },
          "sample": {
            "type": "boolean",
            "description": "Request a preview upload URL for WAV, MP3 or FLAC up to 20 MiB."
          }
        },
        "required": [
          "name",
          "rights_attestation",
          "rights_basis",
          "sample",
          "model_size_bytes"
        ],
        "if": {
          "properties": {
            "sample": {
              "const": true
            }
          }
        },
        "then": {
          "required": [
            "sample_size_bytes"
          ]
        },
        "else": {
          "not": {
            "required": [
              "sample_size_bytes"
            ]
          }
        },
        "additionalProperties": false
      },
      "VoiceImportCreated": {
        "type": "object",
        "properties": {
          "voice_id": {
            "$ref": "#/components/schemas/VoiceId"
          },
          "status": {
            "const": "importing"
          },
          "model_put_url": {
            "type": "string",
            "format": "uri"
          },
          "sample_put_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "voice_id",
          "status",
          "model_put_url",
          "sample_put_url",
          "expires_at"
        ]
      },
      "VoiceImportReady": {
        "type": "object",
        "properties": {
          "voice_id": {
            "$ref": "#/components/schemas/VoiceId"
          },
          "status": {
            "const": "ready"
          }
        },
        "required": [
          "voice_id",
          "status"
        ]
      },
      "VoiceImportStatus": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "voice_id": {
                "$ref": "#/components/schemas/VoiceId"
              },
              "status": {
                "const": "importing"
              }
            },
            "required": [
              "voice_id",
              "status"
            ]
          },
          {
            "$ref": "#/components/schemas/VoiceImportReady"
          },
          {
            "type": "object",
            "properties": {
              "voice_id": {
                "$ref": "#/components/schemas/VoiceId"
              },
              "status": {
                "const": "failed"
              },
              "reason": {
                "type": "string"
              }
            },
            "required": [
              "voice_id",
              "status",
              "reason"
            ]
          }
        ]
      }
    },
    "responses": {
      "JobAccepted": {
        "description": "Durably accepted. Poll Location using Retry-After and If-None-Match.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "Location": {
            "schema": {
              "type": "string"
            }
          },
          "Retry-After": {
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          },
          "Idempotency-Replayed": {
            "schema": {
              "type": "string",
              "enum": [
                "true"
              ]
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Job"
            }
          }
        }
      },
      "InputInvalid": {
        "description": "Invalid or malformed request. Validation failures are not retained for idempotency.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing, invalid, or revoked bearer token. RateLimit fields are omitted until a credential resolves to a real quota bucket.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            },
            "description": "A bare Bearer challenge for a missing credential; invalid_token only when a credential was presented and rejected."
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "Payment method or account action required.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found (including tenant-hidden resources).",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Conflict": {
        "description": "State conflict or idempotency-key parameter mismatch.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate, spend, or monthly limit reached (queue_full only under an operator-configured per-workspace concurrency cap; none by default).",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "Retry-After": {
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Valid key refused with code insufficient_scope because it lacks endpoint or voice scope.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          },
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Internal": {
        "description": "Safe internal failure; private diagnostics are logged under request_id.",
        "headers": {
          "RateLimit-Limit": {
            "$ref": "#/components/headers/RateLimitLimit"
          },
          "RateLimit-Remaining": {
            "$ref": "#/components/headers/RateLimitRemaining"
          },
          "RateLimit-Reset": {
            "$ref": "#/components/headers/RateLimitReset"
          },
          "RateLimit-Policy": {
            "$ref": "#/components/headers/RateLimitPolicy"
          }
        },
        "content": {
          "application/problem+json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "headers": {
      "RateLimitLimit": {
        "description": "Requests allowed in the current 60-second policy window.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "RateLimitRemaining": {
        "description": "Requests remaining in the current window.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "RateLimitReset": {
        "description": "Seconds until capacity is fully restored.",
        "schema": {
          "type": "integer",
          "minimum": 0
        }
      },
      "RateLimitPolicy": {
        "description": "IETF-style quota policy; `<limit>;w=60`.",
        "schema": {
          "type": "string"
        }
      }
    }
  },
  "tags": [
    {
      "name": "System"
    },
    {
      "name": "Jobs"
    },
    {
      "name": "Voices"
    },
    {
      "name": "Uploads"
    },
    {
      "name": "Webhooks"
    }
  ],
  "webhooks": {
    "customerEvent": {
      "post": {
        "summary": "Signed, at-least-once customer event delivery",
        "description": "Verify `VS-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, `${t}.${raw_body}`)>` against the raw body, reject timestamps older than five minutes, and deduplicate by event id. Redirects are rejected. Non-2xx/network failures retry after 1m, 5m, 30m, 2h, and 8h, then enter dead-letter; replay resets the attempt schedule.",
        "parameters": [
          {
            "name": "VS-Signature",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "VS-Event-Type",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "VS-Event-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "VS-Delivery-Id",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookEvent"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Any 2xx acknowledges delivery."
          }
        }
      }
    }
  }
}
