MemorySync
API Reference · Control-plane API

Bulk Revoke API Keys

Revoke up to 100 organization API keys in one protected control-plane request and inspect every per-key outcome.

Endpoint contract

POST/org/api-keys/bulk-revoke
200 OK

Use the exact method and path shown above. Paths are relative to the API base URL.

Authentication, permission, and scope

ControlRequired contract
AuthenticationBearer access token for an active organization member.
Permission or scopeapi_keys.delete capability and admin:write scope.
Resource scopeKeys are resolved only inside the caller’s organization and selected project context.

Request fields

FieldTypeContract
key_idsinteger[]Required; 1–100 key IDs. Duplicate IDs are processed once.

Code examples

import os
from memorysync import ControlPlaneClient
client = ControlPlaneClient(
base_url="https://api.memorysync.io",
access_token=os.environ["MEMORYSYNC_ACCESS_TOKEN"],
)
result = client.bulk_revoke_api_keys(
[41, 42, 43],
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
)

Response shape

response.json
{"revoked":2,"already_revoked":0,"not_found":1,"results":[{"key_id":41,"status":"revoked"},{"key_id":42,"status":"revoked"},{"key_id":43,"status":"not_found"}]}
  • Inspect results even when the request returns 200.
  • Valid statuses are revoked, already_revoked, not_found, and forbidden.

Status outcomes

HTTP outcomes
2xx
Request completed

Read the operation-specific response and persist only fields needed by the task.

400 / 422
Correct the request

Fix invalid path, query, or body fields before trying again.

401 / 403
Access denied

Refresh authentication or verify the required organization permission and scope.

404
Unavailable in scope

Treat the resource as unavailable without revealing whether it exists elsewhere.

429 / 5xx
Keep the action recoverable

Use returned retry metadata when present and reconcile uncertain mutations before repeating them.

Production handling

Production request path
  1. 01

    Authorize

    APP

    Confirm the signed-in principal may perform this product action.

  2. 02

    Validate

    INPUT

    Validate identifiers and body fields before sending the request.

  3. 03

    Call

    SDK

    Use the named ControlPlaneClient method or equivalent HTTPS request from a trusted application context.

  4. 04

    Inspect

    RESULT

    Match every result to its requested key ID.

  5. 05

    Reconcile

    SAFE

    Update local key state only for confirmed outcomes; already-revoked is an idempotent success.

Security notes

Control-plane safety

Required

Keep organization controls inside trusted boundaries.

  • Require a deliberate administrator action.
  • Never send raw API-key secrets in this request.
  • Audit who initiated the revocation and which IDs were confirmed.

Avoid

Do not weaken the route contract in client code.

  • Do not expose bearer or refresh tokens in URLs, logs, or public clients.
  • Do not accept organization, member, project, or resource IDs without application authorization.
  • Do not treat returned data as trusted HTML, prompt instructions, or proof of application authorization.
Was this page helpful?