Skip to content

For AI agents: every API docs page in one plain-text file is at /docs/llms-full.txt, and the documentation index is at /llms.txt. This page is available as Markdown at https://diffio.ai/docs/api-reference/introduction.md, and every docs URL returns Markdown when requested with Accept: text/markdown.

Diffio API reference: base URL, auth and errors

Use this reference to integrate the Diffio API. Every endpoint speaks JSON over HTTPS at https://api.diffio.ai/v2.

Check your key with a first request (pip install diffio or npm install diffio). It lists your account's projects; see List projects for the response shape.

import os
from diffio import DiffioClient

key = os.environ["DIFFIO_API_KEY"]
client = DiffioClient(api_key=key)

page = client.projects.list()
  1. URL base URL + resource path
  2. Header Authorization: Bearer <apiKey>
  3. Response snake_case JSON resource or page

API reference essentials

  1. Your code or SDKGET · POST · PUT · DELETEresource path, Bearer key header
  2. Success200OK. 201Created. 202Accepted: the work continues in the background. JSONsnake_case fields for each resource
  3. Error4xx {"error": {...}}code, message, request_id, optional details
  1. 1

    Base URL and OpenAPI spec

    Append each endpoint path to the production base URL.

    https://api.diffio.ai/v2

    Fetch the machine-readable OpenAPI 3.1.0 specification at GET https://api.diffio.ai/v2/openapi.json (public, no API key required).

    The API version is in the path; within it, changes only add. Releases and the versioning rules are in the Changelog.

  2. 2

    Authentication

    Send your API key in the Authorization header on every non-public request. Create and manage keys on the API keys page in the developer dashboard.

    • Authorization: Bearer <apiKey>

    Each endpoint page lists the scope it requires (projects:read, projects:write, generations:read, generations:write, artifacts:read, usage:read, or webhooks:write). List models, Get a share, and GET /openapi.json are public and need no key.

  3. 3

    Request conventions

    • snake_case JSON fields
    • Content-Type: application/json
    • Idempotency-Key
    • Diffio-End-User
    • limit and cursor pagination
    • X-Request-Id response header
    • OPTIONS for CORS preflight
    • JSON bodies: POST and PUT calls that take fields accept a JSON object ({...}) with snake_case keys such as file_name, size_bytes, and preview_seconds.
    • Idempotency-Key: Optional header (up to 255 characters) honoured on Create a project, Create a generation, and Edit a generation's transcript. Repeating the same request returns the original resource without charging twice; changing any body field returns 409 with code idempotency_key_conflict. Both SDKs send an Idempotency-Key automatically when you omit one.
    • Diffio-End-User: Optional header (up to 128 characters) for multi-tenant apps. Requests carrying this header assign new projects to that end_user and scope project reads, generations, shares, and Get usage reports to that end user. Omit it on account-wide calls such as Open the webhook portal.
    • Cursor pagination: List projects and List a project's generations return {"object": "list", "data": [...], "next_cursor": "..."} newest first. Pass limit (1 to 100, default 20) and pass next_cursor as cursor until next_cursor is null.
    Uploads, playback URLs, and models
    • Create a project returns upload.requests (start, part in 32 MiB chunks, complete, and abort) authenticated with Authorization: Bearer {upload.upload_token} (valid for 24 hours). Files can be up to 2 GB (2,147,483,648 bytes) with no media length limit. Call Complete a project's upload for immediate readiness, or let the upload edge report completion after about 30 seconds. Both official SDKs handle multipart uploads and retries automatically.
    • Get a playback grant returns signed media URLs in files (audio, video, hls_master, transcript, stems_manifest, original, and waveforms) valid for 6 hours until expires_at, with no API key required. Append ?download=<filename> to a media URL to trigger a browser file download.
    • List models returns hosted models (diffio-4.7-flash at $5/hour and diffio-4.7-pro at $10/hour), rolling tier aliases (diffio-flash and diffio-pro), and retired model names. Retired model names run on the current hosted model of the same tier (substituted: true) at the lower of the two list prices (Models).
  4. 4

    Error responses

    Every 4xx and 5xx response returns one JSON shape: error.code (stable snake_case identifier to branch on), error.message, error.request_id (also sent in the X-Request-Id header), and an optional error.details object when structured context applies.

    Error response shape
    {
      "error": {
        "code": "unknown_model",
        "message": "nope is not a Diffio model. See GET /v2/models.",
        "request_id": "f064e4099097414da3fb5b37684ab1bb",
        "details": {
          "field": "model",
          "models": [
            "diffio-4.7-flash",
            "diffio-4.7-pro",
            "diffio-flash",
            "diffio-pro"
          ]
        }
      }
    }

    Common error codes

    Status and codeWhen it happens
    400Bad request. invalid_field · missing_fieldMalformed JSON (invalid_json), missing or invalid body field (details.field), bad query parameter (invalid_parameter, details.parameter), oversized header (invalid_header), or unknown model (unknown_model).
    401Unauthorized: the API key is missing or invalid. missing_api_key · invalid_api_keyNo API key was sent, or the API key was not recognized.
    403Forbidden: the key lacks permission. permission_deniedThe key is inactive, lacks the required scope, or sent Diffio-End-User to an account-only route.
    404Not found. *_not_foundUnknown resource for this account or end user (project_not_found, generation_not_found, export_not_found, share_not_found, transcript_not_found, route_not_found).
    405Client error. method_not_allowedThe path exists, but does not accept this HTTP method; check the Allow header.
    409Conflict: see error.code for which one. not_ready · not_available · revision_conflictState conflict: prerequisite still running (not_ready), permanently unavailable (not_available), stale save revision (revision_conflict, details.current_revision), or reused Idempotency-Key with a different body (idempotency_key_conflict).
    413Payload too large. upload_too_large · 415Client error. unsupported_media_typeFile exceeds 2 GB (upload_too_large), draft JSON exceeds 900,000 bytes (transcript_draft_too_large), or file extension/MIME type is not supported audio or video (unsupported_media_type).
    429Too many requests. rate_limitedToo many requests of this kind in a short time (for example, more than 10 assistant feedback reports in an hour); retry later with backoff, honouring Retry-After when sent.
    500Server error. internal_error · 503Service unavailable. unavailableA transient server error occurred (internal_error, generation_start_failed, unavailable); retry with exponential backoff.

    Every code, with its retry rule and the codes a failed resource reports: Errors.

    Billing error codes (402)

    Status and codeMeaningWhat to do
    402Payment required: see error.code for the billing problem. insufficient_creditYour API credit is used up, or cannot cover this file.Add credit on the Billing page.
    402Payment required: see error.code for the billing problem. needs_payment_methodThe credit is used up, or cannot cover this file, and no payment method is saved.Add a payment method on the Billing page.
    402Payment required: see error.code for the billing problem. payment_failedA payment for API usage failed, or the last invoice of ended card billing is unpaid.On the Billing page, select Update payment method and choose a card for your subscription, or Pay invoice once card billing has ended.
    402Payment required: see error.code for the billing problem. usage_limit_reachedUnbilled usage reached $100; it is being charged now.Wait for the charge to complete; the API continues as soon as it does.

    needs_payment_method, payment_failed and usage_limit_reached reach only accounts with card billing (a card added before prepaid credit).

    Example 402 responses and billing details
    402 insufficient_credit
    {
      "error": {
        "code": "insufficient_credit",
        "message": "This file needs about $1.25 of API credit and your balance is $0.40. Add credit in the developer dashboard to continue.",
        "request_id": "f064e4099097414da3fb5b37684ab1bb",
        "details": {
          "estimated_cost_cents": 125,
          "remaining_credit_cents": 40
        }
      }
    }
    402 payment_failed
    {
      "error": {
        "code": "payment_failed",
        "message": "A payment for API usage failed. On the developer dashboard's Billing page, select Update payment method and choose a card for your subscription.",
        "request_id": "f064e4099097414da3fb5b37684ab1bb"
      }
    }
    402 payment_failed, card billing ended
    {
      "error": {
        "code": "payment_failed",
        "message": "The last invoice of your API card billing is unpaid. Pay it from the developer dashboard's Billing page to continue.",
        "request_id": "f064e4099097414da3fb5b37684ab1bb"
      }
    }
    402 usage_limit_reached
    {
      "error": {
        "code": "usage_limit_reached",
        "message": "Your unbilled API usage reached $100.00. It is being billed to your payment method now, and the API continues as soon as that payment completes.",
        "request_id": "f064e4099097414da3fb5b37684ab1bb"
      }
    }

    An insufficient_credit or needs_payment_method refusal from a credit check includes details.estimated_cost_cents and details.remaining_credit_cents; treat details as optional. A generation created before its upload finishes is checked again when processing starts, and fails with the same error code in generation.error.code if credit cannot cover the recording. Billing explains credit and card billing.

  5. 5

    Rate limits

    No general per-key quota: Most endpoints set no per-key request limit; when workers are busy, generations wait in a queue (see queue on Get a generation). A few actions have their own limits, per end user (or per account without Diffio-End-User):

    • Ask the edit assistant: up to 30 turns per 10 minutes plus a daily cap; a turn over the limit ends failed with error.code rate_limited.
    • Send assistant feedback: up to 10 reports per hour; more answer 429Too many requests. rate_limited.

    Treat any 429 as "retry later with backoff"; both SDKs do this for calls that are safe to repeat and honour Retry-After. Usage is billed per second (API pricing).

