Belgelere geç
SDK

openemail.keys

Bu ad alanındaki her yöntem: imzası, parametreleri, döndürdüğü değer ve bir örnek.

Yöntemler

Every key in the workspace: list, create, change, rotate, switch off and revoke them, never wider than the calling key, and read their request log and activity.

keys.list()

List one page of the workspace's API keys

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
list(options?: ListOptions): Promise<Page<ApiKeyResource>>

Returns one page of the workspace's keys, newest first, with what the Settings, API keys page shows: status, scopes, role, send scope, when each was last used, how often, and who made and last changed it. Revoked and expired keys stay listed until somebody deletes them. No secret is ever returned; maskedKey is enough to tell two keys apart.

A key narrowed to some domains or addresses only sees the keys whose send scope sits inside its own, so any other is a 404 rather than a refusal. Over OAuth only the workspace owner reaches it, and a member's token is 403 owner_only.

Parametreler

options.limitnumber

Rows per page, a whole number from 1 to 100. The server defaults to 25.

options.cursorstring

The nextCursor from the previous page, passed back unchanged. Never build one yourself.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

Page<ApiKeyResource> with items, hasMore and nextCursor. Each item is an ApiKeyResource: id, name, mode, maskedKey, keyLast4, status, scopes, roleId, roleName, addressAllowlist, domainAllowlist, expiresAt, lastUsedAt, totalUses, rotatedAt, rotationCount, deactivatedAt, revokedAt, revokedReason, createdAt, createdBy, updatedAt, updatedBy, lastChangeAt and lastChangeType. Never a secret.

Örnek

const page = await openemail.keys.list() for (const key of page.items) {    console.log(key.maskedKey, key.name, key.status, key.lastUsedAt)}

Notlar

  • It needs keys:read, which no key holds unless somebody gave it one.

  • The cursor is opaque: pass nextCursor back as it came.

Şurada da var

API
GET /keys
CLI
openemail keys list

keys.listAll()

Collect every API key into one array

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listAll(options?: ListOptions): Promise<Array<ApiKeyResource>>

Walks every page of list and resolves with every key the caller can see, newest first.

Parametreler

options.limitnumber

Page size for each request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and the walk with it.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

Array<ApiKeyResource>, newest first.

Örnek

const keys = await openemail.keys.listAll() const idle = keys.filter((key) => key.status === 'active' && key.lastUsedAt === null) console.log(idle.map((key) => key.name))

Şurada da var

API
GET /keys

keys.iterate()

Stream the workspace's API keys one at a time

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
iterate(options?: ListOptions): AsyncGenerator<ApiKeyResource, void, undefined>

An async generator over list, fetching a page only when the one before is drained.

Parametreler

options.limitnumber

Page size per request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and ends the iteration.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

AsyncGenerator<ApiKeyResource, void, undefined> yielding one key per step.

Örnek

for await (const key of openemail.keys.iterate()) {    if (key.expiresAt && Date.parse(key.expiresAt) < Date.now() + 7 * 24 * 60 * 60 * 1000) console.log(key.name, 'expires soon')}

Şurada da var

API
GET /keys

keys.get()

Read one API key, without its secret

Kapsamlarkeys:read
İmza
get(id: string, options?: RequestScope): Promise<ApiKeyResource>

Resolves with one key as list shows it. A key narrowed to some domains or addresses only sees the keys whose send scope sits inside its own, so any other is a 404 rather than a refusal. Over OAuth only the workspace owner reaches it, and a member's token is 403 owner_only.

openemail.me.get() describes the calling key itself and needs no scope; this reads any key the caller can see.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

ApiKeyResource: id, name, mode, maskedKey, keyLast4, status, scopes, roleId, roleName, addressAllowlist, domainAllowlist, expiresAt, lastUsedAt, totalUses, rotatedAt, rotationCount, deactivatedAt, revokedAt, revokedReason, createdAt, createdBy, updatedAt, updatedBy, lastChangeAt and lastChangeType. Never a secret.

Örnek

const key = await openemail.keys.get('4c1b257a66287fd113bd89d0') console.log(key.status, key.scopes, key.domainAllowlist)

Şurada da var

API
GET /keys/{id}
CLI
openemail keys get

keys.create()

Mint a new API key and receive its secret once

