Delete a draft
Permanently deletes an unsent draft. Drafts that are being sent or have been sent cannot be deleted; sent drafts are retained for audit.
DELETE
/
email_inboxes
/
{inbox_id}
/
drafts
/
{draft_id}
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.emailInboxes.drafts.delete('inbox_id', 'draft_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_inboxes.drafts.delete(
"inbox_id",
"draft_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.EmailInboxes.Drafts.Delete(
context.TODO(),
"inbox_id",
"draft_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.emailInboxes().drafts().delete("inbox_id", "draft_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.drafts.delete("inbox_id", "draft_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->emailInboxes->drafts->delete(
'inbox_id',
'draft_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:drafts delete \
--api-key 'My API Key' \
--inbox-id inbox_id \
--draft-id draft_idcurl --request DELETE \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/drafts/{draft_id} \
--header 'Authorization: Bearer <token>'{
"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"
}
]
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "Drafts are temporarily unavailable. Please try again later."
}
]
}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 inbox UUID.
Email draft UUID.
Response
The draft was deleted.
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.emailInboxes.drafts.delete('inbox_id', 'draft_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_inboxes.drafts.delete(
"inbox_id",
"draft_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.EmailInboxes.Drafts.Delete(
context.TODO(),
"inbox_id",
"draft_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.emailInboxes().drafts().delete("inbox_id", "draft_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.drafts.delete("inbox_id", "draft_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->emailInboxes->drafts->delete(
'inbox_id',
'draft_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:drafts delete \
--api-key 'My API Key' \
--inbox-id inbox_id \
--draft-id draft_idcurl --request DELETE \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/drafts/{draft_id} \
--header 'Authorization: Bearer <token>'{
"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"
}
]
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "Drafts are temporarily unavailable. Please try again later."
}
]
}