Python SDK: Security

The methods of the Python 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.

client.held_sends.approve

Python

client.held_sends.approve(held_send_id: str) -> models.SentMessage

Sends heldSends.approve: POST /v1/held-sends/{heldSendId}/approve

Send a held send.

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

client.held_sends.discard

Python

client.held_sends.discard(held_send_id: str) -> None

Sends heldSends.discard: POST /v1/held-sends/{heldSendId}/discard

Discard a held send.

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

client.held_sends.get

Python

client.held_sends.get(held_send_id: str) -> models.HeldSend

Sends heldSends.get: GET /v1/held-sends/{heldSendId}

Read a held send.

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

client.inboxes.held.list

Python

client.inboxes.held.list(inbox_id: str, *, limit: int | None = None, offset: int | None = None) -> models.HeldMessagePage

Sends inboxes.held.list: GET /v1/inboxes/{inboxId}/held

List held messages.

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

client.inboxes.held.iterate

Python

client.inboxes.held.iterate(inbox_id: str, *, limit: int | None = None, offset: int | None = None) -> Iterator[models.HeldMessage]

Every item of client.inboxes.held.list, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.

client.inboxes.held_sends.list

Python

client.inboxes.held_sends.list(inbox_id: str, *, status: Literal['held', 'sent', 'discarded', 'expired'] | None = None, kind: Literal['held', 'draft'] | None = None, limit: int | None = None, offset: int | None = None) -> models.HeldSendPage

Sends inboxes.heldSends.list: GET /v1/inboxes/{inboxId}/held-sends

List held sends.

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

client.inboxes.held_sends.iterate

Python

client.inboxes.held_sends.iterate(inbox_id: str, *, status: Literal['held', 'sent', 'discarded', 'expired'] | None = None, kind: Literal['held', 'draft'] | None = None, limit: int | None = None, offset: int | None = None) -> Iterator[models.HeldSend]

Every item of client.inboxes.held_sends.list, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.

client.inboxes.security.get

Python

client.inboxes.security.get(inbox_id: str) -> models.SecuritySettings

Sends inboxes.security.get: GET /v1/inboxes/{inboxId}/security

Read an inbox's security policy.

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

Python

client.inboxes.security.reset(inbox_id: str) -> None

Sends inboxes.security.reset: DELETE /v1/inboxes/{inboxId}/security

Return an inbox to the account's security policy.

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

Python

client.inboxes.security.update(inbox_id: str, body: models.UpdateSecurityPolicy) -> models.SecuritySettings

Sends inboxes.security.update: PATCH /v1/inboxes/{inboxId}/security

Give an inbox its own security policy.

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

Python

client.inboxes.senders.list(inbox_id: str, *, standing: Literal['trusted', 'known', 'new', 'blocked'] | None = None, q: str | None = None, limit: int | None = None, offset: int | None = None) -> models.SenderPage

Sends inboxes.senders.list: GET /v1/inboxes/{inboxId}/senders

List an inbox's senders.

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

Python

client.inboxes.senders.iterate(inbox_id: str, *, standing: Literal['trusted', 'known', 'new', 'blocked'] | None = None, q: str | None = None, limit: int | None = None, offset: int | None = None) -> Iterator[models.Sender]

Every item of client.inboxes.senders.list, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.

client.messages.discard

Python

client.messages.discard(message_id: str) -> None

Sends messages.discard: POST /v1/messages/{messageId}/discard

Discard a held message.

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

client.messages.feedback

Python

client.messages.feedback(message_id: str, body: models.RiskFeedback) -> models.Message

Sends messages.feedback: POST /v1/messages/{messageId}/feedback

Mark a message safe or unsafe.

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

client.messages.release

Python

client.messages.release(message_id: str) -> models.Message

Sends messages.release: POST /v1/messages/{messageId}/release

Release a held message.

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

client.security.audit

Python

client.security.audit(*, inbox_id: str | None = None, limit: int | None = None, offset: int | None = None) -> models.SecurityAuditPage

Sends security.audit: GET /v1/security/audit

Read the security audit log.

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

client.security.iterate_audit

Python

client.security.iterate_audit(*, inbox_id: str | None = None, limit: int | None = None, offset: int | None = None) -> Iterator[models.SecurityAuditEntry]

Every item of client.security.audit, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.

client.security.get

Python

client.security.get() -> models.SecuritySettings

Sends security.get: GET /v1/security

Read the security policy.

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

client.security.preview

Python

client.security.preview(body: models.SecurityPreviewRequest) -> models.SecurityPreview

Sends security.preview: POST /v1/security/preview

Preview what a policy does to a message.

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

client.security.update

Python

client.security.update(body: models.UpdateSecurityPolicy) -> models.SecuritySettings

Sends security.update: PATCH /v1/security

Change the security policy.

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

client.sender_rules.create

Python

client.sender_rules.create(body: models.CreateSenderRule) -> models.SenderRule

Sends senderRules.create: POST /v1/sender-rules

Trust or block a sender.

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

client.sender_rules.delete

Python

client.sender_rules.delete(sender_rule_id: str) -> None

Sends senderRules.delete: DELETE /v1/sender-rules/{senderRuleId}

Remove a sender rule.

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

client.sender_rules.list

Python

client.sender_rules.list(*, inbox_id: str | None = None, standing: Literal['trusted', 'blocked'] | None = None, q: str | None = None, limit: int | None = None, offset: int | None = None) -> models.SenderRulePage

Sends senderRules.list: GET /v1/sender-rules

List sender rules.

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

client.sender_rules.iterate

Python

client.sender_rules.iterate(*, inbox_id: str | None = None, standing: Literal['trusted', 'blocked'] | None = None, q: str | None = None, limit: int | None = None, offset: int | None = None) -> Iterator[models.SenderRule]

Every item of client.sender_rules.list, one page at a time: the next page is asked for when the loop reaches it. A page that does not advance raises ApiError.

Up Down to move, Enter to open, Esc to close