Kapsamlarkeys:manage
İmza
create(body: ApiKeyCreate, options?: RequestScope): Promise<CreatedApiKeyResource>

Creates a live key and resolves with it plus token, the whole secret. That is the only time it appears, so store it before doing anything else.

Left out, scopes is ['emails:send'], the role is the caller's own or none, the send scope is the caller's own or none (none means every address the workspace owns), and the expiry is the caller's own or none. The workspace cap on live keys applies, as a 422 workspace_limit_reached.

A key never makes or reaches a key wider than itself. The target has to sit inside the caller on every axis: scopes the caller holds after its own role has narrowed them, the same role when the caller has one, an expiry no later than the caller's when the caller expires, the caller's mode, and a send scope inside the caller's own, where one address never covers its whole domain. Anything wider is 403 beyond_caller_authority, and param names the axis.

Step-up verification, which the app asks for before it mints a key, cannot apply to a call made with a key, so keys:manage is a credential that makes credentials. Give it only to automation that provisions keys, narrow that key to the role and send scope it needs, and give it an expiry.

Parametreler

body.namestringZorunlu

A name, 1 to 60 characters.

body.scopesArray<ApiScope>

The scopes the key holds, at least one, each held by the caller. Defaults to ['emails:send'].

body.roleIdstring | null

A role to cap the key. Left out, the caller's own role. A caller with a role can only give its own, and null is refused for it.

body.addressAllowlistArray<string>

Single addresses the key may send as, at most 50, each owned by the workspace.

body.domainAllowlistArray<string>

Whole domains the key may send as, at most 25, including addresses added to them later. Leave both lists out to inherit the caller's own; send both empty for none.

body.expiresInMinutesnumber

Minutes until the key expires, 5 to 5,256,000 (ten years). Left out, the caller's own expiry.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

CreatedApiKeyResource: the ApiKeyResource: id, name, mode, maskedKey, keyLast4, status, scopes, roleId, roleName, addressAllowlist, domainAllowlist, expiresAt, lastUsedAt, totalUses, rotatedAt, rotationCount, deactivatedAt, revokedAt, revokedReason, createdAt, createdBy, updatedAt, updatedBy, lastChangeAt and lastChangeType. Never a secret. Plus token, oe_live_ followed by the id, an underscore and the secret.

Örnek

const key = await openemail.keys.create({    name: 'Billing sender',    scopes: ['emails:send', 'emails:read'],    domainAllowlist: ['billing.acme.com'],    expiresInMinutes: 60 * 24 * 90}) await secrets.put('OPENEMAIL_BILLING_KEY', key.token)

Notlar

  • Not retried automatically: a retry after a lost response would mint a second key.

  • The new key is recorded in the activity log as made by the calling key, source: 'api'.

  • The success status is 201.

Şurada da var

API
POST /keys
CLI
openemail keys create

keys.update()

Rename a key, change its scopes or send scope, or switch it off and on

Kapsamlarkeys:manage
İmza
update(id: string, patch: ApiKeyPatch, options?: RequestScope): Promise<ApiKeyResource>

Applies a partial change and resolves with the key as it now stands. scopes, addressAllowlist and domainAllowlist REPLACE what the key had, and a field left out stays as it was. enabled: false switches the key off: every call with it is refused with inactive_api_key and it keeps its secret, scopes, role and send scope, so enabled: true restores it exactly. That is the reversible alternative to revoke. A revoked key cannot be changed, and answers 409 revoked.

A key never makes or reaches a key wider than itself. The target has to sit inside the caller on every axis: scopes the caller holds after its own role has narrowed them, the same role when the caller has one, an expiry no later than the caller's when the caller expires, the caller's mode, and a send scope inside the caller's own, where one address never covers its whole domain. Anything wider is 403 beyond_caller_authority, and param names the axis. A key changing itself may only narrow itself.

A key narrowed to some domains or addresses only sees the keys whose send scope sits inside its own, so any other is a 404 rather than a refusal. Over OAuth only the workspace owner reaches it, and a member's token is 403 owner_only.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

patch.namestring

A new name, 1 to 60 characters.

patch.scopesArray<ApiScope>

The whole new list of scopes, at least one.

patch.addressAllowlistArray<string>

The whole new list of single addresses.

patch.domainAllowlistArray<string>

