Spec0docsCLI 0.7.0

Reveal a mock server's API key

Returns the key a client sends (as X-Mock-API-Key) to call this mock. The full key is only in the response when a mock is first created, so this is how a client that didn't keep it, or runs on another machine, gets it back.

The key is a credential for calling the mock, so revealing it needs manage on the mock (the owning team, the mock's owner, or an org admin), not just the ability to see that it exists. Every reveal is audit-logged.

Keyed on the mock's public id, which does not change when the mock is refreshed. Cross-org returns 404, not 403, so the existence of a mock is not leaked.

Requires scope read:mocks.

GET
/api/v1/public/mocks/{mockServerId}/api-key

Authorization

BearerAuth
AuthorizationBearer <token>

Bearer token. Either a Personal Access Token (pat_...) or a Service Account Token (sat_...). Issued via the Spec0 dashboard or /me/personal-access-tokens.

In: header

Path Parameters

mockServerId*string
Formatuuid

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://app.spec0.io/api/v1/public/mocks/497f6eca-6276-4993-bfeb-53cbbbba6f08/api-key"
{
  "mockServerId": "ab6f0051-1ea2-4f26-bcfb-0e9ea431b824",
  "apiKey": "string",
  "apiKeyPreview": "ms_Ab12C..."
}
{
  "error": "string",
  "message": "string"
}
{
  "status": 0,
  "title": "string",
  "detail": "string",
  "type": "string",
  "instance": "string"
}
{
  "status": 0,
  "title": "string",
  "detail": "string",
  "type": "string",
  "instance": "string"
}
{
  "status": 0,
  "title": "string",
  "detail": "string",
  "type": "string",
  "instance": "string"
}
Was this helpful?