DELETE
/
api
/
v2
/
emails
/
schedule
/
{id}
import { Inbound } from '@inboundemail/sdk';

const inbound = new Inbound('your_api_key');

// Cancel a scheduled email
const { data, error } = await inbound.email.sent.cancel('sch_1234567890abcdef');

if (error) {
  console.error('Error:', error);
} else {
  console.log('Email cancelled:', data.id);
  console.log('Status:', data.status);
  console.log('Cancelled at:', data.cancelled_at);
}
{
  "id": "sch_1234567890abcdef",
  "status": "cancelled",
  "cancelled_at": "2024-12-24T15:30:45.123Z"
}
This endpoint allows you to cancel a scheduled email that has not been sent yet. Only emails with status ‘scheduled’ can be cancelled.

Authentication

This endpoint requires authentication via:
  • API key auth: Bearer token in Authorization header

Path Parameters

id
string
required
Unique identifier of the scheduled email to cancel.

Headers

Authorization
string
required
Bearer token for API authentication.

Request Example

import { Inbound } from '@inboundemail/sdk';

const inbound = new Inbound('your_api_key');

// Cancel a scheduled email
const { data, error } = await inbound.email.sent.cancel('sch_1234567890abcdef');

if (error) {
  console.error('Error:', error);
} else {
  console.log('Email cancelled:', data.id);
  console.log('Status:', data.status);
  console.log('Cancelled at:', data.cancelled_at);
}

Response

id
string
required
Unique identifier of the cancelled scheduled email.
status
string
required
New status of the email (always “cancelled” for successful cancellations).
cancelled_at
string
required
ISO 8601 timestamp of when the email was cancelled.
{
  "id": "sch_1234567890abcdef",
  "status": "cancelled",
  "cancelled_at": "2024-12-24T15:30:45.123Z"
}

Usage Examples

Important Notes

Status Restrictions: Only emails with status ‘scheduled’ can be cancelled. Emails that have been sent, failed, or already cancelled cannot be cancelled.
Immediate Effect: Cancellation takes effect immediately. The scheduled email will not be sent at its scheduled time.
Access Control: You can only cancel scheduled emails that belong to your account.
Check Status First: If you’re unsure about the email’s current status, use the Get Scheduled Email endpoint first.
1.0 - ✅