feat(inboxes): accept path attachments on drafts

Merged
DI
7h ago
+11-9

POST /inboxes/{inbox_id}/drafts and PATCH /inboxes/{inbox_id}/drafts/{draft_id} now accept path attachments, like POST /emails. They used to return a 422. API change: resend/resend-monorepo#13475 (live in prod).

Changes

InboxDraftAttachmentInput:

  • Only filename is required now. content is required without path, and path is required without content.
  • New path property.
  • content_type is required with content. With path, it defaults to the downloaded file's content type.

The create/update attachments descriptions and the create-draft operation description now say that a path file is downloaded when the request is made (not when the draft is sent). They also give the 422 cases:

  • a path that doesn't start with http/https, or can't be downloaded
  • downloads that take more than 20 seconds together
  • a total over 25 MB, downloaded files included

Verification

  • yq eval . resend.yaml parses. redocly lint gives 184 warnings and 0 errors, the same as main.
  • Each rule checked live against api.resend.com:
    • path + filename → 201, and the content type comes from the download
    • path without filename → 422
    • content without content_type → 422
    • ftp:// path → 422
    • PATCH with path → 200
    • content + path → content wins

Linear: DEV-2418