Overview
The Mailrify API uses standardized error responses to help you quickly identify and resolve issues. All errors include:- Machine-readable error codes for programmatic handling
- Human-readable messages explaining what went wrong
- Helpful suggestions to guide you toward a solution
- Request IDs for debugging and support requests
- Field-level validation details when applicable
HTTP Status Codes
200 OK
Request successful.201 Created
Resource created successfully.400 Bad Request
Invalid request format or parameters. Check the error details for specific issues.401 Unauthorized
Authentication failed or missing. Verify your API key.403 Forbidden
Not authorized to access this resource. Check permissions or project status.404 Not Found
The requested resource does not exist. Verify the resource ID.422 Unprocessable Entity
Request validation failed. Check theerrors array for field-level details.
429 Too Many Requests
Rate limit exceeded. Wait before retrying or upgrade your plan.500 Internal Server Error
An unexpected server error occurred. Contact support with the request ID.Error Response Format
All errors follow this standardized format:Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Always false for errors |
error.code | string | Machine-readable error code (see below) |
error.message | string | Human-readable error description |
error.statusCode | number | HTTP status code |
error.requestId | string | Unique request identifier for debugging |
error.errors | array | Field-level validation errors (validation errors only) |
error.details | object | Additional context about the error (optional) |
error.suggestion | string | Helpful guidance for fixing the error (optional) |
timestamp | string | ISO 8601 timestamp when the error occurred |
Error Codes Reference
All errors include a machine-readablecode field for programmatic handling. Here are all possible error codes:
Authentication & Authorization
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | General authentication failure |
INVALID_CREDENTIALS | 401 | Login credentials are incorrect |
MISSING_AUTH | 401 | Authorization header is missing or malformed |
INVALID_API_KEY | 401 | API key is invalid or not found |
FORBIDDEN | 403 | Not allowed to perform this action |
PROJECT_ACCESS_DENIED | 403 | No access to this project |
PROJECT_DISABLED | 403 | Project has been disabled |
Validation & Input Errors
| Code | Status | Description |
|---|---|---|
BAD_REQUEST | 400 | General request error |
VALIDATION_ERROR | 422 | Request validation failed (includes field errors) |
INVALID_EMAIL | 422 | Email format is invalid |
INVALID_REQUEST_BODY | 400 | Request body is malformed |
MISSING_REQUIRED_FIELD | 422 | Required field is missing |
Resource Errors
| Code | Status | Description |
|---|---|---|
RESOURCE_NOT_FOUND | 404 | Generic resource not found |
CONTACT_NOT_FOUND | 404 | Contact does not exist |
TEMPLATE_NOT_FOUND | 404 | Template does not exist |
CAMPAIGN_NOT_FOUND | 404 | Campaign does not exist |
WORKFLOW_NOT_FOUND | 404 | Workflow does not exist |
CONFLICT | 409 | Resource conflict (e.g., duplicate) |
Rate Limiting & Billing
| Code | Status | Description |
|---|---|---|
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
BILLING_LIMIT_EXCEEDED | 402 | Billing limit reached |
UPGRADE_REQUIRED | 402 | Feature requires plan upgrade |
Server Errors
| Code | Status | Description |
|---|---|---|
INTERNAL_SERVER_ERROR | 500 | Unexpected server error |
DATABASE_ERROR | 500 | Database operation failed |
EXTERNAL_SERVICE_ERROR | 500 | External service unavailable |
Common Error Examples
Authentication Errors
Invalid API Key
sk_, while tracking endpoints use pk_ keys.
Missing Authorization Header
Authorization header with your API key in Bearer token format.
Validation Errors
Invalid Email Format
errors array shows which fields failed validation.
Missing Required Fields
Resource Errors
Template Not Found
Rate Limiting
Rate Limit Exceeded
Success Response Format
Successful API requests return a standardized format withsuccess: true and a data object:
Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Always true for successful requests |
data | object | Response data specific to the endpoint |
Handling Errors in Your Code
JavaScript/TypeScript Example
Python Example
Troubleshooting Guide
Using Request IDs
Every error includes a uniquerequestId that traces the request through our entire system. Request IDs enable:
For Developers:
- Every log entry includes the request ID
- You can grep logs to find all entries for a specific request
- Trace a request from API → Database → Queue → Worker
- Include the request ID in your message
- Describe what you were trying to do
- Share the full error response if possible
f47ac10b-58cc-4372-a567-0e02b2c3d479, we can search our logs for that ID and see:
- The exact request body you sent
- Which database queries were executed
- Any background jobs that were triggered
- The full error stack trace (if applicable)
How to Find Request IDs
Request IDs are included in:- Error responses:
error.requestIdfield - Response headers:
X-Request-IDheader (also included in successful responses) - Your application logs: Include the header in your logs for correlation
Common Issues and Solutions
Authentication Issues (401)
Problem:INVALID_API_KEY or MISSING_AUTH
Solutions:
- Verify your API key is copied correctly (no extra spaces)
- Check you’re using the right key type (
sk_for secret,pk_for public) - Ensure the
Authorizationheader uses Bearer token format - Verify the key hasn’t been revoked or regenerated
Validation Issues (422)
Problem:VALIDATION_ERROR with field errors
Solutions:
- Check the
errorsarray for specific field issues - Verify all required fields are included
- Ensure field types match (strings quoted, numbers unquoted)
- Review the API reference for correct request format
Not Found Issues (404)
Problem:TEMPLATE_NOT_FOUND, CONTACT_NOT_FOUND, etc.
Solutions:
- Verify the resource ID is correct
- Check the resource belongs to your project
- Ensure the resource hasn’t been deleted
- List available resources via the API to confirm IDs
Rate Limit Issues (429)
Problem:RATE_LIMIT_EXCEEDED
Solutions:
- Implement exponential backoff (wait 1s, 2s, 4s, 8s between retries)
- Reduce request frequency
- Consider upgrading your plan for higher limits
- Batch operations when possible
Server Errors (500)
Problem:INTERNAL_SERVER_ERROR
Solutions:
- Note the request ID from the error response
- Wait a moment and retry the request
- Check status.mailrify.com for incidents
- Contact support with the request ID if the issue persists
Best Practices
- Always check the
successfield before processing responses - Log request IDs for debugging and support requests
- Handle errors gracefully with user-friendly messages
- Implement retry logic with exponential backoff for transient errors
- Monitor error rates to detect issues early
- Use error codes for programmatic error handling, not just status codes
Getting Help
If you continue experiencing issues:- Review the error
suggestionfield for guidance - Check the API Reference for correct usage
- Search our documentation for your specific error code
- Contact support with your request ID
- Join our community for help from other developers

