API Reference
Programmatically manage OOO sessions, emails, and playbooks.
Base URL
https://withdrift.io/api/v1All API requests require a valid API key passed in the Authorization header as a Bearer token.
curl https://withdrift.io/api/v1/ooo-sessions \ -H "Authorization: Bearer drift_your_api_key_here"
When creating an API key, you select which scopes to grant. Each endpoint requires specific scopes:
| Scope | Access |
|---|---|
read:ooo | List and retrieve OOO sessions |
write:ooo | Create, update, and delete OOO sessions |
read:emails | List emails from OOO sessions |
read:playbook | List and retrieve return playbooks |
API requests are limited to 100 requests per minute per API key. Rate limit status is returned in response headers:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per minute |
X-RateLimit-Remaining | Remaining requests in current window |
Retry-After | Seconds to wait before retrying (only on 429) |
Errors return a JSON body with an error object containing a message and code:
{
"error": {
"message": "OOO session not found",
"code": "NOT_FOUND"
}
}| Status | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid or missing request parameters |
| 401 | UNAUTHORIZED | Missing or invalid Authorization header |
| 401 | INVALID_API_KEY | API key is invalid or revoked |
| 403 | INSUFFICIENT_SCOPE | API key lacks required scopes |
| 403 | FEATURE_NOT_AVAILABLE | API access requires Team Growth plan |
| 404 | NOT_FOUND | Resource does not exist |
| 409 | CONFLICT | Overlapping OOO session |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests |
| 500 | INTERNAL_ERROR | Unexpected server error |
/api/v1/ooo-sessionsRetrieve a paginated list of your OOO sessions.
| Parameter | Type | Default | Description |
|---|---|---|---|
status | string | — | Filter by status: scheduled, active, or completed |
limit | integer | 20 | Results per page (max 100) |
offset | integer | 0 | Number of results to skip |
{
"data": [
{
"id": "sess_abc123",
"start_date": "2026-03-20T00:00:00.000Z",
"end_date": "2026-03-27T00:00:00.000Z",
"return_date": "2026-03-28T00:00:00.000Z",
"status": "scheduled",
"stats": {
"emails_received": 0,
"emails_filtered": 0,
"urgent_count": 0
},
"playbook_id": null,
"created_at": "2026-03-15T10:30:00.000Z"
}
],
"pagination": {
"total": 1,
"limit": 20,
"offset": 0,
"has_more": false
}
}/api/v1/ooo-sessions/:idRetrieve a specific OOO session with playbook details.
{
"id": "sess_abc123",
"start_date": "2026-03-20T00:00:00.000Z",
"end_date": "2026-03-27T00:00:00.000Z",
"return_date": "2026-03-28T00:00:00.000Z",
"status": "completed",
"auto_reply_message": "I'm currently out of office...",
"stats": {
"emails_received": 142,
"emails_filtered": 98,
"urgent_count": 3,
"total_emails_synced": 142
},
"playbook": {
"id": "pb_xyz789",
"summary": "You received 142 emails...",
"action_items": [...],
"fyi_items": [...],
"resolved_items": [...],
"stats": {
"total_emails": 142,
"filtered_emails": 98,
"time_saved_minutes": 240
},
"delivered_at": "2026-03-28T06:00:00.000Z",
"viewed_at": "2026-03-28T08:15:00.000Z"
},
"created_at": "2026-03-15T10:30:00.000Z",
"updated_at": "2026-03-27T23:59:00.000Z"
}/api/v1/ooo-sessionsSchedule a new OOO session.
| Field | Type | Required | Description |
|---|---|---|---|
start_date | string (ISO 8601) | Yes | Start date of OOO period |
end_date | string (ISO 8601) | Yes | End date of OOO period |
auto_reply_message | string | No | Custom auto-reply message |
curl -X POST https://withdrift.io/api/v1/ooo-sessions \
-H "Authorization: Bearer drift_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"start_date": "2026-03-20T00:00:00.000Z",
"end_date": "2026-03-27T00:00:00.000Z",
"auto_reply_message": "I am out of office until March 27."
}'/api/v1/ooo-sessions/:idUpdate a scheduled or active OOO session.
| Field | Type | Description |
|---|---|---|
start_date | string (ISO 8601) | New start date |
end_date | string (ISO 8601) | New end date |
auto_reply_message | string | Updated auto-reply message |
status | string | Set to cancelled to cancel a scheduled session |
status field./api/v1/ooo-sessions/:idDelete a scheduled OOO session.
Only sessions with scheduled status can be deleted. Active sessions must be ended, not deleted.
curl -X DELETE https://withdrift.io/api/v1/ooo-sessions/sess_abc123 \ -H "Authorization: Bearer drift_your_api_key_here"
/api/v1/emailsRetrieve emails captured during OOO sessions.
| Parameter | Type | Default | Description |
|---|---|---|---|
session_id | string | — | Filter by OOO session |
category | string | — | Filter: urgent, action_required, fyi, newsletter, promotional, resolved |
limit | integer | 50 | Results per page (max 100) |
offset | integer | 0 | Number of results to skip |
{
"data": [
{
"id": "em_abc123",
"external_id": "18abc123def",
"session_id": "sess_abc123",
"thread_id": "thread_xyz",
"subject": "Q1 Budget Review - Action Needed",
"from_email": "manager@company.com",
"from_name": "Jane Smith",
"category": "action_required",
"urgency_score": 8,
"ai_summary": "Manager requesting budget approval by Friday.",
"auto_replied": true,
"received_at": "2026-03-22T14:30:00.000Z",
"created_at": "2026-03-22T14:31:00.000Z"
}
],
"pagination": {
"total": 142,
"limit": 50,
"offset": 0,
"has_more": true
}
}/api/v1/playbooksRetrieve your return playbooks.
| Parameter | Type | Default | Description |
|---|---|---|---|
session_id | string | — | Filter by OOO session |
limit | integer | 20 | Results per page (max 100) |
offset | integer | 0 | Number of results to skip |
{
"data": [
{
"id": "pb_xyz789",
"ooo_session_id": "sess_abc123",
"summary": "You received 142 emails during your week away...",
"action_items": [...],
"fyi_items": [...],
"resolved_items": [...],
"stats": {
"total_emails": 142,
"filtered_emails": 98,
"time_saved_minutes": 240
},
"delivered_at": "2026-03-28T06:00:00.000Z",
"viewed_at": "2026-03-28T08:15:00.000Z",
"created_at": "2026-03-28T06:00:00.000Z"
}
],
"pagination": {
"total": 1,
"limit": 20,
"offset": 0,
"has_more": false
}
}Need help? Contact hello@withdrift.io