Errors, Limits & ReliabilityError Response Format

Error Response Format

The consistent JSON error structure returned by all Protecto API failures.

All failed Protecto API requests return a consistent JSON structure regardless of the error type.

Standard error object

{
  "data": null,
  "success": false,
  "error": {
    "message": "Human-readable error description"
  }
}
FieldTypeValue on failure
datanullAlways null on failure
successbooleanAlways false on failure
error.messagestringHuman-readable description of what went wrong

How to handle errors

Check success first. If false, read error.message for the reason.

const response = await protecto.mask(payload);

if (!response.success) {
  console.error("Mask failed:", response.error.message);
  // Handle based on HTTP status code
}

Errors never return partial data. If success is false, data will always be null. There are no partial success responses.