Create a reply draft
Creates an unsent reply draft for an inbound message. Unlike the
/actions/reply endpoint, which sends immediately, this stores a draft that can
be reviewed and edited before sending.
reply_to_message_id and thread_id are inherited from the parent message and
cannot be set by the caller. The recipient, Re: subject and
In-Reply-To/References headers are pre-filled from the parent using the same
rules as a live reply, so sending the draft threads identically. Supplying to
or subject explicitly overrides the pre-filled value.
POST
/
email_inboxes
/
{inbox_id}
/
messages
/
{message_id}
/
drafts
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.messages.drafts('inbox_id', 'message_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.messages.drafts(
inbox_id="inbox_id",
message_id="message_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.Messages.Drafts(
context.TODO(),
"inbox_id",
"message_id",
telnyx.EmailInboxeMessageDraftsParams{
},
)
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;
import com.telnyx.sdk.models.emailInboxes.messages.MessageDraftsParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessageDraftsParams params = MessageDraftsParams.builder()
.build();
var response = client.emailInboxes().messages().drafts("inbox_id", "message_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.messages.drafts("inbox_id", "message_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->messages->drafts(
'inbox_id',
'message_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:messages drafts \
--api-key 'My API Key' \
--inbox-id inbox_id \
--message-id message_idcurl --request POST \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/messages/{message_id}/drafts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text_body": "Thanks for the update — I will review today."
}
'{
"data": {
"record_type": "email_draft",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"inbox_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "draft",
"from": "string",
"from_name": "string",
"to": [
{
"email": "string",
"name": "string"
}
],
"cc": [
{
"email": "string",
"name": "string"
}
],
"bcc": [
{
"email": "string",
"name": "string"
}
],
"reply_to": "string",
"subject": "string",
"text_body": "string",
"html_body": "string",
"attachments": [],
"labels": [
"string"
],
"tags": [
"string"
],
"reply_to_message_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"thread_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"sent_message_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"sent_at": "2024-01-23T18:10:02.574Z",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"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": "10015",
"title": "Validation Failed",
"detail": "subject can't be blank",
"source": {
"pointer": "/data/attributes/subject"
}
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "Drafts are temporarily unavailable. Please try again later."
}
]
}Authorizations
Path Parameters
Body
application/json
All fields are optional — a draft may be saved incomplete. account_id,
inbox_id, status, sent_at, sent_message_id, reply_to_message_id and
thread_id are server-owned and ignored if supplied.
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.messages.drafts('inbox_id', 'message_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.messages.drafts(
inbox_id="inbox_id",
message_id="message_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.Messages.Drafts(
context.TODO(),
"inbox_id",
"message_id",
telnyx.EmailInboxeMessageDraftsParams{
},
)
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;
import com.telnyx.sdk.models.emailInboxes.messages.MessageDraftsParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessageDraftsParams params = MessageDraftsParams.builder()
.build();
var response = client.emailInboxes().messages().drafts("inbox_id", "message_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.email_inboxes.messages.drafts("inbox_id", "message_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->messages->drafts(
'inbox_id',
'message_id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx email-inboxes:messages drafts \
--api-key 'My API Key' \
--inbox-id inbox_id \
--message-id message_idcurl --request POST \
--url https://api.telnyx.com/v2/email_inboxes/{inbox_id}/messages/{message_id}/drafts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text_body": "Thanks for the update — I will review today."
}
'{
"data": {
"record_type": "email_draft",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"inbox_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "draft",
"from": "string",
"from_name": "string",
"to": [
{
"email": "string",
"name": "string"
}
],
"cc": [
{
"email": "string",
"name": "string"
}
],
"bcc": [
{
"email": "string",
"name": "string"
}
],
"reply_to": "string",
"subject": "string",
"text_body": "string",
"html_body": "string",
"attachments": [],
"labels": [
"string"
],
"tags": [
"string"
],
"reply_to_message_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"thread_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"sent_message_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"sent_at": "2024-01-23T18:10:02.574Z",
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"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": "10015",
"title": "Validation Failed",
"detail": "subject can't be blank",
"source": {
"pointer": "/data/attributes/subject"
}
}
]
}{
"errors": [
{
"code": "10016",
"title": "Service Unavailable",
"detail": "Drafts are temporarily unavailable. Please try again later."
}
]
}