{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"Creates an unsent draft on the inbox. Omit `thread_id` and `reply_to_email_id` for a draft that starts a new thread. Pass both together for a reply draft in an existing thread. A reply draft without `to` is addressed to the sender of the email it replies to, or to its Reply-To when set. For an email the inbox sent, it defaults to that email's `to` recipients. Send `to: []` to leave it empty. At least one of `to`, `cc`, `bcc`, `subject`, `text`, `html` or `attachments` must be non-empty. The combined recipients of `to`, `cc` and `bcc` cannot exceed 50. Attachments are stored on the draft, so a `path` file is downloaded when the request is made. Returns 201 for a new draft. Only one unsent reply draft can target an email, so a reply draft request for an email that already has one returns 200 with the ID of the existing draft. An unknown `thread_id`, or a `reply_to_email_id` that is not in that thread, returns a 404. That request ignores every other field, except `attachments`, which replaces the attachments of the existing draft when sent. A reply draft created without `subject` stores an empty subject. When it is sent, it takes the thread subject, prefixed with `Re:` when it does not already start with it.","properties":{"headers":{"type":"object","properties":{"Idempotency-Key":{"type":"string","minLength":1,"maxLength":256,"description":"A unique key for the request, so the draft is created only once. A retry with the same key within 24 hours returns the first successful (2xx) response, with the `idempotent-replayed: true` header. A failed request is not stored, so it can be retried with the same key. Reusing the key with a different body, or while the first request is still running, returns a 409. An empty key, or one longer than 256 characters, returns a 400 `invalid_idempotency_key`. [Learn more](https://resend.com/docs/dashboard/emails/idempotency-keys)"}},"required":[],"additionalProperties":false},"path":{"type":"object","properties":{"inbox_id":{"type":"string","examples":["b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"],"description":"The Inbox ID or the inbox email address, such as `support@acme.com`. A value that contains `@` must be a valid email address, and any other value must be a UUID, or the request returns a 422. The address match is case-insensitive and never falls back to the inbox `name`. An address that matches no inbox returns a 404."}},"required":["inbox_id"],"additionalProperties":false},"body":{"$ref":"#/definitions/CreateInboxDraftOptions"}},"required":["path","body"],"additionalProperties":false,"definitions":{"CreateInboxDraftOptions":{"type":"object","description":"At least one of `to`, `cc`, `bcc`, `subject`, `text`, `html` or `attachments` must be non-empty. The combined recipients of `to`, `cc` and `bcc` cannot exceed 50. `thread_id` and `reply_to_email_id` must be sent together or not at all.","properties":{"to":{"description":"The recipients. For multiple addresses, send an array of strings. Each value can include a friendly name, for example `Ada Lovelace <ada@example.org>`. Each address is `email@example.com` or `Name <email@example.com>`. An address that is not valid returns a 422.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"},"maxItems":50},{"type":"null"}],"examples":[["ada@example.org"]]},"cc":{"description":"The CC recipients. For multiple addresses, send an array of strings. Each address is `email@example.com` or `Name <email@example.com>`. An address that is not valid returns a 422.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"},"maxItems":50},{"type":"null"}]},"bcc":{"description":"The BCC recipients. For multiple addresses, send an array of strings. Each address is `email@example.com` or `Name <email@example.com>`. An address that is not valid returns a 422.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"},"maxItems":50},{"type":"null"}]},"subject":{"type":["string","null"],"minLength":1,"maxLength":2000,"description":"The subject. Max 2000 characters. A string that is only whitespace, or that contains a line break, is rejected.","examples":["Refund for order 1041"]},"html":{"type":["string","null"],"description":"The HTML body.","examples":["<p>Refund issued for order 1041.</p>"]},"text":{"type":["string","null"],"description":"The plain text body.","examples":["Refund issued for order 1041."]},"attachments":{"type":["array","null"],"description":"Files to store on the draft. Each one needs a `filename` and either `content` or a `path` URL. A `path` file is downloaded when the request is made and stored on the draft. When both are sent, `path` is ignored. A `content_id` returns a 422. The files on a draft, downloaded ones included, can total at most 25 MB. A `path` that does not start with `http` or `https`, or that cannot be downloaded, returns a 422, and so does a request whose downloads take more than 20 seconds together. An empty file or a blocked file type returns a 422.","items":{"$ref":"#/definitions/InboxDraftAttachmentInput"}},"thread_id":{"type":"string","format":"uuid","description":"The Thread ID to reply in. Must be sent with `reply_to_email_id`.","examples":["4d8e2a1c-9b3f-4c6d-8a21-3e5f7c9c0d12"]},"reply_to_email_id":{"type":"string","format":"uuid","description":"The Email ID to reply to, as returned in `data[].id` by the list thread emails endpoint. Must be sent with `thread_id`.","examples":["5b1a9f47-2c8d-4e6f-9a03-1d2e3f4a5b60"]}}},"InboxDraftAttachmentInput":{"type":"object","description":"A file to store on a draft. Send either `content` or a `path` URL. Unlike `POST /emails` attachments, a `path` file is downloaded when the request is made, not when the draft is sent, and a draft attachment cannot use `content_id`. When both `content` and `path` are sent, `path` is ignored.","required":["filename"],"properties":{"content":{"type":"string","description":"The content of the file, encoded in base64. It cannot be empty. Required without `path`.","examples":["aGVsbG8gZTJl"]},"path":{"type":"string","description":"A URL to download the file from, starting with `http` or `https`. Required without `content`. A file that cannot be downloaded returns a 422, and so does a request whose downloads take more than 20 seconds together.","examples":["https://example.com/invoice.pdf"]},"filename":{"type":"string","minLength":1,"description":"The filename of the attachment. A blocked file type returns a 422.","examples":["receipt.pdf"]},"content_type":{"type":"string","minLength":1,"description":"The MIME type of the attachment. It must be a valid MIME type, such as `application/pdf`, or the request returns a 422. Required with `content`. With `path`, it defaults to the content type of the downloaded file.","examples":["application/pdf"]}}}}},"name":"Create a draft","id":"resend.inboxes.create-draft","example":{"path":{"inbox_id":"b3e2b2b6-3f0e-4c8e-9ad3-2f43a1e2c7f1"},"body":{}},"maxRequests":1,"summary":false}}