TypeScript SDK: Account

The methods of the TypeScript client under Account. The account, its plan and usage, and account-wide counts.

client.me

TypeScript

client.me(): Promise<Me>

Sends me: GET /v1/me

The account, its plan and usage, the caller, the organization the account belongs to, and the inbox domain.

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

client.overview

TypeScript

client.overview(): Promise<Overview>

Sends overview: GET /v1/overview

The account's counts and the getting-started checklist. Account scope.

Access account: an account-scoped key or a console session; an inbox-scoped key gets 403 forbidden. An app token needs account:read.

client.metrics

TypeScript

client.metrics(params: MetricsParams = {}): Promise<Metrics>

Sends metrics: GET /v1/metrics

Received, sent, delivered and failed per UTC bucket over a range.

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

client.billing.checkout

TypeScript

client.billing.checkout(): Promise<BillingRedirect>

Sends billing.checkout: POST /v1/billing/checkout

A checkout page at the payment provider. The plan changes when the payment is reported, not here.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused. Part of billing, which a deployment switches on: where it takes no payments, the call answers 404 not_found.

client.billing.portal

TypeScript

client.billing.portal(): Promise<BillingRedirect>

Sends billing.portal: POST /v1/billing/portal

The provider's portal for this account: the card, the invoices, cancelling.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused. Part of billing, which a deployment switches on: where it takes no payments, the call answers 404 not_found.

client.billing.sync

TypeScript

client.billing.sync(): Promise<BillingSynced>

Sends billing.sync: POST /v1/billing/sync

Read the subscription from the provider again and apply it.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused. Part of billing, which a deployment switches on: where it takes no payments, the call answers 404 not_found.

client.billing.seats

TypeScript

client.billing.seats(body: SetSeats): Promise<BillingSynced>

Sends billing.seats: POST /v1/billing/seats

Set how many seats an organization's Teams subscription holds. The number is the whole count. More seats are charged at once and made only if the charge succeeds (402 otherwise); fewer take effect when the paid period ends. Where the deployment does not sell the Teams plan it answers 404.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused. Part of billing, which a deployment switches on: where it takes no payments, the call answers 404 not_found.

client.push.get

TypeScript

client.push.get(): Promise<PushSettings>

Sends push.get: GET /v1/push

Whether this deployment can notify, the key a browser subscribes with, and the account's subscriptions without their addresses.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.push.subscriptions.create

TypeScript

client.push.subscriptions.create(body: CreatePushSubscription): Promise<PushSubscription>

Sends push.subscriptions.create: POST /v1/push/subscriptions

Record the address a browser was given when the owner allowed notifications there. It must be at a push service; an address the account already has answers that subscription.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.push.subscriptions.delete

TypeScript

client.push.subscriptions.delete(subscriptionId: string): Promise<void>

Sends push.subscriptions.delete: DELETE /v1/push/subscriptions/{subscriptionId}

Forget a subscription, so nothing more is sent there.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.members.list

TypeScript

client.members.list(): Promise<MemberList>

Sends members.list: GET /v1/members

Everyone in the organization, in the order they joined. Every member may read it.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.members.update

TypeScript

client.members.update(userId: string, body: UpdateMember): Promise<Member>

Sends members.update: PATCH /v1/members/{userId}

Give a member another role, which holds from their next request. Only an owner may make an owner or change one (403 owner_required), and the last active owner keeps the role (409 last_owner).

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.invitations.list

TypeScript

client.invitations.list(): Promise<InvitationList>

Sends invitations.list: GET /v1/invitations

The organization's invitations, open and settled, newest first.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.invitations.create

TypeScript

client.invitations.create(body: CreateInvitation): Promise<Invitation>

Sends invitations.create: POST /v1/invitations

Record an invitation and the role it grants. An address that is a member's or already invited answers 409.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.invitations.update

TypeScript

client.invitations.update(invitationId: string, body: UpdateInvitation): Promise<Invitation>

Sends invitations.update: PATCH /v1/invitations/{invitationId}

Record which of the identity provider's invitations was sent for this one. A new one keeps it open longer.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.invitations.revoke

TypeScript

client.invitations.revoke(invitationId: string): Promise<void>

Sends invitations.revoke: DELETE /v1/invitations/{invitationId}

Take an open invitation back, so the role it would have granted is granted to nobody.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

client.organization.adopt

TypeScript

client.organization.adopt(body: AdoptAccount): Promise<Account>

Sends organization.adopt: POST /v1/organization/adopt

Makes the signed-in person's personal account the account of the organization the session is working in, under the same account id. accountId names the personal account, so that nothing is moved by mistake. It works once for an organization, and only while the organization's own account has never been used (409 organization_not_empty otherwise), and cannot be undone.

Access session: a console session only; an API key gets 403 session_required. App tokens are refused.

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