---
title: "TypeScript SDK: Security"
description: "The methods of the TypeScript client under Security. Risk assessment and sender trust: the policy that warns, holds and guards sending, the senders an inbox knows, held mail and the audit log."
url: https://doorman.fyi/docs/sdk/reference/security
markdown: https://doorman.fyi/docs/sdk/reference/security.md
area: "SDKs and tools"
section: "TypeScript SDK"
---

# TypeScript SDK: Security

The methods of the TypeScript client under Security. Risk assessment and sender trust: the policy that warns, holds and guards sending, the senders an inbox knows, held mail and the audit log.

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

## client.inboxes.security.get

TypeScript:
```ts
client.inboxes.security.get(inboxId: string): Promise<SecuritySettings>
```

Operation [`inboxes.security.get`](https://doorman.fyi/docs/reference/security.md#inboxes-security-get): `GET /v1/inboxes/{inboxId}/security`

The policy in force for one inbox (`inherited` says whether it follows the account's).

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.inboxes.security.update

TypeScript:
```ts
client.inboxes.security.update(inboxId: string, body: UpdateSecurityPolicy): Promise<SecuritySettings>
```

Operation [`inboxes.security.update`](https://doorman.fyi/docs/reference/security.md#inboxes-security-update): `PATCH /v1/inboxes/{inboxId}/security`

Give an inbox its own security policy. Loosening needs a session unless allowed.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.inboxes.security.reset

TypeScript:
```ts
client.inboxes.security.reset(inboxId: string): Promise<void>
```

Operation [`inboxes.security.reset`](https://doorman.fyi/docs/reference/security.md#inboxes-security-reset): `DELETE /v1/inboxes/{inboxId}/security`

Remove the inbox's override so it follows the account's policy again.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.inboxes.senders.list

TypeScript:
```ts
client.inboxes.senders.list(inboxId: string, params: ListSendersParams = {}): Promise<SenderPage>
```

Operation [`inboxes.senders.list`](https://doorman.fyi/docs/reference/security.md#inboxes-senders-list): `GET /v1/inboxes/{inboxId}/senders`

Everyone the inbox has heard from or written to, most recent first, with their standing.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.inboxes.senders.iterate

TypeScript:
```ts
client.inboxes.senders.iterate(inboxId: string, params: ListSendersParams = {}): AsyncGenerator<Sender, void, undefined>
```

Every sender of the inbox, page by page.

## client.inboxes.held.list

TypeScript:
```ts
client.inboxes.held.list(inboxId: string, params: PageParams = {}): Promise<HeldMessagePage>
```

Operation [`inboxes.held.list`](https://doorman.fyi/docs/reference/security.md#inboxes-held-list): `GET /v1/inboxes/{inboxId}/held`

Messages held for review under the security policy, newest first.

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

## client.inboxes.held.iterate

TypeScript:
```ts
client.inboxes.held.iterate(inboxId: string, params: PageParams = {}): AsyncGenerator<HeldMessage, void, undefined>
```

Every held message stub of the inbox, page by page.

## client.inboxes.heldSends.list

TypeScript:
```ts
client.inboxes.heldSends.list(inboxId: string, params: ListHeldSendsParams = {}): Promise<HeldSendPage>
```

Operation [`inboxes.heldSends.list`](https://doorman.fyi/docs/reference/security.md#inboxes-heldSends-list): `GET /v1/inboxes/{inboxId}/held-sends`

The messages that wait for the owner, newest first: sends the policy kept, and drafts.

Access `any`: any API key, or a console session. App tokens are refused.

## client.inboxes.heldSends.iterate

TypeScript:
```ts
client.inboxes.heldSends.iterate(inboxId: string, params: ListHeldSendsParams = {}): AsyncGenerator<HeldSend, void, undefined>
```

Every held send of the inbox in one state, page by page.

## client.messages.release

TypeScript:
```ts
client.messages.release(messageId: string): Promise<Message>
```

Operation [`messages.release`](https://doorman.fyi/docs/reference/security.md#messages-release): `POST /v1/messages/{messageId}/release`

Deliver a held message into its conversation and emit `message.received`.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.messages.discard

TypeScript:
```ts
client.messages.discard(messageId: string): Promise<void>
```

Operation [`messages.discard`](https://doorman.fyi/docs/reference/security.md#messages-discard): `POST /v1/messages/{messageId}/discard`

Trash a held message without ever delivering it.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.messages.feedback

TypeScript:
```ts
client.messages.feedback(messageId: string, body: RiskFeedback): Promise<Message>
```

Operation [`messages.feedback`](https://doorman.fyi/docs/reference/security.md#messages-feedback): `POST /v1/messages/{messageId}/feedback`

Record the owner's `safe` or `unsafe` verdict on an assessed inbound message.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.security.get

TypeScript:
```ts
client.security.get(): Promise<SecuritySettings>
```

Operation [`security.get`](https://doorman.fyi/docs/reference/security.md#security-get): `GET /v1/security`

The account's security policy, enforcement mode and model analysis availability.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.security.update

TypeScript:
```ts
client.security.update(body: UpdateSecurityPolicy): Promise<SecuritySettings>
```

Operation [`security.update`](https://doorman.fyi/docs/reference/security.md#security-update): `PATCH /v1/security`

Apply a preset or update policy fields on the account. Loosening needs a session unless allowed.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.security.audit

TypeScript:
```ts
client.security.audit(params: ListSecurityAuditParams = {}): Promise<SecurityAuditPage>
```

Operation [`security.audit`](https://doorman.fyi/docs/reference/security.md#security-audit): `GET /v1/security/audit`

Every change to security policies, sender rules and held messages, newest first.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.security.iterateAudit

TypeScript:
```ts
client.security.iterateAudit(params: ListSecurityAuditParams = {}): AsyncGenerator<SecurityAuditEntry, void, undefined>
```

Every entry of the security audit log, page by page.

## client.security.preview

TypeScript:
```ts
client.security.preview(body: SecurityPreviewRequest): Promise<SecurityPreview>
```

Operation [`security.preview`](https://doorman.fyi/docs/reference/security.md#security-preview): `POST /v1/security/preview`

Evaluate a sample, stored message or custom body against the active or a draft policy.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.senderRules.list

TypeScript:
```ts
client.senderRules.list(params: ListSenderRulesParams = {}): Promise<SenderRulePage>
```

Operation [`senderRules.list`](https://doorman.fyi/docs/reference/security.md#senderRules-list): `GET /v1/sender-rules`

The account's trusted and blocked sender rules, newest first.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.senderRules.iterate

TypeScript:
```ts
client.senderRules.iterate(params: ListSenderRulesParams = {}): AsyncGenerator<SenderRule, void, undefined>
```

Every sender rule matching the filters, page by page.

## client.senderRules.create

TypeScript:
```ts
client.senderRules.create(body: CreateSenderRule): Promise<SenderRule>
```

Operation [`senderRules.create`](https://doorman.fyi/docs/reference/security.md#senderRules-create): `POST /v1/sender-rules`

Trust or block an email address or domain.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.senderRules.delete

TypeScript:
```ts
client.senderRules.delete(senderRuleId: string): Promise<void>
```

Operation [`senderRules.delete`](https://doorman.fyi/docs/reference/security.md#senderRules-delete): `DELETE /v1/sender-rules/{senderRuleId}`

Remove a sender rule so matching senders return to learned standing.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.heldSends.get

TypeScript:
```ts
client.heldSends.get(heldSendId: string): Promise<HeldSend>
```

Operation [`heldSends.get`](https://doorman.fyi/docs/reference/security.md#heldSends-get): `GET /v1/held-sends/{heldSendId}`

Where a held send stands: waiting, sent, discarded or expired.

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

## client.heldSends.approve

TypeScript:
```ts
client.heldSends.approve(heldSendId: string): Promise<SentMessage>
```

Operation [`heldSends.approve`](https://doorman.fyi/docs/reference/security.md#heldSends-approve): `POST /v1/held-sends/{heldSendId}/approve`

Send a held send as it was asked for, now. Needs a session unless allowed.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.

## client.heldSends.discard

TypeScript:
```ts
client.heldSends.discard(heldSendId: string): Promise<void>
```

Operation [`heldSends.discard`](https://doorman.fyi/docs/reference/security.md#heldSends-discard): `POST /v1/held-sends/{heldSendId}/discard`

End a held send without sending it. Nothing brings it back.

Access `account`: an account-scoped key or a console session; an inbox-scoped key gets 403 `forbidden`. App tokens are refused.
