---
title: "TypeScript SDK: Sending"
description: "The methods of the TypeScript client under Sending. New messages and replies from an inbox, with idempotent retries."
url: https://doorman.fyi/docs/sdk/reference/sending
markdown: https://doorman.fyi/docs/sdk/reference/sending.md
area: "SDKs and tools"
section: "TypeScript SDK"
---

# TypeScript SDK: Sending

The methods of the TypeScript client under Sending. New messages and replies from an inbox, with idempotent retries.

Source: https://doorman.fyi/docs/sdk/reference/sending

## client.inboxes.send

TypeScript:
```ts
client.inboxes.send(inboxId: string, body: SendMessageInput, options: SendOptions = {}): Promise<SendResult>
```

Operation [`inboxes.send`](https://doorman.fyi/docs/reference/sending.md#inboxes-send): `POST /v1/inboxes/{inboxId}/send`

A new message (`to` and `subject`) or a reply (`threadId`) from the inbox's address. Attachment contents may be bytes or base64. With an `idempotencyKey`, a retry within 24 hours replays the original answer, flagged with `replayed`. Where the security policy asks for the owner's word, a message to someone the inbox does not know is not sent: the answer is a held send (`isHeldSend(result)`), which the owner sends or discards. Do not send it again.

Access `any`: any API key, or a console session. An app token needs `mail:send` and `mail:read`.

## client.inboxes.reply

TypeScript:
```ts
client.inboxes.reply(inboxId: string, threadId: string, body: ReplyInput, options: SendOptions = {}): Promise<SendResult>
```

A reply in a thread: `inboxes.send` with `threadId`. The subject, recipient and threading headers default from the thread.

## client.inboxes.drafts.create

TypeScript:
```ts
client.inboxes.drafts.create(inboxId: string, body: SendMessageInput): Promise<HeldSend>
```

Operation [`inboxes.drafts.create`](https://doorman.fyi/docs/reference/sending.md#inboxes-drafts-create): `POST /v1/inboxes/{inboxId}/drafts`

Write a message and leave it for the owner. Nothing is sent. The body is the one a send takes, a reply included (`threadId`), and it is checked as a send would be. The answer is a held send with `kind` `draft`: only the owner sends it, and `client.heldSends.get(draft.id)` says where it stands. An app needs `mail:draft`; it does not need `mail:send`.

Access `key`: an API key, or a correctly scoped app token where delegated access is allowed; console sessions are refused. An app token needs `mail:draft` and `mail:read`.

## client.drafts.delete

TypeScript:
```ts
client.drafts.delete(heldSendId: string): Promise<void>
```

Operation [`drafts.delete`](https://doorman.fyi/docs/reference/sending.md#drafts-delete): `DELETE /v1/drafts/{heldSendId}`

Take a draft back before the owner sent it. For the app or the key that wrote it. A send the security policy kept is not a draft and answers 404 here.

Access `key`: an API key, or a correctly scoped app token where delegated access is allowed; console sessions are refused. An app token needs `mail:draft`.
