Skip to main content

Files API

Files endpoints exposed by the Devotel CPaaS API Base path: /api/v1/files Endpoint count: 7

title: “Errors worth branching on” description: “Per-endpoint failure templates matching the envelope — what actually fires, what to retry, what to surface to the operator.”

Errors worth branching on

These five failures cover the upload create + download (POST /api/v1/files, GET /api/v1/files//download), hammered by attachment pickers across the dashboard. Each block below is a full { error, meta } envelope as the API returns it, and the matrix at the bottom answers retry vs surface for the same five classes. For the platform-wide decision table these branches plug into, see the error handling guide.

401 — Unauthorized

A 401 on this page is the bearer key failing before the route ran — it never means the resource is wrong. Rotate the key or re-mint the scoped token; retrying the same request changes nothing.

403 — Forbidden

A 403 means the key authenticated but the operation is gated by scope — check the key’s scopes on the developer page; a 403 is never a data-not-found shape.

422 — Schema

A 422 means the payload did not match the request schema — branch on error.details.field and resend with an allow-listed MIME type on the upload instead of blind-retrying the same body.

429 — Rate

The Retry-After header and error.details.retry_after are both set on every 429 — resend the SAME request after the lower of the two.

402 — Feature gate

Poll the scan status and retry the download once scan_status flips to clean. The full recovery walk — the scan state machine, polling bounds, and how to escalate a wrong verdict — is on FILE_SCAN_QUARANTINED recovery.

60-second retry matrix

Worked request and response samples

Copy the request as written, substitute your own ids, and compare the response envelope — a success in the same shape the numbered error sections spell out.

Upload a file

POST /api/v1/files/upload
Binary uploads land here first — the returned file_id is the handle every downstream surface (imports, fax, knowledge, email) accepts. Request

List files

GET /api/v1/files
Lists uploaded files for the tenant with cursor-based pagination. Each row carries a fresh 1-hour signed read URL.
string
Opaque cursor for the next page (from previous response meta.pagination.cursor)
any
Number of items per page (default 25). Values above the page-size cap are silently clamped; negative, fractional, or unparseable values fall back to the default. Never 422s.

Get a file by ID

GET /api/v1/files/{id}
Returns metadata + a fresh 1-hour signed read URL for a single file. Responds 404 when the file ID does not exist in the tenant namespace.
string
required
Resource identifier

Presign a file URL

GET /api/v1/files/{id}/presign
Mints a fresh S3-style presigned read URL for an existing object with a caller-controlled lifetime. Pass ttl_ms (60000..604800000 / 1 minute..7 days); omit for the conservative 1-hour default. Responds 404 when the file ID does not exist in the tenant namespace.
string
required
Resource identifier
integer
Signed-URL lifetime in milliseconds (clamped to a 60000 floor / 604800000 ceiling). Omit for the 1-hour default.

POST /api/v1/files/{id}/share
Mints a PERMANENT, unauthenticated URL for a video the tenant already uploaded, so it can be handed to an external reviewer who opens it weeks later. Built for the RCS carrier-verification video_url, which every ordinary signed URL fails because signed URLs are capped at 7 days: the link itself never expires and the resolver mints a fresh short-lived signed URL on every request. Unlike a signed URL, the link stays revocable — DELETE /files/{id}/share kills it immediately. Idempotent — re-calling returns the same URLs until the share is revoked. Responds 404 when the file ID does not exist in the tenant namespace, and 422 when the file is not a video (video/mp4, video/3gpp).
string
required
Resource identifier

Upload a file

POST /api/v1/files/upload
Uploads a single file (multipart/form-data, field name file) to the tenant media bucket and returns a signed read URL. The signed URL defaults to a 1-hour TTL; pass ttl_ms to pin a longer-lived URL (capped at 7 days, the GCS V4-signing maximum). Mime type must be in the server allow-list; oversized uploads return 413.
integer
Signed-URL lifetime in milliseconds (1..604800000 / 7 days). Omit for the conservative 1-hour default.

Delete a file

DELETE /api/v1/files/{id}
Deletes a file from the tenant media bucket. Returns 204 on success and 404 when the file ID does not exist in the tenant namespace.
string
required
Resource identifier
Response: 204 No Content
DELETE /api/v1/files/{id}/share
Revokes EVERY outstanding permanent link for the file by rotating its share nonce; previously-shared URLs stop resolving immediately. A new link can be minted afterwards. Responds 404 when the file ID does not exist in the tenant namespace or is not a shareable video.
string
required
Resource identifier