Paperful Icon

Paperfuldocs

Handle errors

Catch and respond to errors from the API.

When a request fails, the SDK throws an error with the HTTP status and details from the API.

Catch errors

try {
  await paperful.papers.get("00000000-0000-0000-0000-000000000000");
} catch (error: any) {
  if (error.status === 404) {
    console.log("Paper not found");
  } else {
    throw error;
  }
}

Common errors

StatusErrorDescription
400Bad requestThe request was invalid.
401UnauthorizedThe API key is missing or invalid.
403Permission deniedThe API key can't access this resource.
404Not foundThe resource doesn't exist.
413Entity too largeThe file is larger than your plan allows.
415Unsupported media typeThe file type isn't supported.
429Too many requestsYou've hit a rate limit.

On this page