API reference
Introduction
Base URLs, authentication, request conventions, and error responses. Review Diffio API behavior, response fields, setup details, and production workflows.
Use this reference to plan Diffio API requests and responses. All endpoints use JSON over HTTPS at https://api.diffio.ai/v1.
API reference essentials
- 1
Base URL
Use the production base URL for all API requests.
https://api.diffio.ai/v1Append the endpoint path to the base URL when calling the REST API directly.
- 2
Authentication
Send the API key on every request using one of the supported headers.
Authorization: Bearer <apiKey>X-Api-Key: <apiKey>Xi-Api-Key: <apiKey>
Use API keys with read and write permissions that match the endpoint.
- 3
Request conventions
- All
/v1endpoints usePOSTwith JSON bodies. OPTIONSis accepted for CORS preflight.- Send
Content-Type: application/jsonfor JSON payloads. - Request fields use camelCase, for example
apiProjectId. create_projectreturns anuploadsession. Send the file toupload.edgeBaseUrlin parts withAuthorization: Bearer {upload.uploadToken}, then callcomplete_project_upload. The official SDKs do this for you.- Download URLs from
get_generation_downloadare Diffio media URLs that expire after six hours. - Only
diffio-4.5-flashanddiffio-4.5-proare available. Endpoints for older models answer410with codemodel_retired.
- All
- 4
Error responses
Errors return JSON with an
errormessage. Some errors include additional fields such ascodeor billing metadata.Example error response{ "error": "Payment failed. Update your payment method in the billing portal.", "code": "paymentFailed"}Billing blocks return
402Payment required, billing issue such as paymentFailed. API usage can be blocked until billing is updated.. The codeneedsPaymentMethodmeans the $5 starter credit is used up, or cannot cover this file, and no payment method is saved. When the refusal comes from a check of your remaining credit, the response also includesestimatedCostCentsandremainingCreditCents; once the account is blocked, later requests return onlyerrorandcode, so treat both fields as optional.paymentFailedmeans a charge failed. New generations are refused until a payment method is added on the Billing page. A generation created before its upload was processed is checked again when it starts, and fails with the errorneedsPaymentMethodif the credit cannot cover the file. - 5
Rate limits
Rate limits depend on your plan. Review the API pricing page for current limits and use the developer dashboard to monitor usage.
Endpoints
Use these endpoints to create projects, run generations, manage keys, read usage, and configure webhooks.
Projects
Generations
Diffio 4.5 Flash generation
/v1/diffio-4.5-flash-generation
Queue a generation using the diffio-4.5-flash model.
Diffio 4.5 Pro generation
/v1/diffio-4.5-pro-generation
Queue a generation using the diffio-4.5-pro model.
Get generation progress
/v1/get_generation_progress
Fetch progress and job stages for a generation.
Get generation download
/v1/get_generation_download
Return a download URL for a generation output.
List project generations
/v1/list_project_generations
List generations for a project.
