Errors

Every non-2xx response from the developer API uses the same envelope:

json
{
  "error": {
    "code": "FILE_NOT_FOUND",
    "message": "The file could not be found.",
    "details": { "issues": { "size": ["Size must be at least 1 byte"] } }
  }
}
  • code — a stable, machine-readable string (FILE_NOT_FOUND, VALIDATION_ERROR, …). Match on this in error handling, never on message.
  • message — a human-readable explanation.
  • details — optional structured context. Validation failures carry a Zod issues map of field → problems.

Infrastructure (storage-provider/database) errors are translated to INTERNAL_ERROR and never leak raw internals or secrets.

Error codes

StatusCodeMeaning
400VALIDATION_ERRORInvalid JSON, body or query parameters
401UNAUTHORIZEDMissing, malformed, revoked or expired API key
404FILE_NOT_FOUNDFile doesn't exist in this project (or is deleted)
404UPLOAD_NOT_FOUNDUpload session doesn't exist in this project
409FILE_NOT_PENDINGCompleting a file that isn't pending
409FILE_NOT_UPLOADEDAction requires an uploaded file
409FILE_NOT_DELETEDRestore/delete lifecycle conflict
409REPLACE_IN_PROGRESSA replacement is already pending for this file
409NO_REPLACE_IN_PROGRESSreplace/complete without a pending replacement
409UPLOAD_NOT_ACTIVESession has been aborted or completed
409UPLOAD_EXPIREDSession TTL elapsed
409UPLOAD_PARTS_INCOMPLETEPart count/contiguity check failed
409UPLOAD_SIZE_MISMATCHAssembled object size ≠ declared size
413FILE_TOO_LARGEExceeds the project's maximum file size
403QUOTA_EXCEEDEDProject quota exhausted (storage, files, or bandwidth). details.quota names which one
500INTERNAL_ERRORUnexpected server error (retry later)

Handling errors in code

ts
import { ApulodiError } from "@apulodi/sdk";

try {
  await apulodi.files.get("file_missing");
} catch (error) {
  if (error instanceof ApulodiError) {
    if (error.code === "FILE_NOT_FOUND") {
      // 404 — the file doesn't exist
    }
    console.log(error.status);    // 404
    console.log(error.details);   // undefined here
  }
}

Network failures and timeouts surface as ApulodiError with status: 0 and code NETWORK_ERROR / TIMEOUT — inspect status before treating it as an HTTP response code.

Next: Pagination — cursor-based paging.