Download a ZIP archive
archive.url of a batch or url from POST /v1/archives. No API key needed. Conversions deleted in the meantime are left out; once none is left, the answer is 404.
GET
https://api.switchfile.io/v1/archives/{id}Example
Request
curl -L "https://api.switchfile.io/v1/archives/9f0c4e2a-1b7d-4c3e-a5f6-2d8e7b6a1c90?expires=1762538401&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8" \
-o results.zipimport { writeFile } from "node:fs/promises";
const res = await fetch("https://api.switchfile.io/v1/archives/9f0c4e2a-1b7d-4c3e-a5f6-2d8e7b6a1c90?expires=1762538401&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8");
if (!res.ok) throw new Error(`HTTP ${res.status}`);
await writeFile("results.zip", Buffer.from(await res.arrayBuffer()));<?php
$ch = curl_init('https://api.switchfile.io/v1/archives/9f0c4e2a-1b7d-4c3e-a5f6-2d8e7b6a1c90?expires=1762538401&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8');
curl_setopt_array($ch, [
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $response");
}
file_put_contents('results.zip', $response);import requests
res = requests.get(
"https://api.switchfile.io/v1/archives/9f0c4e2a-1b7d-4c3e-a5f6-2d8e7b6a1c90?expires=1762538401&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8",
allow_redirects=True,
)
res.raise_for_status()
with open("results.zip", "wb") as f:
f.write(res.content)Parameters
Path parameters
idstring (uuid)requiredID of the batch or archive
Query parameters
expiresnumberrequiredPart of the signed URL
example: 1762538401
signaturestringrequiredPart of the signed URL
at least 1 characters · example: 3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8
Responses
- 200The ZIP file
403The signature is wrong or the URL has expired
EXPIRED403 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-expired", "title": "Expired", "status": 403, "code": "EXPIRED", "detail": "The link has expired." }404Not found, or every conversion in it was deleted
NOT_FOUND404 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-not-found", "title": "Not found", "status": 404, "code": "NOT_FOUND", "detail": "Archive not found." }409The batch is still running
BATCH_NOT_FINISHED409 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-batch-not-finished", "title": "Batch not finished", "status": 409, "code": "BATCH_NOT_FINISHED", "detail": "The batch is not finished yet." }422Invalid data. errors names the fields
INVALID_DATA422 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-invalid-data", "title": "Invalid data", "status": 422, "code": "INVALID_DATA", "detail": "The request contains invalid data.", "errors": { "to": [ "Expected string" ] } }429Too many requests or a daily quota is used up. See Retry-After
RATE_LIMIT_EXCEEDED429 application/problem+json{ "type": "https://switchfile.io/docs/api/v1#errors-rate-limit-exceeded", "title": "Rate limit exceeded", "status": 429, "code": "RATE_LIMIT_EXCEEDED", "detail": "Too many requests. Try again in 12 seconds." }