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/create-project.md, and every docs URL returns Markdown when requested with Accept: text/markdown.
Create a project
Creates a project for one audio or video recording and returns pre-built multipart upload instructions (upload.requests). Pass generation to queue the first restore immediately so it starts automatically as soon as the upload is ready.
POST https:/
- Key scope:
projects:write - Auth header:
Authorization: Bearer <apiKey> - Body: JSON
- POST /projects
- uploads/start
- uploads/parts
- uploads/complete
- upload/complete
The HTTP upload sequence, call by call
- POST
/id and uploadprojects - POST
upload.requests.start.urluploadId - PUT
upload.requests.part.url (one per part)etag per part - POST
upload.requests.complete.urlsizeBytes, etag - POST
/optional; status preparing or readyprojects/ {project_ id}/ upload/ complete
Every edge call: Authorization: Bearer {upload_token}Parts ≤ 32 MiB (part_size_bytes, numbered from 1)
Request
Send a JSON object naming the recording (file_name) and optional file size, MIME type, metadata, or initial generation.
Headers
| Field | Type | Required | Description |
|---|---|---|---|
#Diffio-End-User | string | Required: No | Optional end-user identifier (up to 128 characters). Assigns the new project to end_user and scopes Idempotency-Key to that end user. |
#Idempotency-Key | string | Required: No | Optional key (up to 255 characters) for safe retries. Repeating the same request returns the original project; changing any body field returns 409 (idempotency_key_conflict). |
Body fields
| Field | Type | Required | Description |
|---|---|---|---|
#file_name | string | Required: Yes | Recording filename with a supported audio or video extension. |
#content_type | string | Required: No | Recording MIME type (for example audio/mpeg or video/mp4); defaults to application/octet-stream when omitted. |
#size_bytes | integer | Required: No | File size in bytes when known, from 0 up to 2147483648 (2 GB). |
#metadata | object | Required: No | Optional string-to-string map saved on the project (up to 50 keys; each key up to 40 characters, each value up to 500 characters). |
#generation | object | Required: No | Optional initial restore to queue immediately (latest_generation); requires generations:write scope in addition to projects:write.Fields below |
generation 3 fields
| Field | Type | Required | Description |
|---|---|---|---|
#generation. | string | Required: Yes | Model ID from GET /models, such as diffio-flash or diffio-pro. |
#generation. | object | Required: No | Optional advanced sampling overrides object. |
#generation. | string | Required: No | Optional caller-defined name for the generation (up to 120 characters). |
Request
import os
from diffio import DiffioClient
key = os.environ["DIFFIO_API_KEY"]
client = DiffioClient(api_key=key)
project = client.projects.create(
file_name="interview.mp3",
content_type="audio/mpeg",
size_bytes=510957,
metadata={"order_id": "1042"},
end_user="customer-mwe8tm1g",
idempotency_key="v2docs-a-mwe8tm1g",
)Response
Returns the new project (status: "awaiting_upload") with signed multipart upload instructions valid for 24 hours.
Success: 201Created.
Response fields
| Field | Type | Present | Description |
|---|---|---|---|
#id | string | Always | Unique project identifier (UUID). |
#object | string | Always | Resource type, always "project".project |
#status | string | Always | Upload and preparation state: awaiting_upload until bytes arrive, preparing while media is probed, ready when ready to restore, or failed.awaiting_uploadpreparingreadyfailed |
#latest_generation | object | null | Always | Newest Generation object on this project, or null when no generation exists yet. |
#upload | object | null | Always | Multipart upload instructions for sending the file to the media edge, or null on an idempotent replay after the upload has arrived.Fields below |
upload 11 fields
| Field | Type | Present | Description |
|---|---|---|---|
#upload. | string | Always | Upload session identifier (api-{project_id}). |
#upload. | string | Always | Origin URL of the media upload edge (https://media.diffio.io). |
#upload. | string | Always | Signed bearer token sent as Authorization: Bearer <token> on every upload edge request. |
#upload. | integer | Always | Required byte length for every upload part except the last (33554432, 32 MiB). |
#upload. | integer | Always | Maximum total upload size in bytes (2147483648, 2 GB). |
#upload. | string | Always | ISO 8601 UTC timestamp when upload_token expires (24 hours after minting); renew via POST /projects/{project_id}/upload. |
#upload. | object | Always | Pre-built HTTP request descriptors for the multipart upload (start, part, complete, abort). |
#upload. | object | Always | Descriptor (method, url, headers, body, returns, description) called once first to obtain uploadId. |
#upload. | object | Always | Descriptor called once per part (numbered from 1) with raw bytes as the PUT body; save each returned etag. |
#upload. | object | Always | Descriptor called once after all parts finish, sending uploadId and the ordered parts array (partNumber, etag). |
#upload. | object | Always | Optional descriptor to discard uploaded parts for an unfinished uploadId. |
Other response fields15 fields
| Field | Type | Present | Description |
|---|---|---|---|
#file_name | string | null | Always | Recording filename as sent at creation, or null. |
#content_type | string | null | Always | MIME type sent at creation (application/octet-stream when none was sent), or null. |
#size_bytes | integer | null | Always | File size in bytes: the uploaded byte count once the upload arrives, before that the size_bytes sent at creation; null when unknown. |
#duration_seconds | number | null | Always | Recording duration in seconds once status is ready, or null while awaiting upload or preparing. |
#has_video | boolean | Always | True when the recording has video: inferred from content_type or the file name until the upload is probed, then from the file itself. |
#end_user | string | null | Always | End-user identifier from the Diffio-End-User header at creation, or null for account-level projects. |
#metadata | object | Always | Key-value string map saved with the project ({} when none was supplied). |
#generation_count | integer | Always | Total number of generations created for this project. |
Show all 15 fields (7 more)
| Field | Type | Present | Description |
|---|---|---|---|
#video_preview_status | string | null | Always | State of a video project's picture-only HLS stream (video_hls): preparing, ready, or failed; null for audio projects.preparingreadyfailed |
#share_id | string | null | Always | Public 17-character share identifier while a share is published, or null when unshared. |
#created_at | string | null | Always | ISO 8601 UTC timestamp when the project was created, or null. |
#updated_at | string | null | Always | ISO 8601 UTC timestamp when the project last changed, or null. |
#error | object | null | Always | Failure details when status is failed, or null otherwise. |
#error. | string | Always | Stable snake_case project failure code (media_processing_failed or project_failed). |
#error. | string | Always | Human-readable explanation of why the upload could not be prepared. |
Response 201Created.
{
"id": "62f62565-049f-5e7e-bbd2-9de0cf7ddbfe",
"object": "project",
"status": "awaiting_upload",
"latest_generation": null,
"upload": {
"upload_token": "v1.REDACTED",
"part_size_bytes": 33554432,
"expires_at": "2026-11-14T00:33:21.812909Z",
"requests": {
"start": {
"method": "POST",
"url": "https://media.diffio.io/v1/uploads/start",
"headers": {
"Authorization": "Bearer v1.REDACTED"
},
"body": null,
"returns": [
"uploadId",
"partSizeBytes",
"maxBytes"
],
"description": "Once, first. Keep uploadId for the other requests."
}
}
}
}Return codes
201Created.Project created with multipartuploadinstructions (and queuedlatest_generationwhengenerationwas sent).400Bad request.Malformed JSON, or 4 more causes
- Malformed JSON
- Missing
file_name - Invalid body field
- Oversized header
- Unknown
generation.model
invalid_jsonmissing_fieldinvalid_fieldinvalid_headerunknown_model402Payment required: see error.code for the billing problem.Whengenerationis included and the account cannot pay for the first restore (checked at the 60-second minimum until the upload is probed); see the error codes below.insufficient_creditneeds_payment_methodpayment_failedusage_limit_reacheddetails403Forbidden: the key lacks permission.Key is inactive or lacksprojects:write, orgenerations:writewhengenerationis included.permission_denied409Conflict: see error.code for which one.ReusedIdempotency-Keywith different request fields.idempotency_key_conflictdetails413Payload too large.size_bytesexceeds the 2 GB (2,147,483,648bytes) upload limit.upload_too_large415Client error.File extension orcontent_typeis not a supported audio or video format.unsupported_media_type500Server error.Initialgenerationcould not be started and nothing was charged, or server error.generation_start_failedinternal_error401Unauthorized: the API key is missing or invalid.405Client error.Same on every endpoint401Unauthorized: the API key is missing or invalid. Missing API key (code missing_api_key), or invalid API key (code invalid_api_key).405Client error. HTTP method not supported on this path; check the Allow header (code method_not_allowed).
Error codes
5 codes
| Status | Code | Meaning | Also returned |
|---|---|---|---|
402Payment required: see error.code for the billing problem. | insufficient_credit | Your API credit is used up, or cannot cover this file. | estimated_cost_cents remaining_credit_cents |
402Payment required: see error.code for the billing problem. | needs_payment_method | Card billing accounts: no payment method, and the credit is used up or cannot cover this file. | estimated_cost_cents remaining_credit_cents (when the credit was read) |
402Payment required: see error.code for the billing problem. | payment_failed | A payment for API usage failed, or the last invoice of ended card billing is unpaid. | details omitted |
402Payment required: see error.code for the billing problem. | usage_limit_reached | Unbilled usage reached $100; it is being charged now. | details omitted |
409Conflict: see error.code for which one. | idempotency_key_conflict | Idempotency-Key was already used with different request fields. | details omitted |
Example error response
{
"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
}
}
}Notes
- Upload the recording by executing
upload.requests.start,upload.requests.part(32 MiB parts except the last), andupload.requests.complete, or callclient.projects.upload(...)in the Python and Node.js SDKs. - Files can be up to 2 GB (
2,147,483,648bytes) with no media length limit. - After
upload.requests.completesucceeds, the upload edge reports completion automatically within about 30 seconds; call Complete a project's upload to make readiness immediate.