List formats
Every input format with its targets and their minimum credits, plus up to three suggested targets with a short reason. No API key needed.
GET
https://api.switchfile.io/v1/formatsExample
Request
curl "https://api.switchfile.io/v1/formats?input=heic"const res = await fetch("https://api.switchfile.io/v1/formats?input=heic");
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());<?php
$ch = curl_init('https://api.switchfile.io/v1/formats?input=heic');
curl_setopt_array($ch, [
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");
}
print_r(json_decode($response, true));import requests
res = requests.get(
"https://api.switchfile.io/v1/formats?input=heic",
)
res.raise_for_status()
print(res.json())Parameters
Query parameters
inputstringReturn only this input format
at most 20 characters · example: heic
Responses
200OK
dataobject[]requireddata[].formatstringrequireddata[].groupstring | nullrequiredOne of video, audio, image, document, spreadsheet, presentation, markup, font, archive, ebook, comic, pdf
data[].suggestedobject[]requireddata[].suggested[].formatstringrequireddata[].suggested[].reasonstringrequireddata[].targetsobject[]requireddata[].targets[].creditsstring (integer) | integerrequiredMinimum credits per file
data[].targets[].formatstringrequired
200 application/json{ "data": [ { "format": "heic", "group": "image", "targets": [ { "format": "jpg", "credits": 1 }, { "format": "pdf", "credits": 1 }, { "format": "png", "credits": 1 }, { "format": "webp", "credits": 1 } ], "suggested": [ { "format": "jpg", "reason": "Opens on every device and in every app." }, { "format": "png", "reason": "Keeps every detail, larger files." } ] } ] }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." }