Send a draft
Sends the draft through the standard send pipeline — the same domain resolution,
suppression, reputation, daily-quota, persistence and Detail Record behaviour as
POST /v2/email_messages. The response body is the created email message.
If the draft has no explicit from_email, the inbox address is used.
The draft is marked sent only after the send is accepted; a send rejected for
suppression, quota or reputation leaves the draft editable so it can be fixed and
retried. A draft that is already sent returns 422 rather than sending twice.
POST
/
email_inboxes
/
{inbox_id}
/
drafts
/
{draft_id}
/
send
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.emailInboxes.drafts.send('inbox_id', 'draft_id');
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.email_inboxes.drafts.send(
"inbox_id",
"draft_id",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.EmailInboxes.Drafts.Send(
context.TODO(),
"inbox_id",
"draft_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
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();
var response = client.emailInboxes().drafts().send("inbox_id", "draft_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.drafts.send("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->send(
'inbox_id',
'draft_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:drafts send \
--api-key 'My API Key' \
--inbox-id inbox_id \
--draft-id draft_idcurl --request POST \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/drafts/{draft_id}/send \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued",
"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": [
{
"type": "queued",
"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": "The request failed because it was not well-formed."
}
]
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "<string>",
"detail": "<string>",
"source": {},
"meta": {}
}
],
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "this draft has already been sent",
"source": {
"pointer": "/data/attributes/status"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "<string>",
"detail": "<string>",
"source": {},
"meta": {}
}
],
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"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.
Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.emailInboxes.drafts.send('inbox_id', 'draft_id');
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.email_inboxes.drafts.send(
"inbox_id",
"draft_id",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.EmailInboxes.Drafts.Send(
context.TODO(),
"inbox_id",
"draft_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
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();
var response = client.emailInboxes().drafts().send("inbox_id", "draft_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.drafts.send("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->send(
'inbox_id',
'draft_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:drafts send \
--api-key 'My API Key' \
--inbox-id inbox_id \
--draft-id draft_idcurl --request POST \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/drafts/{draft_id}/send \
--header 'Authorization: Bearer <token>'{
"data": {
"record_type": "email_message",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "queued",
"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": [
{
"type": "queued",
"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": "The request failed because it was not well-formed."
}
]
}{
"errors": [
{
"code": "10006",
"title": "Not authorized",
"detail": "Invalid API key",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10006"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "<string>",
"detail": "<string>",
"source": {},
"meta": {}
}
],
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"errors": [
{
"code": "10001",
"title": "Not Found",
"detail": "The requested resource was not found"
}
]
}{
"errors": [
{
"code": "10015",
"title": "Validation Failed",
"detail": "this draft has already been sent",
"source": {
"pointer": "/data/attributes/status"
}
}
]
}{
"errors": [
{
"code": "10001",
"title": "<string>",
"detail": "<string>",
"source": {},
"meta": {}
}
],
"suppressed": [
{
"to": "jsmith@example.com",
"reason": "<string>",
"scope": "<string>",
"override_allowed": true
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "Drafts are temporarily unavailable. Please try again later."
}
]
}