Skip to Content

Errors

The error format, status codes and error codes, and how to handle them

Every failed request returns the same JSON shape: a machine-readable code, a message, the HTTP status, a requestId to quote to support and, where it helps, a suggestion and the fields that failed validation.

Error format

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request validation failed",
    "statusCode": 422,
    "requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "errors": [
      {
        "field": "email",
        "message": "Invalid email",
        "code": "invalid_string"
      }
    ],
    "suggestion": "One or more fields have incorrect types. Check that strings are quoted, numbers are unquoted, and booleans are true/false."
  },
  "timestamp": "2025-11-30T10:30:00.000Z"
}
FieldTypeDescription
successbooleanAlways false for errors
error.codestringMachine-readable error code (see below)
error.messagestringHuman-readable error description
error.statusCodenumberHTTP status code
error.requestIdstringUnique request identifier for debugging
error.errorsarrayField-level validation errors (validation errors only)
error.detailsobjectAdditional context about the error (optional)
error.suggestionstringHelpful guidance for fixing the error (optional)
timestampstringISO 8601 timestamp when the error occurred

Status codes

StatusMeaning
200 OKThe request succeeded.
201 CreatedThe resource was created.
400 Bad RequestThe request is malformed or has invalid parameters. Check the error details.
401 UnauthorizedAuthentication is missing or failed. Check your API key.
402 Payment RequiredA billing limit was reached or the operation needs a plan upgrade. Returned with BILLING_LIMIT_EXCEEDED and UPGRADE_REQUIRED.
403 ForbiddenNot allowed: check permissions and project status. Also returned when email verification is required (EMAIL_VERIFICATION_REQUIRED) or the project is disabled (PROJECT_DISABLED).
404 Not FoundThe resource does not exist. Check the ID.
409 ConflictThe request conflicts with the resource's current state, such as creating a contact with an email that already exists. Returned with CONFLICT.
422 Unprocessable EntityValidation failed. The errors array lists the fields.
429 Too Many RequestsRate limit exceeded. Wait before retrying.
500 Internal Server ErrorSomething went wrong on our side. Contact support with the request ID.

Error codes

Handle errors by code rather than by status: several codes share a status.

Authentication and access

CodeStatusDescription
UNAUTHORIZED401General authentication failure
INVALID_CREDENTIALS401Login credentials are incorrect
MISSING_AUTH401Authorization header is missing or malformed
INVALID_API_KEY401API key is invalid or not found
FORBIDDEN403Not allowed to perform this action
PROJECT_ACCESS_DENIED403No access to this project
PROJECT_DISABLED403Project has been disabled
EMAIL_VERIFICATION_REQUIRED403The user's email address must be verified before this action

Validation

CodeStatusDescription
BAD_REQUEST400General request error
VALIDATION_ERROR422Request validation failed (includes field errors)
INVALID_EMAIL422Email format is invalid
INVALID_REQUEST_BODY400Request body is malformed
MISSING_REQUIRED_FIELD422Required field is missing

Resources

CodeStatusDescription
RESOURCE_NOT_FOUND404Generic resource not found
CONTACT_NOT_FOUND404Contact does not exist
TEMPLATE_NOT_FOUND404Template does not exist
CAMPAIGN_NOT_FOUND404Campaign does not exist
WORKFLOW_NOT_FOUND404Workflow does not exist
CONFLICT409Resource conflict (e.g., duplicate)
EMAIL_NOT_SCHEDULED409The email can no longer be rescheduled or cancelled: it is sending, sent or already cancelled

Rate limits and billing

CodeStatusDescription
RATE_LIMIT_EXCEEDED429Too many requests
BILLING_LIMIT_EXCEEDED402Billing limit reached
UPGRADE_REQUIRED402Feature requires plan upgrade

Server

CodeStatusDescription
INTERNAL_SERVER_ERROR500Unexpected server error
DATABASE_ERROR500Database operation failed
EXTERNAL_SERVICE_ERROR500External service unavailable

Examples

Handling errors in your code

Check success before reading data, log the requestId, and branch on error.code:

try {
  const response = await fetch('https://api.send.47signals.com/v1/track', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${publicKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      event: 'purchase',
      email: 'user@example.com'
    })
  });

  const data = await response.json();

  if (!data.success) {
    // Handle error
    console.error(`Error [${data.error.code}]:`, data.error.message);

    // Show suggestion to user
    if (data.error.suggestion) {
      console.log('Suggestion:', data.error.suggestion);
    }

    // Log request ID for support
    console.log('Request ID:', data.error.requestId);

    // Handle specific error types
    switch (data.error.code) {
      case 'VALIDATION_ERROR':
        // Show field-level errors
        data.error.errors?.forEach(err => {
          console.log(`${err.field}: ${err.message}`);
        });
        break;
      case 'INVALID_API_KEY':
        // Prompt user to check their API key
        break;
      case 'RATE_LIMIT_EXCEEDED':
        // Implement retry with backoff
        break;
    }

    return;
  }

  // Handle success
  console.log('Event tracked:', data.data);
} catch (error) {
  console.error('Network error:', error);
}

Retry only what can succeed later: 429 and 5xx responses, with exponential backoff (1s, 2s, 4s, 8s). A 4xx other than 429 fails the same way until the request changes.

Request IDs

Every response carries a request ID, in error.requestId on errors and in the X-Request-ID header on every response, successful ones included. It traces the request through the API, database, queues and workers, so support can see exactly what happened without asking you for more.

// Example: Logging request ID in your application
const response = await fetch('https://api.send.47signals.com/v1/send', {
  // ... your request
});

const requestId = response.headers.get('X-Request-ID');
console.log('Request ID:', requestId);  // Log for correlation

const data = await response.json();
if (!data.success) {
  console.error('Error:', data.error.message);
  console.error('Request ID:', data.error.requestId);  // Same as header
}

When you contact support, include the request ID, what you were trying to do and, if you can, the full error response.

Common issues

If you are still stuck, check the suggestion field, search these docs for the error code, and contact support with the request ID.

On this page