Overview

The ParcelShield API uses conventional HTTP response codes to indicate the success or failure of API requests. In general:

  • Codes in the 2xx range indicate success
  • Codes in the 4xx range indicate an error that occurred due to the information provided
  • Codes in the 5xx range indicate an error with ParcelShield’s servers

All error responses will include a message providing more details about the error.

Error Response Format

{
  "error": {
    "code": "invalid_request",
    "message": "The request was invalid",
    "details": {
      "field": "tracking_number",
      "reason": "tracking_number is required"
    }
  }
}

HTTP Status Codes

200 - OK
success

The request was successful.

400 - Bad Request
error

The request was invalid or cannot be served. The exact error is explained in the error message.

401 - Unauthorized
error

Authentication credentials are missing or invalid.

403 - Forbidden
error

The request is understood but it has been refused due to permissions.

404 - Not Found
error

The requested resource does not exist.

429 - Too Many Requests
error

Too many requests hit the API too quickly. We recommend implementing exponential backoff.

500 - Server Error
error

Something went wrong on our end. Try again later or contact support if the problem persists.

Common Error Codes

Rate Limits

Our API implements rate limiting to ensure stability and fair usage. Rate limits are applied on a per-API key basis.

The following headers are included in all API responses:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1640995200

If you exceed the rate limit, you’ll receive a 429 Too Many Requests response. The response will include a Retry-After header indicating how long to wait before making another request.

Best Practices

1

Implement Retry Logic

Implement exponential backoff when receiving rate limit errors or 5xx responses.

2

Handle All Status Codes

Your application should handle all possible HTTP status codes that our API might return.

3

Parse Error Messages

Always parse and log the error message from the response body for debugging.

4

Monitor Rate Limits

Keep track of rate limit headers to avoid hitting limits in production.

Need Help?

Contact Support

If you’re experiencing persistent issues or need help debugging an error, please contact our support team.