Skip to main content

Overview

Robust error handling is critical for production integrations. This guide covers common error scenarios, retry strategies, and best practices for building resilient applications.

Error Response Format

All Day Copilot API errors follow a consistent format:
Key Fields:
  • error: Error category (e.g., “Validation Error”, “Not Found”)
  • message: Detailed explanation
  • status: HTTP status code
  • correlationId: Unique ID for support/debugging
  • details: Additional context (optional)

HTTP Status Codes

Common Error Scenarios

1. Authentication Errors (401)

Cause: Invalid or expired token
Solution:

2. Validation Errors (422)

Cause: Request body doesn’t meet validation requirements
Solution:

3. Not Found Errors (404)

Cause: Resource doesn’t exist or user lacks access (RLS)
Important: For security reasons, Day Copilot returns 404 (not 403) when you lack access to a resource. Solution:

4. Conflict Errors (409)

Cause: Draft conflict - another version was published
Solution:

5. Rate Limit Errors (429)

Cause: Too many requests in time window
Response Headers:
Solution:

6. Server Errors (500, 503)

Cause: Temporary server issues or maintenance
Solution:

Retry Strategies

Exponential Backoff

Circuit Breaker Pattern

Logging & Debugging

Using Correlation IDs

Error Monitoring

Best Practices

Log enough information to debug issues:
For transient errors (rate limits, server issues), use exponential backoff instead of immediate retries.
  • Retriable: 429, 500, 503, network errors
  • Non-retriable: 400, 401, 403, 404, 422
Don’t waste resources retrying validation errors.
Implement circuit breakers to prevent cascading failures when the API is experiencing issues.
Always save correlation IDs from error responses. They’re essential for support tickets and debugging.
When API calls fail, provide fallback behavior:

Production-Ready Error Handling

Complete example with all best practices:

Next Steps

Rate Limits

Understand rate limiting policies

Authentication

Learn about token management

First API Call

Step-by-step tutorial

API Reference

Complete endpoint documentation