Endpoints

Browse all 30 endpoints across 8 categories: models, projects, generations, separated tracks, transcripts, shares, usage, and webhooks.

Models

1 endpoint
Endpoint, method and pathWhat it does
List modelsGET /modelsList every hosted model, tier alias, and retired model name with hourly list pricing.

Projects

6 endpoints
Endpoint, method and pathWhat it does
Create a projectPOST /projectsCreate a project for one audio or video file and receive multipart upload instructions.
List projectsGET /projectsList projects on the account newest first with cursor pagination.
Get a projectGET /projects/{project_id}Retrieve one project's upload status, media metadata, and latest generation.
Delete a projectDELETE /projects/{project_id}Delete a project and all of its stored uploads, generations, exports, and shares.
Get new upload instructionsPOST /projects/{project_id}/uploadMint fresh 24-hour multipart upload instructions for a project awaiting its file.
Complete a project's uploadPOST /projects/{project_id}/upload/completeVerify and prepare a finished multipart upload immediately instead of waiting for edge callback.

Generations

6 endpoints
Endpoint, method and pathWhat it does
Create a generationPOST /projects/{project_id}/generationsStart a speech restoration generation on a project with a chosen model.
List a project's generationsGET /projects/{project_id}/generationsList every restore and transcript edit generation on a project, newest first.
Get a generationGET /projects/{project_id}/generations/{generation_id}Check one generation's status, live stage progress, queue position, available files, or failure reason.
Get a playback grantGET /projects/{project_id}/generations/{generation_id}/mediaMint 6-hour signed playback and download URLs for a generation's audio, video, HLS, stems, and transcript files.
Estimate a transcript editPOST /projects/{project_id}/generations/{generation_id}/edits/estimateEstimate the changed word runs, 30-second windows, and maximum billable seconds of a Pro transcript edit.
Edit a generation's transcriptPOST /projects/{project_id}/generations/{generation_id}/editsEdit a finished Pro generation's transcript and re-restore only the windows around changed words.

