Errors & Codes

Postject uses standard HTTP status codes and returns structured JSON error responses for all error conditions.


Error Response Format

All error responses follow a consistent JSON structure with the HTTP status code, a human-readable message, and the error type.

json
{
  "statusCode": 400,
  "message": "Validation failed: email must be a valid email address",
  "error": "Bad Request"
}

HTTP Status Codes

CodeStatusDescription
200OKRequest succeeded
201CreatedResource created successfully (new message, server, template, etc.)
400Bad RequestInvalid parameters or missing required fields
401UnauthorizedMissing or invalid authentication token
403ForbiddenInsufficient permissions or plan limit reached
404Not FoundThe requested resource does not exist
409ConflictDuplicate resource (e.g., domain already registered)
500Internal Server ErrorAn unexpected error occurred on the server

Common Error Scenarios

Missing Authorization header

Returns 401. Include Authorization: Bearer your_token in all authenticated requests.

Invalid server token

Returns 401. Verify your server token starts with pt_live_ and is copied correctly from the dashboard.

Server limit exceeded for plan

Returns 403. Upgrade your plan to create more servers. See Rate Limits & Quotas.

Template not found

Returns 404. Verify the template ID exists and belongs to the same server as the sending token.

Sending to a suppressed recipient

Returns 201 with status rejected. This is not an error — the message is created but not sent to protect your reputation.

Domain already registered

Returns 409. Each domain or email identity can only be registered once per account.

Missing required fields

Returns 400. The error message will specify which fields are missing or invalid.