The whole new list of whole domains.

patch.enabledboolean

False switches the key off, true switches it back on.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

ApiKeyResource: id, name, mode, maskedKey, keyLast4, status, scopes, roleId, roleName, addressAllowlist, domainAllowlist, expiresAt, lastUsedAt, totalUses, rotatedAt, rotationCount, deactivatedAt, revokedAt, revokedReason, createdAt, createdBy, updatedAt, updatedBy, lastChangeAt and lastChangeType. Never a secret.

Örnek

await openemail.keys.update('4c1b257a66287fd113bd89d0', { enabled: false }) const key = await openemail.keys.update('4c1b257a66287fd113bd89d0', { name: 'Billing sender (paused)' }) console.log(key.status)

Notlar

  • An empty patch is a 422. A PATCH is retried on network failure because applying the same patch twice leaves the same key.

Şurada da var

API
PATCH /keys/{id}
CLI
openemail keys update

keys.delete()

Remove a revoked key from the list

Kapsamlarkeys:manage
İmza
delete(id: string, options?: RequestScope): Promise<DeletedApiKeyResource>

Deletes a key that has already been revoked. Its request log and activity stay, under Deleted key, so the history of what it did is not lost with it. A key that has not been revoked is refused with 409 not_revoked, so nothing still calling with it loses its credential without somebody deciding that first.

A key never makes or reaches a key wider than itself. The target has to sit inside the caller on every axis: scopes the caller holds after its own role has narrowed them, the same role when the caller has one, an expiry no later than the caller's when the caller expires, the caller's mode, and a send scope inside the caller's own, where one address never covers its whole domain. Anything wider is 403 beyond_caller_authority, and param names the axis.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

DeletedApiKeyResource: { object: 'api_key', id, deleted: true }.

Örnek

await openemail.keys.revoke('4c1b257a66287fd113bd89d0', { reason: 'Leaked in a build log' })await openemail.keys.delete('4c1b257a66287fd113bd89d0')

Şurada da var

API
DELETE /keys/{id}
CLI
openemail keys delete

keys.rotate()

Give a key a new secret and receive it once

Kapsamlarkeys:manage
İmza
rotate(id: string, options?: RequestScope): Promise<RotatedApiKeyResource>

Mints a new secret for a key and resolves with the key plus token, rotationCount and rotatedAt. The id, name, scopes, role, send scope, expiry and request history all carry on; only the secret and keyLast4 change. There is no overlap window: the old secret stops working the instant this returns.

Rotating the calling key itself is what openemail.me.rotate() does, and here it is allowed with keys:write as well as keys:manage. A revoked or expired key cannot be rotated, and answers 409 revoked or expired.

A key never makes or reaches a key wider than itself. The target has to sit inside the caller on every axis: scopes the caller holds after its own role has narrowed them, the same role when the caller has one, an expiry no later than the caller's when the caller expires, the caller's mode, and a send scope inside the caller's own, where one address never covers its whole domain. Anything wider is 403 beyond_caller_authority, and param names the axis. Rotation hands the caller a working secret for the key, which is why the ceiling is checked against the key as it stands.

A key narrowed to some domains or addresses only sees the keys whose send scope sits inside its own, so any other is a 404 rather than a refusal. Over OAuth only the workspace owner reaches it, and a member's token is 403 owner_only.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

RotatedApiKeyResource: the ApiKeyResource: id, name, mode, maskedKey, keyLast4, status, scopes, roleId, roleName, addressAllowlist, domainAllowlist, expiresAt, lastUsedAt, totalUses, rotatedAt, rotationCount, deactivatedAt, revokedAt, revokedReason, createdAt, createdBy, updatedAt, updatedBy, lastChangeAt and lastChangeType. Never a secret. Plus token, rotationCount and rotatedAt.

Örnek

const rotated = await openemail.keys.rotate('4c1b257a66287fd113bd89d0') await secrets.put('OPENEMAIL_BILLING_KEY', rotated.token) console.log(rotated.rotationCount, rotated.rotatedAt)

Notlar

  • Not retried automatically. Repeating a rotation would invalidate the secret the first attempt returned.

Şurada da var

API
POST /keys/{id}/rotate
CLI
openemail keys rotate

keys.revoke()

Revoke a key for good