Separated tracks

4 endpoints
Endpoint, method and pathWhat it does
Get the saved mixGET /projects/{project_id}/generations/{generation_id}/mixRead the saved background gain, speech leveling setting, and revision for a generation's separated tracks.
Save the mixPUT /projects/{project_id}/generations/{generation_id}/mixSave the background track gain and speech leveling setting for a generation's separated tracks.
Create an exportPOST /projects/{project_id}/generations/{generation_id}/exportsRender a downloadable or inline-playable file from a generation's separated speech and background tracks.
Get an exportGET /projects/{project_id}/generations/{generation_id}/exports/{export_id}Poll an export's render status and mint a fresh 6-hour download or playback URL once ready.

Transcripts

7 endpoints
Endpoint, method and pathWhat it does
Get a generation's transcriptGET /projects/{project_id}/generations/{generation_id}/transcriptRetrieve a generation's normalized word-timed transcript for display, assistant turns, or Pro edits.
Get the transcript draftGET /projects/{project_id}/generations/{generation_id}/transcript/draftRead the saved JSON editor draft and compare-and-swap revision for a generation's transcript.
Save the transcript draftPUT /projects/{project_id}/generations/{generation_id}/transcript/draftSave an editor's JSON draft state (up to 900,000 bytes) for a generation's transcript.
Delete the transcript draftDELETE /projects/{project_id}/generations/{generation_id}/transcript/draftDelete a generation's saved transcript editor draft with optional revision checking.
Ask the edit assistantPOST /projects/{project_id}/generations/{generation_id}/transcript/assistant/turnsStart an asynchronous edit-assistant chat turn on a finished Pro generation's transcript.
Get an edit assistant turnGET /projects/{project_id}/generations/{generation_id}/transcript/assistant/turns/{turn_id}Poll an edit-assistant turn for its reply, word-level edit proposals, moments, or failure details.
Send assistant feedbackPOST /projects/{project_id}/generations/{generation_id}/transcript/assistant/feedbackSend the Diffio team a bug report or an idea about the edit assistant, with the conversation if wanted.

Shares

4 endpoints
Endpoint, method and pathWhat it does
Publish a project's sharePUT /projects/{project_id}/sharePublish or update a project's public playback share, optionally pinned to one generation or preview length.
Get a project's shareGET /projects/{project_id}/shareRead a project's currently published share and its playback URLs using your API key.
Revoke a project's shareDELETE /projects/{project_id}/shareRevoke a project's published share so its public share ID and media URLs stop working.
Get a shareGET /shares/{share_id}Fetch a published share's playback metadata and signed media URLs without an API key.

Usage

1 endpoint
Endpoint, method and pathWhat it does
Get usageGET /usageReport generation counts, billable seconds, and USD list-price usage in total and by model.

Webhooks

1 endpoint
Endpoint, method and pathWhat it does
Open the webhook portalPOST /webhooks/portalCreate a short-lived login link to the hosted webhook portal to manage endpoints and secrets.

Report an issue with this page