Announce a file
POST /api/v1/deliveries/{id}/files
Announces a file of the delivery: its name, its exact size, its type. A credit is reserved then, and the response gives the address to send the bytes to.
Scope · deliveries:write Takes an Idempotency-Key
Path parameters
iduuid required- The delivery, as
POST /deliveriesreturned it.
Request body
namestring required- The file’s name, 500 characters at most. ValidFile reads it to choose the placement:
Meta_FR_story-noel.mp4helps,001.mp4does not. Join folders with_. sizeinteger required- The exact size in bytes, 5 GB at most. The upload address accepts this size only.
typestring required- The MIME type, 200 characters at most. The real type is read from the bytes: a PNG named
.jpgis judged as a PNG.
What the response holds · 201
fileannounced- The file announced.
The fields of announced
iduuid- The file, for
/complete, reading andDELETE.
uploadUrluri- A resumable Cloud Storage upload session, in Montréal, for this file only.
PUTthe bytes there: Sending a file says how.
Errors
| 400 | invalid | Fix the request: a field is missing, too long or of another type, or the JSON is malformed. |
| 400 | empty | A 0-byte file: do not send it. |
| 402 | no_credits | No files left on the plan, and no credits; left says what is left. Buy some in ValidFile, or wait for the next period. |
| 402 | key_ceiling | The key’s ceiling is reached for the period; cap says what it is. |
| 403 | scope | The key does not have the scope the route asks for: a read-only key tried to write, or a key without drop-links:write tried to make or cut a drop link. |
| 404 | not_found | A delivery or file unknown, deleted, or erased at the end of its retention; or an address the API does not have. |
| 413 | too_large | A file of more than 5 GB, a file of more than 25 MB sent to POST /validate (announce it with POST …/files instead), or a JSON body of more than 64 KiB. |
| 415 | zip_not_supported | A zip: unzip a zip of files and announce each file; an HTML5 banner is dropped in ValidFile, which judges it. |
| 429 | too_many_pending | Too many files not judged yet: wait Retry-After seconds, or for verdicts. |
| 429 | test_limit | The agency’s 10 test files in 24 h are taken: wait Retry-After seconds, until the oldest is erased. |
| 409 | idempotency_mismatch | The same Idempotency-Key with another body: take a new one. |
| 409 | idempotency_in_progress | The first call is still running: try again in a moment, with the same key. |
And those of any call, in Limits and errors.
A file announced and never completed gives its credit back after 24 h. A failed upload gives it back at once with Give up a file.
curl https://validfile.ca/api/v1/deliveries/$DELIVERY/files \
-H "Authorization: Bearer $VALIDFILE_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Meta_FR_story-noel.mp4",
"size": 18734201,
"type": "video/mp4"
}'
{
"file": { "id": "9e2d4c1a-3b7f-4e0d-8a6c-2f1b5d9e7c43" },
"uploadUrl": "https://storage.northamerica-northeast1.rep.googleapis.com/upload/storage/v1/b/…&upload_id=…"
}