Kapsamlarkeys:manage
İmza
revoke(id: string, body?: ApiKeyRevoke, options?: RequestScope): Promise<ApiKeyResource>

Revokes a key: every later call with it is refused with revoked_api_key, and it can never be switched back on, rotated or changed. reason is kept on the key and in the activity log. Revoking a key that is already revoked changes nothing and resolves with it as it is. A key may revoke itself, which is how an integration that believes its secret leaked retires it at once.

A key never makes or reaches a key wider than itself. The target has to sit inside the caller on every axis: scopes the caller holds after its own role has narrowed them, the same role when the caller has one, an expiry no later than the caller's when the caller expires, the caller's mode, and a send scope inside the caller's own, where one address never covers its whole domain. Anything wider is 403 beyond_caller_authority, and param names the axis.

A key narrowed to some domains or addresses only sees the keys whose send scope sits inside its own, so any other is a 404 rather than a refusal. Over OAuth only the workspace owner reaches it, and a member's token is 403 owner_only.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

body.reasonstring

Why, at most 200 characters.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

ApiKeyResource: id, name, mode, maskedKey, keyLast4, status, scopes, roleId, roleName, addressAllowlist, domainAllowlist, expiresAt, lastUsedAt, totalUses, rotatedAt, rotationCount, deactivatedAt, revokedAt, revokedReason, createdAt, createdBy, updatedAt, updatedBy, lastChangeAt and lastChangeType. Never a secret. status is revoked.

Örnek

const key = await openemail.keys.revoke('4c1b257a66287fd113bd89d0', { reason: 'Contractor offboarded' }) console.log(key.status, key.revokedAt)

Notlar

  • Retried on network failure, because revoking twice leaves the same key. Prefer update(id, { enabled: false }) while you find out whether anything still depends on a key.

Şurada da var

API
POST /keys/{id}/revoke
CLI
openemail keys revoke

keys.listRequests()

List one page of one key's request log

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listRequests(id: string, options?: ApiKeyRequestListOptions): Promise<Page<ApiKeyRequestResource>>

Returns one page of the calls one key made, newest first, the Requests tab of the key in the app. The request log records every authenticated call a key made: method, path, status, error code, duration, IP and user agent, and never a body or a query string. A call refused before a key could be identified is not in it, and neither is a call made with an OAuth access token. Nothing is pruned, so the log reaches back to a key's first call. failedOnly, since and until are the filters the app offers.

A deleted key's log stays readable to a key that is not narrowed. A key narrowed to some domains or addresses only sees the keys whose send scope sits inside its own, so any other is a 404 rather than a refusal. Over OAuth only the workspace owner reaches it, and a member's token is 403 owner_only.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.failedOnlyboolean

Only calls answered with a status of 400 or more.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Rows per page, a whole number from 1 to 100. The server defaults to 25.

options.cursorstring

The nextCursor from the previous page, passed back unchanged. Never build one yourself.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

Page<ApiKeyRequestResource> with items, hasMore and nextCursor. Each item has id, keyId, keyName, requestId, method, path, status, errorCode, durationMs, ip, userAgent and createdAt.

Örnek

const page = await openemail.keys.listRequests('4c1b257a66287fd113bd89d0', { failedOnly: true, limit: 50 }) for (const call of page.items) console.log(call.createdAt, call.method, call.path, call.status, call.errorCode)

Notlar

  • The cursor is opaque and stays valid under the same filters. One this log did not hand out is a 400 invalid_cursor.

Şurada da var

API
GET /keys/{id}/requests
CLI
openemail keys list-requests

keys.listAllRequests()

Collect one key's whole request log into one array

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listAllRequests(id: string, options?: ApiKeyRequestListOptions): Promise<Array<ApiKeyRequestResource>>

Walks every page of listRequests under the same filters. The log is never pruned, so give it a window unless you mean to read a busy key's whole history, or use iterateRequests to stop early.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.failedOnlyboolean

Only calls answered with a status of 400 or more.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size for each request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and the walk with it.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

Array<ApiKeyRequestResource>, newest first.

Örnek

const today = await openemail.keys.listAllRequests('4c1b257a66287fd113bd89d0', { since: new Date(Date.now() - 24 * 60 * 60 * 1000), limit: 100 }) console.log(today.length, 'calls today')

