import { Resend } from 'resend';const resend = new Resend('re_xxxxxxxxx');const { data, error } = await resend.inboxes.drafts.create({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', to: ['ada@example.org'], subject: 'Refund for order 1041', html: '<p>Refund issued for order 1041.</p>', text: 'Refund issued for order 1041.', attachments: [ { filename: 'note.txt', content: 'aGVsbG8=', contentType: 'text/plain', }, ],});
$resend = Resend::client('re_xxxxxxxxx');$resend->inboxes->drafts->create('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'to' => ['ada@example.org'], 'subject' => 'Refund for order 1041', 'html' => '<p>Refund issued for order 1041.</p>', 'text' => 'Refund issued for order 1041.', 'attachments' => [ [ 'filename' => 'note.txt', 'content' => 'aGVsbG8=', 'content_type' => 'text/plain', ], ],]);
import resendresend.api_key = "re_xxxxxxxxx"params: resend.Inboxes.Drafts.CreateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "<p>Refund issued for order 1041.</p>", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain", } ],}resend.Inboxes.Drafts.create(params)
require "resend"Resend.api_key = "re_xxxxxxxxx"params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", to: ["ada@example.org"], subject: "Refund for order 1041", html: "<p>Refund issued for order 1041.</p>", text: "Refund issued for order 1041.", attachments: [{ filename: "note.txt", content: "aGVsbG8=", content_type: "text/plain" }]}Resend::Inboxes::Drafts.create(params)
package mainimport "github.com/resend/resend-go/v4"func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateInboxDraftRequest{ To: []string{"ada@example.org"}, Subject: "Refund for order 1041", Html: "<p>Refund issued for order 1041.</p>", Text: "Refund issued for order 1041.", Attachments: []*resend.InboxDraftAttachmentInput{ { Content: []byte("hello"), Filename: "note.txt", ContentType: "text/plain", }, }, } client.Inboxes.Drafts.Create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params)}
use resend_rs::{ types::{CreateInboxDraftAttachment, CreateInboxDraftOptions}, Resend, Result,};#[tokio::main]async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateInboxDraftOptions::new() .with_to(["ada@example.org"]) .with_subject("Refund for order 1041") .with_html("<p>Refund issued for order 1041.</p>") .with_text("Refund issued for order 1041.") .with_attachment(CreateInboxDraftAttachment::new( b"hello".to_vec(), "note.txt", "text/plain", )); let _draft = resend .inboxes .create_draft("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", opts) .await?; Ok(())}
import com.resend.Resend;import com.resend.core.exception.ResendException;import com.resend.services.emails.model.Attachment;import com.resend.services.inboxes.model.CreateInboxDraftOptions;import com.resend.services.inboxes.model.CreateInboxDraftResponseSuccess;public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateInboxDraftOptions params = CreateInboxDraftOptions.builder() .to("ada@example.org") .subject("Refund for order 1041") .html("<p>Refund issued for order 1041.</p>") .text("Refund issued for order 1041.") .attachments(Attachment.builder() .fileName("note.txt") .content("aGVsbG8=") .contentType("text/plain") .build()) .build(); CreateInboxDraftResponseSuccess data = resend.inboxes().drafts() .create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); }}
using Resend;IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DIvar resp = await resend.InboxDraftCreateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxDraftCreateData() { To = "ada@example.org", Subject = "Refund for order 1041", HtmlBody = "<p>Refund issued for order 1041.</p>", TextBody = "Refund issued for order 1041.", Attachments = [ new EmailAttachment() { Filename = "note.txt", Content = System.Text.Encoding.UTF8.GetBytes( "hello" ), ContentType = "text/plain", }, ], });Console.WriteLine( "Draft Id={0}", resp.Content );
curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "<p>Refund issued for order 1041.</p>", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain" } ]}'
curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "reply_to_email_id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "text": "Refund issued for order 1041."}'
resend inboxes drafts create b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --to ada@example.org \ --subject "Refund for order 1041" \ --html "<p>Refund issued for order 1041.</p>" \ --text "Refund issued for order 1041." \ --attachment "./note.txt;type=text/plain"
Create a draft in an inbox, either to start a new thread or reply to an existing thread.
POST
/
inboxes
/
:inbox_id
/
drafts
import { Resend } from 'resend';const resend = new Resend('re_xxxxxxxxx');const { data, error } = await resend.inboxes.drafts.create({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', to: ['ada@example.org'], subject: 'Refund for order 1041', html: '<p>Refund issued for order 1041.</p>', text: 'Refund issued for order 1041.', attachments: [ { filename: 'note.txt', content: 'aGVsbG8=', contentType: 'text/plain', }, ],});
$resend = Resend::client('re_xxxxxxxxx');$resend->inboxes->drafts->create('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'to' => ['ada@example.org'], 'subject' => 'Refund for order 1041', 'html' => '<p>Refund issued for order 1041.</p>', 'text' => 'Refund issued for order 1041.', 'attachments' => [ [ 'filename' => 'note.txt', 'content' => 'aGVsbG8=', 'content_type' => 'text/plain', ], ],]);
import resendresend.api_key = "re_xxxxxxxxx"params: resend.Inboxes.Drafts.CreateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "<p>Refund issued for order 1041.</p>", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain", } ],}resend.Inboxes.Drafts.create(params)
require "resend"Resend.api_key = "re_xxxxxxxxx"params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", to: ["ada@example.org"], subject: "Refund for order 1041", html: "<p>Refund issued for order 1041.</p>", text: "Refund issued for order 1041.", attachments: [{ filename: "note.txt", content: "aGVsbG8=", content_type: "text/plain" }]}Resend::Inboxes::Drafts.create(params)
package mainimport "github.com/resend/resend-go/v4"func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateInboxDraftRequest{ To: []string{"ada@example.org"}, Subject: "Refund for order 1041", Html: "<p>Refund issued for order 1041.</p>", Text: "Refund issued for order 1041.", Attachments: []*resend.InboxDraftAttachmentInput{ { Content: []byte("hello"), Filename: "note.txt", ContentType: "text/plain", }, }, } client.Inboxes.Drafts.Create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params)}
use resend_rs::{ types::{CreateInboxDraftAttachment, CreateInboxDraftOptions}, Resend, Result,};#[tokio::main]async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateInboxDraftOptions::new() .with_to(["ada@example.org"]) .with_subject("Refund for order 1041") .with_html("<p>Refund issued for order 1041.</p>") .with_text("Refund issued for order 1041.") .with_attachment(CreateInboxDraftAttachment::new( b"hello".to_vec(), "note.txt", "text/plain", )); let _draft = resend .inboxes .create_draft("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", opts) .await?; Ok(())}
import com.resend.Resend;import com.resend.core.exception.ResendException;import com.resend.services.emails.model.Attachment;import com.resend.services.inboxes.model.CreateInboxDraftOptions;import com.resend.services.inboxes.model.CreateInboxDraftResponseSuccess;public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateInboxDraftOptions params = CreateInboxDraftOptions.builder() .to("ada@example.org") .subject("Refund for order 1041") .html("<p>Refund issued for order 1041.</p>") .text("Refund issued for order 1041.") .attachments(Attachment.builder() .fileName("note.txt") .content("aGVsbG8=") .contentType("text/plain") .build()) .build(); CreateInboxDraftResponseSuccess data = resend.inboxes().drafts() .create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); }}
using Resend;IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DIvar resp = await resend.InboxDraftCreateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxDraftCreateData() { To = "ada@example.org", Subject = "Refund for order 1041", HtmlBody = "<p>Refund issued for order 1041.</p>", TextBody = "Refund issued for order 1041.", Attachments = [ new EmailAttachment() { Filename = "note.txt", Content = System.Text.Encoding.UTF8.GetBytes( "hello" ), ContentType = "text/plain", }, ], });Console.WriteLine( "Draft Id={0}", resp.Content );
curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "<p>Refund issued for order 1041.</p>", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain" } ]}'
curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "reply_to_email_id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "text": "Refund issued for order 1041."}'
resend inboxes drafts create b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --to ada@example.org \ --subject "Refund for order 1041" \ --html "<p>Refund issued for order 1041.</p>" \ --text "Refund issued for order 1041." \ --attachment "./note.txt;type=text/plain"
A draft lets you prepare a message before sending it.Omit thread_id and reply_to_email_id to start a new thread. Pass both for a
reply draft.An email can have only one unsent reply draft. A request for an email that
already has one returns a 200 with the existing Draft ID. It changes only the
attachments of that draft.
Recipients. For multiple addresses, send an array of strings. Each value can
include a friendly name, for example Ada Lovelace <ada@example.org>. On a
reply draft, when you omit to or send null, the draft gets the recipients
of a reply. Send [] for no
recipients.
Files to store on the draft, up to 25 MB in total, downloaded files
included. All path downloads must finish within 20 seconds together.
Drafts do not accept content_id.
Path where the attachment file is hosted. Resend downloads it when the
draft is saved, so a URL that cannot be downloaded returns an error. When
both content and path are sent, content is used.
import { Resend } from 'resend';const resend = new Resend('re_xxxxxxxxx');const { data, error } = await resend.inboxes.drafts.create({ inboxId: 'b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', to: ['ada@example.org'], subject: 'Refund for order 1041', html: '<p>Refund issued for order 1041.</p>', text: 'Refund issued for order 1041.', attachments: [ { filename: 'note.txt', content: 'aGVsbG8=', contentType: 'text/plain', }, ],});
$resend = Resend::client('re_xxxxxxxxx');$resend->inboxes->drafts->create('b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1', [ 'to' => ['ada@example.org'], 'subject' => 'Refund for order 1041', 'html' => '<p>Refund issued for order 1041.</p>', 'text' => 'Refund issued for order 1041.', 'attachments' => [ [ 'filename' => 'note.txt', 'content' => 'aGVsbG8=', 'content_type' => 'text/plain', ], ],]);
import resendresend.api_key = "re_xxxxxxxxx"params: resend.Inboxes.Drafts.CreateParams = { "inbox_id": "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "<p>Refund issued for order 1041.</p>", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain", } ],}resend.Inboxes.Drafts.create(params)
require "resend"Resend.api_key = "re_xxxxxxxxx"params = { inbox_id: "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", to: ["ada@example.org"], subject: "Refund for order 1041", html: "<p>Refund issued for order 1041.</p>", text: "Refund issued for order 1041.", attachments: [{ filename: "note.txt", content: "aGVsbG8=", content_type: "text/plain" }]}Resend::Inboxes::Drafts.create(params)
package mainimport "github.com/resend/resend-go/v4"func main() { client := resend.NewClient("re_xxxxxxxxx") params := &resend.CreateInboxDraftRequest{ To: []string{"ada@example.org"}, Subject: "Refund for order 1041", Html: "<p>Refund issued for order 1041.</p>", Text: "Refund issued for order 1041.", Attachments: []*resend.InboxDraftAttachmentInput{ { Content: []byte("hello"), Filename: "note.txt", ContentType: "text/plain", }, }, } client.Inboxes.Drafts.Create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params)}
use resend_rs::{ types::{CreateInboxDraftAttachment, CreateInboxDraftOptions}, Resend, Result,};#[tokio::main]async fn main() -> Result<()> { let resend = Resend::new("re_xxxxxxxxx"); let opts = CreateInboxDraftOptions::new() .with_to(["ada@example.org"]) .with_subject("Refund for order 1041") .with_html("<p>Refund issued for order 1041.</p>") .with_text("Refund issued for order 1041.") .with_attachment(CreateInboxDraftAttachment::new( b"hello".to_vec(), "note.txt", "text/plain", )); let _draft = resend .inboxes .create_draft("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", opts) .await?; Ok(())}
import com.resend.Resend;import com.resend.core.exception.ResendException;import com.resend.services.emails.model.Attachment;import com.resend.services.inboxes.model.CreateInboxDraftOptions;import com.resend.services.inboxes.model.CreateInboxDraftResponseSuccess;public class Main { public static void main(String[] args) throws ResendException { Resend resend = new Resend("re_xxxxxxxxx"); CreateInboxDraftOptions params = CreateInboxDraftOptions.builder() .to("ada@example.org") .subject("Refund for order 1041") .html("<p>Refund issued for order 1041.</p>") .text("Refund issued for order 1041.") .attachments(Attachment.builder() .fileName("note.txt") .content("aGVsbG8=") .contentType("text/plain") .build()) .build(); CreateInboxDraftResponseSuccess data = resend.inboxes().drafts() .create("b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1", params); }}
using Resend;IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DIvar resp = await resend.InboxDraftCreateAsync( new Guid( "b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1" ), new InboxDraftCreateData() { To = "ada@example.org", Subject = "Refund for order 1041", HtmlBody = "<p>Refund issued for order 1041.</p>", TextBody = "Refund issued for order 1041.", Attachments = [ new EmailAttachment() { Filename = "note.txt", Content = System.Text.Encoding.UTF8.GetBytes( "hello" ), ContentType = "text/plain", }, ], });Console.WriteLine( "Draft Id={0}", resp.Content );
curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "to": ["ada@example.org"], "subject": "Refund for order 1041", "html": "<p>Refund issued for order 1041.</p>", "text": "Refund issued for order 1041.", "attachments": [ { "filename": "note.txt", "content": "aGVsbG8=", "content_type": "text/plain" } ]}'
curl -X POST 'https://api.resend.com/inboxes/b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1/drafts' \ -H 'Authorization: Bearer re_xxxxxxxxx' \ -H 'Content-Type: application/json' \ -d $'{ "thread_id": "4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12", "reply_to_email_id": "5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60", "text": "Refund issued for order 1041."}'
resend inboxes drafts create b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1 \ --to ada@example.org \ --subject "Refund for order 1041" \ --html "<p>Refund issued for order 1041.</p>" \ --text "Refund issued for order 1041." \ --attachment "./note.txt;type=text/plain"