MemorySync
API Reference

Test API Key

Return current metadata for an API key without rotating its secret. The plaintext key is never returned — only its id, status, environment, scopes, project binding, and expiry. Useful as the SDK's first call after a key is configured to verify wiring end-to-end.
POST/org/api-keys/{key_id}/test

Authentication

Accepts a JWT bearer token (Authorization: Bearer eyJ…) or an API key (X-API-Key: ms_live_…). API-key callers should send X-Project-ID unless the key is project-locked. Cross-tenant operators must send X-Tenant-ID.

Path parameters

FieldTypeRequiredDescription
key_idintegerrequiredAPI key id.

Response

Returns 200 OK with the following body.

FieldTypeRequiredDescription
key_idintegeroptionalEchoed key id.
validbooleanoptionaltrue only when status is active AND not expired.
statusstringoptionalactive | revoked | expired.
environmentstringoptionalEnvironment binding (production / staging / …).
rate_limit_tierstringoptionalTier label, may be null.
scopesstring[]optionalGranted scopes.
project_idstringoptionalBound project id, or null for org-wide keys.
last_used_atstringoptionalRFC 3339 UTC, nullable.
expires_atstringoptionalRFC 3339 UTC, nullable for non-expiring keys.
expiredbooleanoptionaltrue when expires_at <= server_time.
server_timestringoptionalServer-side reference clock for expired evaluation.
200.json
{
"key_id": 501,
"valid": true,
"status": "active",
"environment": "production",
"rate_limit_tier": "standard",
"scopes": [
"memories:read",
"memories:write"
],
"project_id": "proj_support_bot",
"last_used_at": "2026-05-04T12:00:00Z",
"expires_at": "2026-08-04T00:00:00Z",
"expired": false,
"server_time": "2026-05-04T12:31:00Z"
}

Errors

StatusCodeDescription
400validation_errorBody or query failed schema validation. The error includes the offending field name.
401unauthenticatedMissing or invalid bearer token / API key.
403forbiddenAuthenticated principal lacks the required scope, role, or project access.
404not_foundTarget resource does not exist or is not visible to the calling tenant.
429rate_limitedPer-IP or per-route limit exceeded. Respect the Retry-After header.
500internal_errorUnhandled server error. Quote the request_id when contacting support.

Examples

cURL
curl -X POST https://api.memorysync.io/org/api-keys/EXAMPLE_ID/test \
-H "Authorization: Bearer $MEMORYSYNC_KEY"
javascript
import { MemorySync } from 'memorysync'
const client = new MemorySync({ apiKey: process.env.MEMORYSYNC_KEY })
const result = await client.request({
method: 'POST',
path: '/org/api-keys/EXAMPLE_ID/test',
})
console.log(result)
python
from memorysync import Client
client = Client(api_key=os.environ["MEMORYSYNC_KEY"])
result = client.request(
method="POST",
path="/org/api-keys/EXAMPLE_ID/test",
)
print(result)

Behavior & notes

Requires owner, admin, or developer role and admin:read scope. The handler never reads or returns the plaintext secret. Cross-project requests (X-Project-ID header) get 404 for keys scoped to a different project.