Notlar

  • If any page fails the promise rejects and the rows already fetched are discarded.

Şurada da var

API
GET /keys/{id}/requests

keys.iterateRequests()

Stream one key's request log one call at a time

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
iterateRequests(id: string, options?: ApiKeyRequestListOptions): AsyncGenerator<ApiKeyRequestResource, void, undefined>

An async generator over listRequests under the same filters, fetching a page only when the one before is drained.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.failedOnlyboolean

Only calls answered with a status of 400 or more.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size per request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and ends the iteration.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

AsyncGenerator<ApiKeyRequestResource, void, undefined> yielding one call per step.

Örnek

for await (const call of openemail.keys.iterateRequests('4c1b257a66287fd113bd89d0', { failedOnly: true })) {    if (call.errorCode === 'from_address_forbidden') {        console.log('first refused send at', call.createdAt)        break    }}

Şurada da var

API
GET /keys/{id}/requests

keys.listActivity()

List one page of what happened to one key

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listActivity(id: string, options?: ApiKeyActivityListOptions): Promise<Page<ApiKeyActivityResource>>

Returns one page of one key's audit log, newest first, the Activity tab of the key in the app. Every change to a key is a row: created, updated, rotated, deactivated, reactivated, revoked and deleted, plus auth_failed for every call that presented the key and was refused. actor names who made the change, a person as @username or a key as API key <name> in label, and detail.source says where it came from: console, api, mcp or documentation.

A deleted key keeps its history, readable to a key that is not narrowed. A key narrowed to some domains or addresses only sees the keys whose send scope sits inside its own, so any other is a 404 rather than a refusal. Over OAuth only the workspace owner reaches it, and a member's token is 403 owner_only.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Rows per page, a whole number from 1 to 100. The server defaults to 25.

options.cursorstring

The nextCursor from the previous page, passed back unchanged. Never build one yourself.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

Page<ApiKeyActivityResource> with items, hasMore and nextCursor. Each item has id, keyId, keyName, type, createdAt, actor and detail.

Örnek

const page = await openemail.keys.listActivity('4c1b257a66287fd113bd89d0') for (const change of page.items) console.log(change.createdAt, change.type, change.actor?.label, change.detail.source)

Şurada da var

API
GET /keys/{id}/activity
CLI
openemail keys list-activity

keys.listAllActivity()

Collect one key's whole audit log into one array

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listAllActivity(id: string, options?: ApiKeyActivityListOptions): Promise<Array<ApiKeyActivityResource>>

Walks every page of listActivity under the same window and resolves with every change, newest first.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size for each request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and the walk with it.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

Array<ApiKeyActivityResource>, newest first.

Örnek

const history = await openemail.keys.listAllActivity('4c1b257a66287fd113bd89d0') console.log(history.filter((change) => change.type === 'auth_failed').length, 'refused attempts')

Notlar

  • If any page fails the promise rejects and the rows already fetched are discarded.

Şurada da var

API
GET /keys/{id}/activity

keys.iterateActivity()

Stream one key's audit log one change at a time

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
iterateActivity(id: string, options?: ApiKeyActivityListOptions): AsyncGenerator<ApiKeyActivityResource, void, undefined>

An async generator over listActivity under the same window, fetching a page only when the one before is drained.

Parametreler

idstringZorunlu

Key id, the 24 hex characters after oe_live_.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size per request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and ends the iteration.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

AsyncGenerator<ApiKeyActivityResource, void, undefined> yielding one change per step.

Örnek

for await (const change of openemail.keys.iterateActivity('4c1b257a66287fd113bd89d0')) {    if (change.type === 'rotated') {        console.log('last rotated by', change.actor?.label, 'at', change.createdAt)        break    }}

Şurada da var

API
GET /keys/{id}/activity

keys.listWorkspaceRequests()

List one page of the request log of every key

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listWorkspaceRequests(options?: ApiKeyWorkspaceRequestListOptions): Promise<Page<ApiKeyRequestResource>>

Returns one page of every call the workspace's keys made, newest first, the Requests tab of Settings, API keys. The request log records every authenticated call a key made: method, path, status, error code, duration, IP and user agent, and never a body or a query string. A call refused before a key could be identified is not in it, and neither is a call made with an OAuth access token. Nothing is pruned, so the log reaches back to a key's first call. keyIds, failedOnly, since and until are the filters the app offers, and keyIds may name a deleted key.

