Cancel a scheduled email message
Cancels a scheduled email and returns it with status cancelled. The legacy /v2/emails/{id}/schedule DELETE route is an alias.
DELETE
/
email_messages
/
{email_id}
/
schedule
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
await client.emailMessages.deleteSchedule('email_id');import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.email_messages.delete_schedule(
"email_id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.EmailMessages.DeleteSchedule(
context.TODO(),
"email_id",
)
if err != nil {
panic(err.Error())
}
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
client.emailMessages().deleteSchedule("email_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_messages.delete_schedule("email_id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->emailMessages->deleteSchedule(
'email_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-messages delete-schedule \
--api-key 'My API Key' \
--email-id email_idcurl --request DELETE \
--url https://api.telnyx.com/v2/email_messages/{email_id}/schedule \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from": {
"email": "<string>",
"name": "<string>"
},
"to": [
{
"email": "<string>",
"name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"name": "<string>"
}
],
"reply_to": "<string>",
"subject": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_variables": {},
"attachments": [
{
"url": "<string>",
"sha256": "<string>",
"size_bytes": 123,
"filename": "<string>",
"content_type": "<string>",
"disposition": "attachment",
"content_id": "<string>"
}
],
"events": [
{
"occurred_at": "2023-11-07T05:31:56Z",
"payload": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"scheduled_at": "2023-11-07T05:31:56Z",
"inline_css": true,
"sandbox": true,
"recipient_statuses": {
"delivered": 998,
"bounced": 2
}
},
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "email is required"
}
]
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}Authorizations
Telnyx API key supplied as Authorization: Bearer <token>. In production, auth may be validated by the API gateway and forwarded via Telnyx auth headers.
Path Parameters
Email message UUID.
Was this page helpful?
โI
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
await client.emailMessages.deleteSchedule('email_id');import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.email_messages.delete_schedule(
"email_id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.EmailMessages.DeleteSchedule(
context.TODO(),
"email_id",
)
if err != nil {
panic(err.Error())
}
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
client.emailMessages().deleteSchedule("email_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_messages.delete_schedule("email_id")
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->emailMessages->deleteSchedule(
'email_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-messages delete-schedule \
--api-key 'My API Key' \
--email-id email_idcurl --request DELETE \
--url https://api.telnyx.com/v2/email_messages/{email_id}/schedule \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"from": {
"email": "<string>",
"name": "<string>"
},
"to": [
{
"email": "<string>",
"name": "<string>"
}
],
"cc": [
{
"email": "<string>",
"name": "<string>"
}
],
"bcc": [
{
"email": "<string>",
"name": "<string>"
}
],
"reply_to": "<string>",
"subject": "<string>",
"template_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"template_variables": {},
"attachments": [
{
"url": "<string>",
"sha256": "<string>",
"size_bytes": 123,
"filename": "<string>",
"content_type": "<string>",
"disposition": "attachment",
"content_id": "<string>"
}
],
"events": [
{
"occurred_at": "2023-11-07T05:31:56Z",
"payload": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"scheduled_at": "2023-11-07T05:31:56Z",
"inline_css": true,
"sandbox": true,
"recipient_statuses": {
"delivered": 998,
"bounced": 2
}
},
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "email is required"
}
]
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}