{
  "openapi": "3.1.0",
  "info": {
    "title": "Convertr API",
    "version": "1.0.0",
    "summary": "Convert files between more than 800 format pairs with one HTTP call.",
    "description": "The Convertr API converts documents, images, audio, video, ebooks, fonts, archives and data files between more than 800 format pairs. It is the same engine as https://convertr.org.\n\n## Quick start\n\n1. Sign in at https://convertr.org, verify your email and create an API key on the **API** page.\n2. Send a file and wait for the result:\n\n```bash\ncurl -X POST \"https://convertr.org/api/v1/conversions?wait=60\" \\\n  -H \"Authorization: Bearer cvk_YOUR_KEY\" \\\n  -F output_format=jpg \\\n  -F file=@photo.png\n```\n\n3. Download the file from `output.download_url` in the answer. The link is valid for 24 hours.\n\nTo convert a file that is already online, send JSON instead:\n\n```bash\ncurl -X POST \"https://convertr.org/api/v1/conversions?wait=60\" \\\n  -H \"Authorization: Bearer cvk_YOUR_KEY\" -H \"Content-Type: application/json\" \\\n  -d '{\"url\":\"https://example.com/clip.mp4\",\"output_format\":\"mp3\"}'\n```\n\n## Authentication\n\nSend the key as `Authorization: Bearer cvk_...` or as `X-API-Key: cvk_...`. Keys start with `cvk_`. The full key is shown once when you create it. Revoke a key at any time on the API page. The format endpoints and this document need no key.\n\n## Credits and pricing\n\n- One credit pays for one conversion of an input up to 100 MB. Each further started 100 MB costs one more credit.\n- The free plan gives 100 credits per calendar month (UTC) and inputs up to 100 MB. It needs a verified email.\n- Paid credits come in packs, are valid for 12 months and are used after the free credits, oldest expiry first. With paid credits the input limit is 1 GB.\n- A file sent in the request body can be at most 100 MB, because of the network in front of the API. Send larger files (up to 1 GB) as a `url`. The server must deliver a `url` file within 75 seconds, on port 80 or 443.\n- Credits are charged when the input is stored, before the conversion starts. A failed conversion is refunded automatically. Deleting a finished conversion does not refund it.\n- Check your balance with `GET /account` and the ledger with `GET /usage`.\n\n## Uploads with curl and multipart\n\nThe server picks a worker from `output_format` (and `input_format` or the file name) **before** it reads the file, so these must arrive before the file part. `curl -F` keeps the order you write, so put `-F output_format=...` before `-F file=@...`. Other clients can send `output_format` and `input_format` as query parameters instead. Fields after the file part are ignored. If the format is not known before the file part, the API answers 422.\n\n## Errors\n\nErrors have this shape: `{\"error\":{\"code\":\"insufficient_credits\",\"message\":\"...\"}}`. Match on `code`, not on the message. The status codes are 401 `invalid_api_key`, 402 `insufficient_credits`, 403 `email_not_verified`, 404 `not_found`, 413 `file_too_large`, 415 `unsupported_conversion`, 422 `validation_failed`, 429 `rate_limited` (with a `Retry-After` header), 503 `no_worker_available` and 500 `internal_error`.\n\n## Rate limits\n\nEach key may create 60 conversions per minute and make 600 other requests per minute. Over the limit the API answers 429 with `Retry-After` (seconds).\n\n## Files and privacy\n\nInput and output files are deleted after 24 hours. Call `DELETE /conversions/{id}` to delete them at once. The `download_url` points at the worker that did the conversion, so it can be on another host than the API.\n\n## Browser use\n\nAll `/api/v1` endpoints answer CORS for any origin and never use cookies. Do not put your key into a public web page.",
    "contact": {
      "name": "Convertr",
      "url": "https://convertr.org"
    }
  },
  "servers": [
    {
      "url": "https://convertr.org/api/v1",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Conversions",
      "description": "Create a conversion, read its state, delete its files."
    },
    {
      "name": "Formats",
      "description": "Which conversions are available. No API key needed."
    },
    {
      "name": "Account",
      "description": "Plan, credits and usage."
    },
    {
      "name": "Reference",
      "description": "This document."
    }
  ],
  "paths": {
    "/formats": {
      "get": {
        "tags": [
          "Formats"
        ],
        "operationId": "listFormats",
        "security": [],
        "summary": "List all input formats and the outputs they convert to",
        "description": "Returns every input format with the output formats the API can run right now. Formats whose workers are down are left out. Public: no API key needed. Cached for 60 seconds.",
        "responses": {
          "200": {
            "description": "The formats.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/FormatEntry"
                      }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "input": "mp4",
                      "outputs": [
                        {
                          "format": "mp3",
                          "group": "Audio"
                        },
                        {
                          "format": "webm",
                          "group": "Video"
                        }
                      ]
                    },
                    {
                      "input": "png",
                      "outputs": [
                        {
                          "format": "jpg",
                          "group": "Image"
                        },
                        {
                          "format": "pdf",
                          "group": "Document"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/formats/{input}": {
      "get": {
        "tags": [
          "Formats"
        ],
        "operationId": "getFormat",
        "security": [],
        "summary": "List the outputs of one input format",
        "description": "Returns the output formats the API can run for one input format. Answers 404 for a format with no available conversions. Public: no API key needed.",
        "parameters": [
          {
            "name": "input",
            "in": "path",
            "required": true,
            "description": "Input format, for example `mp4`.",
            "schema": {
              "type": "string"
            },
            "example": "mp4"
          }
        ],
        "responses": {
          "200": {
            "description": "The outputs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FormatEntry"
                },
                "example": {
                  "input": "mp4",
                  "outputs": [
                    {
                      "format": "mp3",
                      "group": "Audio"
                    },
                    {
                      "format": "webm",
                      "group": "Video"
                    }
                  ]
                }
              }
            }
          },
          "404": {
            "description": "No conversions from this format.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "There are no conversions from this format. See GET /api/v1/formats for the supported formats."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/conversions": {
      "post": {
        "tags": [
          "Conversions"
        ],
        "operationId": "createConversion",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "Create a conversion",
        "description": "Converts an uploaded file (`multipart/form-data`) or a file at a public URL (`application/json`). The answer is the Conversion object: 201 while it runs, or 200 when `wait` ended in a final state.\n\n**Multipart:** send `output_format` (required) before the `file` part, or as a query parameter. `input_format` is optional and defaults to the file extension. `settings` is an optional JSON object as a string. Settings depend on the conversion, for example `{\"audio_bitrate\":\"192k\"}` for audio; they are checked like on the web converter.\n\n**URL:** the server downloads the URL itself. Only public `http` and `https` addresses work (no private or internal addresses, at most 5 redirects). The file name comes from the `filename` field, the `Content-Disposition` header or the URL path. If the URL has no file extension, also send `input_format`.\n\nThe input must not exceed the limit of your plan (100 MB on the free plan, 1 GB with paid credits). Credits are charged when the input is stored. Without enough credits the API answers 402 and nothing is converted.",
        "parameters": [
          {
            "name": "wait",
            "in": "query",
            "required": false,
            "description": "Long-poll: keep the request open for up to this many seconds (0 to 90, default 0) until the conversion has finished. If it has not finished by then, the current state is returned and you can poll again.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 90,
              "default": 0
            },
            "example": 60
          },
          {
            "name": "output_format",
            "in": "query",
            "required": false,
            "description": "Alternative to the body field `output_format`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "input_format",
            "in": "query",
            "required": false,
            "description": "Alternative to the body field `input_format`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Convertr-Client",
            "in": "header",
            "required": false,
            "description": "Optional. Names the product that calls the API, for statistics. One of `api`, `mcp`, `rapidapi`, `apify`. Other values count as `api`.",
            "schema": {
              "type": "string",
              "enum": [
                "api",
                "mcp",
                "rapidapi",
                "apify"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "output_format",
                  "file"
                ],
                "properties": {
                  "output_format": {
                    "type": "string",
                    "description": "Target format, for example `jpg`. Send it before `file`.",
                    "examples": [
                      "jpg"
                    ]
                  },
                  "input_format": {
                    "type": "string",
                    "description": "Source format. Default: the file extension. Send it before `file`."
                  },
                  "settings": {
                    "type": "string",
                    "description": "Optional JSON object as a string, for example `{\"audio_bitrate\":\"192k\"}`. Send it before `file`."
                  },
                  "file": {
                    "type": "string",
                    "contentMediaType": "application/octet-stream",
                    "description": "The file to convert. Must be the last part."
                  }
                }
              },
              "encoding": {
                "file": {
                  "contentType": "application/octet-stream"
                }
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateFromURL"
              },
              "examples": {
                "mp4_to_mp3": {
                  "summary": "Extract audio from a video",
                  "value": {
                    "url": "https://example.com/clip.mp4",
                    "output_format": "mp3"
                  }
                },
                "with_settings": {
                  "summary": "With input format, file name and settings",
                  "value": {
                    "url": "https://example.com/download?id=7",
                    "input_format": "wav",
                    "filename": "voice.wav",
                    "output_format": "mp3",
                    "settings": {
                      "audio_bitrate": "128k"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The conversion was created and is running (or `wait` was not used).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Conversion"
                },
                "example": {
                  "id": "k3x9q2m7p1a8z4c6",
                  "status": "processing",
                  "progress": 42,
                  "input": {
                    "filename": "photo.png",
                    "format": "png",
                    "size_bytes": 482113
                  },
                  "output": null,
                  "credits_charged": 1,
                  "error": null,
                  "created_at": "2026-10-29T10:15:02Z",
                  "finished_at": null
                }
              }
            }
          },
          "200": {
            "description": "The conversion ended within `wait` seconds. The status is `succeeded` or `failed`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Conversion"
                },
                "example": {
                  "id": "k3x9q2m7p1a8z4c6",
                  "status": "succeeded",
                  "progress": 100,
                  "input": {
                    "filename": "photo.png",
                    "format": "png",
                    "size_bytes": 482113
                  },
                  "output": {
                    "filename": "photo.jpg",
                    "format": "jpg",
                    "size_bytes": 96211,
                    "download_url": "https://gw1.convertr.org/api/download/k3x9q2m7p1a8z4c6/photo.jpg/file?created_at=2026-10-29T10%3A15%3A02.123456Z&expires=1782900902&signature=3f1c0a9e",
                    "expires_at": "2026-10-30T10:15:02Z"
                  },
                  "credits_charged": 1,
                  "error": null,
                  "created_at": "2026-10-29T10:15:02Z",
                  "finished_at": "2026-10-29T10:15:04Z"
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, wrong or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_api_key",
                    "message": "The API key is not valid. It may have been revoked."
                  }
                }
              }
            }
          },
          "402": {
            "description": "Not enough credits.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "insufficient_credits",
                    "message": "Not enough credits for this conversion. Buy credits, or wait until your free credits reset next month."
                  }
                }
              }
            }
          },
          "403": {
            "description": "The email address of the account is not verified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "email_not_verified",
                    "message": "Verify your email address on convertr.org to use the API."
                  }
                }
              }
            }
          },
          "413": {
            "description": "The input is larger than the limit of the plan.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "file_too_large",
                    "message": "The input is larger than the 100 MB limit of your plan. Buy credits to convert files up to 1 GB."
                  }
                }
              }
            }
          },
          "415": {
            "description": "The pair of formats is not supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "unsupported_conversion",
                    "message": "This conversion is not supported. See GET /api/v1/formats for the supported pairs."
                  }
                }
              }
            }
          },
          "422": {
            "description": "The request is not valid: missing field, unknown settings, a URL that cannot be fetched.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation_failed",
                    "message": "The 'output_format' is required. In a multipart body send it before the 'file' part, or put it in the query string (?output_format=jpg)."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests for this API key. Wait until the time in the Retry-After header and try again."
                  }
                }
              }
            }
          },
          "503": {
            "description": "No worker can run this conversion right now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "no_worker_available",
                    "message": "No worker is available for this conversion right now. Please try again in a moment."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/conversions/{id}": {
      "get": {
        "tags": [
          "Conversions"
        ],
        "operationId": "getConversion",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "Get a conversion",
        "description": "Returns the state of one of your conversions. Use `wait` to long-poll until it has finished. When it has succeeded, download the file from `output.download_url` (valid for 24 hours). Conversions of other accounts look like missing ones (404).",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The conversion ID.",
            "schema": {
              "type": "string"
            },
            "example": "k3x9q2m7p1a8z4c6"
          },
          {
            "name": "wait",
            "in": "query",
            "required": false,
            "description": "Long-poll: keep the request open for up to this many seconds (0 to 90, default 0) until the conversion has finished. If it has not finished by then, the current state is returned and you can poll again.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 90,
              "default": 0
            },
            "example": 60
          }
        ],
        "responses": {
          "200": {
            "description": "The conversion.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Conversion"
                },
                "examples": {
                  "processing": {
                    "summary": "Still running",
                    "value": {
                      "id": "k3x9q2m7p1a8z4c6",
                      "status": "processing",
                      "progress": 42,
                      "input": {
                        "filename": "photo.png",
                        "format": "png",
                        "size_bytes": 482113
                      },
                      "output": null,
                      "credits_charged": 1,
                      "error": null,
                      "created_at": "2026-10-29T10:15:02Z",
                      "finished_at": null
                    }
                  },
                  "succeeded": {
                    "summary": "Finished",
                    "value": {
                      "id": "k3x9q2m7p1a8z4c6",
                      "status": "succeeded",
                      "progress": 100,
                      "input": {
                        "filename": "photo.png",
                        "format": "png",
                        "size_bytes": 482113
                      },
                      "output": {
                        "filename": "photo.jpg",
                        "format": "jpg",
                        "size_bytes": 96211,
                        "download_url": "https://gw1.convertr.org/api/download/k3x9q2m7p1a8z4c6/photo.jpg/file?created_at=2026-10-29T10%3A15%3A02.123456Z&expires=1782900902&signature=3f1c0a9e",
                        "expires_at": "2026-10-30T10:15:02Z"
                      },
                      "credits_charged": 1,
                      "error": null,
                      "created_at": "2026-10-29T10:15:02Z",
                      "finished_at": "2026-10-29T10:15:04Z"
                    }
                  },
                  "failed": {
                    "summary": "Failed (credits are refunded)",
                    "value": {
                      "id": "k3x9q2m7p1a8z4c6",
                      "status": "failed",
                      "progress": 0,
                      "input": {
                        "filename": "broken.png",
                        "format": "png",
                        "size_bytes": 1024
                      },
                      "output": null,
                      "credits_charged": 0,
                      "error": {
                        "code": "invalid_input",
                        "message": "The input file is damaged or not a valid file of the input format."
                      },
                      "created_at": "2026-10-29T10:15:02Z",
                      "finished_at": "2026-10-29T10:15:03Z"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, wrong or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_api_key",
                    "message": "The API key is not valid. It may have been revoked."
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such conversion on your account (or it was deleted or is older than 24 hours).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "There is no conversion with this ID on your account."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests for this key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "rate_limited",
                    "message": "Too many requests for this API key. Wait until the time in the Retry-After header and try again."
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Conversions"
        ],
        "operationId": "deleteConversion",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "Delete a conversion",
        "description": "Deletes the input and output files of a finished conversion now, instead of after 24 hours. Deleting does not refund credits. A conversion that is still running answers 409 `conversion_not_finished`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The conversion ID.",
            "schema": {
              "type": "string"
            },
            "example": "k3x9q2m7p1a8z4c6"
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted."
          },
          "401": {
            "description": "The API key is missing, wrong or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_api_key",
                    "message": "The API key is not valid. It may have been revoked."
                  }
                }
              }
            }
          },
          "404": {
            "description": "No such conversion on your account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "not_found",
                    "message": "There is no conversion with this ID on your account."
                  }
                }
              }
            }
          },
          "409": {
            "description": "The conversion is still running.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "conversion_not_finished",
                    "message": "The conversion is still running. Delete it after it has finished."
                  }
                }
              }
            }
          },
          "503": {
            "description": "The worker that holds the files is not available.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "no_worker_available",
                    "message": "The worker that holds this conversion is not available. Please try again later."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/account": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "getAccount",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "Get plan, credits and limits",
        "description": "Returns your plan (`free`, `paid` or `unmetered`), the monthly free credits, the paid credit lots and the largest input you may convert. `balance` counts only paid credits that have not expired; free credits are in `free.remaining`.",
        "responses": {
          "200": {
            "description": "The account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Account"
                },
                "example": {
                  "user": {
                    "id": 42,
                    "name": "Ada",
                    "email": "ada@example.com"
                  },
                  "plan": "paid",
                  "free": {
                    "monthly": 100,
                    "used": 12,
                    "remaining": 88,
                    "resets_at": "2026-11-01T00:00:00Z"
                  },
                  "credits": {
                    "balance": 3500,
                    "lots": [
                      {
                        "id": 7,
                        "credits": 4000,
                        "remaining": 3500,
                        "expires_at": "2027-09-15T08:00:00Z",
                        "source": "purchase"
                      }
                    ]
                  },
                  "limits": {
                    "max_file_bytes": 1073741824
                  }
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, wrong or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_api_key",
                    "message": "The API key is not valid. It may have been revoked."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "listUsage",
        "security": [
          {
            "bearerAuth": []
          },
          {
            "apiKeyHeader": []
          }
        ],
        "summary": "List credit transactions",
        "description": "Returns your credit ledger, newest first. `kind` is `charge`, `refund`, `grant`, `purchase` or `expire`. `credits` is negative when credits leave your account. A conversion that used free credits and paid credits can show two rows. Pass `next_cursor` as `cursor` to get the next page; it is `null` on the last page.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Rows per page, 1 to 200.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "The `next_cursor` of the previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A page of transactions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsagePage"
                },
                "example": {
                  "data": [
                    {
                      "id": 905,
                      "kind": "charge",
                      "credits": -1,
                      "conversion_id": "k3x9q2m7p1a8z4c6",
                      "created_at": "2026-10-29T10:15:02Z"
                    },
                    {
                      "id": 880,
                      "kind": "purchase",
                      "credits": 4000,
                      "conversion_id": null,
                      "created_at": "2026-10-20T08:00:00Z"
                    }
                  ],
                  "next_cursor": null
                }
              }
            }
          },
          "401": {
            "description": "The API key is missing, wrong or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "invalid_api_key",
                    "message": "The API key is not valid. It may have been revoked."
                  }
                }
              }
            }
          },
          "422": {
            "description": "A parameter is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation_failed",
                    "message": "The 'limit' parameter must be a whole number from 1 to 200."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": [
          "Reference"
        ],
        "operationId": "getOpenApi",
        "security": [],
        "summary": "Get this OpenAPI document",
        "description": "Returns this OpenAPI 3.1 document. Public, with CORS for any origin.",
        "responses": {
          "200": {
            "description": "The OpenAPI document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Your API key, for example `Authorization: Bearer cvk_...`."
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "Your API key in the `X-API-Key` header."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "description": "Stable machine-readable code.",
                "enum": [
                  "invalid_api_key",
                  "insufficient_credits",
                  "email_not_verified",
                  "not_found",
                  "file_too_large",
                  "unsupported_conversion",
                  "validation_failed",
                  "rate_limited",
                  "conversion_not_finished",
                  "no_worker_available",
                  "internal_error"
                ]
              },
              "message": {
                "type": "string",
                "description": "Text for people. It can change; do not match on it."
              }
            }
          }
        }
      },
      "CreateFromURL": {
        "type": "object",
        "required": [
          "url",
          "output_format"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Public http or https address of the file."
          },
          "output_format": {
            "type": "string",
            "description": "Target format, for example `mp3`."
          },
          "input_format": {
            "type": "string",
            "description": "Source format. Default: the extension of the file name."
          },
          "filename": {
            "type": "string",
            "description": "File name to use. Default: from `Content-Disposition` or the URL path."
          },
          "settings": {
            "type": "object",
            "additionalProperties": true,
            "description": "Optional conversion settings."
          }
        }
      },
      "Conversion": {
        "type": "object",
        "required": [
          "id",
          "status",
          "progress",
          "input",
          "output",
          "credits_charged",
          "error",
          "created_at",
          "finished_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Conversion ID."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "processing",
              "succeeded",
              "failed"
            ]
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Percent done."
          },
          "input": {
            "type": "object",
            "required": [
              "filename",
              "format",
              "size_bytes"
            ],
            "properties": {
              "filename": {
                "type": "string"
              },
              "format": {
                "type": "string"
              },
              "size_bytes": {
                "type": "integer"
              }
            }
          },
          "output": {
            "type": [
              "object",
              "null"
            ],
            "description": "Set when the status is `succeeded`.",
            "properties": {
              "filename": {
                "type": "string"
              },
              "format": {
                "type": "string"
              },
              "size_bytes": {
                "type": "integer"
              },
              "download_url": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "uri",
                "description": "Signed absolute link on the worker host. Valid until `expires_at`."
              },
              "expires_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          },
          "credits_charged": {
            "type": "integer",
            "description": "Credits this conversion holds. 0 for unmetered accounts and after a refund."
          },
          "error": {
            "type": [
              "object",
              "null"
            ],
            "description": "Set when the status is `failed`.",
            "properties": {
              "code": {
                "type": "string",
                "description": "`invalid_input`, `invalid_audio_no_stream` or `conversion_error`."
              },
              "message": {
                "type": "string"
              }
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "FormatEntry": {
        "type": "object",
        "required": [
          "input",
          "outputs"
        ],
        "properties": {
          "input": {
            "type": "string"
          },
          "outputs": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "format",
                "group"
              ],
              "properties": {
                "format": {
                  "type": "string"
                },
                "group": {
                  "type": "string",
                  "description": "For example `Audio`, `Video`, `Image`, `Document`."
                }
              }
            }
          }
        }
      },
      "Account": {
        "type": "object",
        "required": [
          "user",
          "plan",
          "free",
          "credits",
          "limits"
        ],
        "properties": {
          "user": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "paid",
              "unmetered"
            ]
          },
          "free": {
            "type": "object",
            "description": "The monthly free credits. All zero for unmetered accounts.",
            "properties": {
              "monthly": {
                "type": "integer"
              },
              "used": {
                "type": "integer"
              },
              "remaining": {
                "type": "integer"
              },
              "resets_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "credits": {
            "type": "object",
            "properties": {
              "balance": {
                "type": "integer",
                "description": "Paid credits that have not expired."
              },
              "lots": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "credits": {
                      "type": "integer"
                    },
                    "remaining": {
                      "type": "integer"
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "purchase",
                        "grant",
                        "promo"
                      ]
                    }
                  }
                }
              }
            }
          },
          "limits": {
            "type": "object",
            "properties": {
              "max_file_bytes": {
                "type": "integer",
                "description": "Largest input you may send now."
              }
            }
          }
        }
      },
      "UsagePage": {
        "type": "object",
        "required": [
          "data",
          "next_cursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "charge",
                    "refund",
                    "grant",
                    "purchase",
                    "expire"
                  ]
                },
                "credits": {
                  "type": "integer",
                  "description": "Signed. Negative when credits leave the account."
                },
                "conversion_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }
  }
}
