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
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
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
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
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
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/uploadfile_id is the handle every downstream surface (imports, fax, knowledge, email) accepts.
Request
List files
GET /api/v1/filesNumber 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}Presign a file URL
GET /api/v1/files/{id}/presignttl_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.
Signed-URL lifetime in milliseconds (clamped to a 60000 floor / 604800000 ceiling). Omit for the 1-hour default.
Share a video with a permanent link
POST /api/v1/files/{id}/sharevideo_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).
Upload a file
POST /api/v1/files/uploadfile) 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.
Signed-URL lifetime in milliseconds (1..604800000 / 7 days). Omit for the conservative 1-hour default.
Delete a file
DELETE /api/v1/files/{id}204 No Content
Revoke a video’s share links
DELETE /api/v1/files/{id}/share