A narrowed key reads only the log of the keys it can see, so naming another key in keyIds matches nothing.

Parametreler

options.keyIdsArray<string>

Key ids to read, at most 50, sent comma-separated. Left out, every key the caller can see.

options.failedOnlyboolean

Only calls answered with a status of 400 or more.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Rows per page, a whole number from 1 to 100. The server defaults to 25.

options.cursorstring

The nextCursor from the previous page, passed back unchanged. Never build one yourself.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

Page<ApiKeyRequestResource> with items, hasMore and nextCursor. Each item has id, keyId, keyName, requestId, method, path, status, errorCode, durationMs, ip, userAgent and createdAt.

Örnek

const page = await openemail.keys.listWorkspaceRequests({ failedOnly: true, since: '2026-09-22T00:00:00Z' }) for (const call of page.items) console.log(call.keyName, call.method, call.path, call.status)

Şurada da var

API
GET /keys/requests
CLI
openemail keys list-workspace-requests

keys.listAllWorkspaceRequests()

Collect the request log of every key into one array

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listAllWorkspaceRequests(options?: ApiKeyWorkspaceRequestListOptions): Promise<Array<ApiKeyRequestResource>>

Walks every page of listWorkspaceRequests under the same filters. The log is never pruned, so give it a window, or use iterateWorkspaceRequests to stop early.

Parametreler

options.keyIdsArray<string>

Key ids to read, at most 50, sent comma-separated. Left out, every key the caller can see.

options.failedOnlyboolean

Only calls answered with a status of 400 or more.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size for each request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and the walk with it.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

Array<ApiKeyRequestResource>, newest first.

Örnek

const failures = await openemail.keys.listAllWorkspaceRequests({ failedOnly: true, since: new Date(Date.now() - 60 * 60 * 1000), limit: 100 }) console.log(failures.length, 'failed calls in the last hour')

Notlar

  • If any page fails the promise rejects and the rows already fetched are discarded.

Şurada da var

API
GET /keys/requests

keys.iterateWorkspaceRequests()

Stream the request log of every key one call at a time

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
iterateWorkspaceRequests(options?: ApiKeyWorkspaceRequestListOptions): AsyncGenerator<ApiKeyRequestResource, void, undefined>

An async generator over listWorkspaceRequests under the same filters, fetching a page only when the one before is drained.

Parametreler

options.keyIdsArray<string>

Key ids to read, at most 50, sent comma-separated. Left out, every key the caller can see.

options.failedOnlyboolean

Only calls answered with a status of 400 or more.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size per request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and ends the iteration.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

AsyncGenerator<ApiKeyRequestResource, void, undefined> yielding one call per step.

Örnek

for await (const call of openemail.keys.iterateWorkspaceRequests({ failedOnly: true })) {    if (call.status >= 500) console.log(call.requestId, call.path)}

Şurada da var

API
GET /keys/requests

keys.listWorkspaceActivity()

List one page of what happened to every key

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listWorkspaceActivity(options?: ApiKeyWorkspaceActivityListOptions): Promise<Page<ApiKeyActivityResource>>

Returns one page of the audit log of every key in the workspace, newest first, the Activity tab of Settings, API keys. Every change to a key is a row: created, updated, rotated, deactivated, reactivated, revoked and deleted, plus auth_failed for every call that presented the key and was refused. actor names who made the change, a person as @username or a key as API key <name> in label, and detail.source says where it came from: console, api, mcp or documentation.

keyIds narrows it, deleted keys included, and since and until keep a window. A narrowed key reads only the activity of the keys it can see.

Parametreler

options.keyIdsArray<string>

Key ids to read, at most 50, sent comma-separated. Left out, every key the caller can see.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Rows per page, a whole number from 1 to 100. The server defaults to 25.

options.cursorstring

The nextCursor from the previous page, passed back unchanged. Never build one yourself.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

Page<ApiKeyActivityResource> with items, hasMore and nextCursor. Each item has id, keyId, keyName, type, createdAt, actor and detail.

Örnek

const page = await openemail.keys.listWorkspaceActivity({ since: '2026-09-01T00:00:00Z' }) for (const change of page.items) console.log(change.keyName, change.type, change.actor?.label)

