BastosConvert API

Errors

Errors

Every error is a single RFC 7807 problem document, served as application/problem+json. The HTTP status is authoritative; the code is stable and safe to branch on.

Shape

{
  "type":   "https://bastos-cms.dev/errors/bad_request",
  "title":  "bad_request",
  "status": 400,
  "code":   "bad_request",
  "params": { "message": "missing `target_format` field" }
}
FieldMeaning
typeStable URI identifying the error class
titleShort human-readable summary
statusHTTP status code (mirrors the response status)
codeStable machine code — branch on this, not on title
paramsOptional context (e.g. message, limits) — present on some errors

Every response also carries an x-request-id header. Quote it when reporting an issue — it lets support trace the exact request.

Common codes

StatuscodeWhen
400bad_requestMalformed multipart, missing required field, unsupported target_format
401auth_requiredMissing/invalid API key on a key-gated endpoint
403forbiddenAuthenticated but not allowed (e.g. another account's job)
404not_foundUnknown route or job id
413payload_too_largeFile exceeds the per-tool size cap
429rate_limitedRate limit hit — see Rate limits (Retry-After)
500internalUnexpected server error — safe to retry with backoff

Handling errors

http=$(curl -s -o body.json -w '%{http_code}' \
  -X POST https://bastosconvert.com/api/v1/media/convert_audio \
  -F file=@track.wav -F target_format=mp3)

case "$http" in
  2*) echo "ok" ;;
  429) echo "slow down: $(jq -r .code body.json)" ;;
  4*) echo "client error: $(jq -r '.code + \" — \" + (.params.message // \"\")' body.json)" ;;
  5*) echo "server error, retry later" ;;
esac

On this page