Şurada da var

API
GET /keys/activity
CLI
openemail keys list-workspace-activity

keys.listAllWorkspaceActivity()

Collect the audit log of every key into one array

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
listAllWorkspaceActivity(options?: ApiKeyWorkspaceActivityListOptions): Promise<Array<ApiKeyActivityResource>>

Walks every page of listWorkspaceActivity under the same filters and resolves with every change, newest first.

Parametreler

options.keyIdsArray<string>

Key ids to read, at most 50, sent comma-separated. Left out, every key the caller can see.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size for each request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and the walk with it.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

Array<ApiKeyActivityResource>, newest first.

Örnek

const changes = await openemail.keys.listAllWorkspaceActivity({ since: new Date('2026-09-01T00:00:00Z') }) console.log(changes.filter((change) => change.detail.source === 'api').length, 'changes made over the API')

Notlar

  • If any page fails the promise rejects and the rows already fetched are discarded.

Şurada da var

API
GET /keys/activity

keys.iterateWorkspaceActivity()

Stream the audit log of every key one change at a time

Kapsamlarkeys:readSonuçlarda sayfa sayfa ilerler
İmza
iterateWorkspaceActivity(options?: ApiKeyWorkspaceActivityListOptions): AsyncGenerator<ApiKeyActivityResource, void, undefined>

An async generator over listWorkspaceActivity under the same filters, fetching a page only when the one before is drained.

Parametreler

options.keyIdsArray<string>

Key ids to read, at most 50, sent comma-separated. Left out, every key the caller can see.

options.sinceDate | string

Only rows at or after this instant. A Date is sent as ISO 8601, and a string must already be one.

options.untilDate | string

Only rows before this instant. It has to be later than since, or the server answers 400 invalid_parameter.

options.limitnumber

Page size per request, 1 to 100. The server defaults to 25.

options.cursorstring

Starts the walk from this cursor instead of the newest row.

options.signalAbortSignal

Cancels the request in flight and ends the iteration.

options.apiKeystring

Overrides the client API key for every page of this walk.

Döndürür

AsyncGenerator<ApiKeyActivityResource, void, undefined> yielding one change per step.

Örnek

for await (const change of openemail.keys.iterateWorkspaceActivity()) {    if (change.type === 'auth_failed') console.log(change.keyName, change.detail.reason, change.createdAt)}

Şurada da var

API
GET /keys/activity

keys.stats()

Read what the keys did inside a window

Kapsamlarkeys:reademails:read
İmza
stats(options?: ApiKeyStatsOptions): Promise<ApiKeyStatsResource>

Returns the numbers behind the Analytics tab of the API keys page: the mail the keys sent and what became of it, the calls refused because a secret was wrong, revoked or expired, the requests they made and how many failed, the routes they called most with the median time each took, and the status codes they got back.

It covers every key you can see, or the ones keyIds names. The window runs from since to until, and left out it is the 30 days before now. grain sets the bucket width of the series and offsetMinutes shifts the boundaries so days break where the reader's day does.

Parametreler

options.keyIdsArray<string>

Only these keys, at most 50. Left out, every key you can see.

options.sinceDate | string

The start of the window, a Date or an ISO 8601 instant. Defaults to 30 days before until.

options.untilDate | string

The end of the window, not included. Defaults to now.

options.grainTrackingGrain

Bucket width: minute, hour or day, defaulting to day.

options.offsetMinutesnumber

Minutes east of UTC to bucket in, from -840 to 840, defaulting to 0.

options.signalAbortSignal

Cancels the request.

options.apiKeystring

Overrides the client API key for this call only.

Döndürür

ApiKeyStatsResource with the window it covered, sends, rejected, requests, routes and codes.

Örnek

const stats = await openemail.keys.stats({ grain: 'day' }) console.log(stats.sends.totals.sends, 'sent')console.log(stats.routes.slice(0, 3))

Notlar

  • A key narrowed to some domains or addresses only counts the keys whose send scope sits inside its own, and an access token is refused with 403 owner_only unless it acts for the owner of the workspace.

  • The series are sparse: a bucket with nothing in it has no entry, so a chart must fill the gaps.

  • Retried automatically on network failure, since it only reads.

Şurada da var

API
GET /keys/stats
CLI
openemail keys stats