Spec0docsCLI 0.7.0

Create a mock server for a known API

Provide either apiId or apiName. If a mock already exists for the (api, team) pair the existing one is returned (idempotent).

A new mock counts against the plan's max_mock_servers limit; returning an existing one does not. At the limit this returns 402 with the limit, the current count and the plan.

Requires scope write:mocks.

POST
/api/v1/public/mocks

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

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://app.spec0.io/api/v1/public/mocks" \  -H "Content-Type: application/json" \  -d '{}'
{
  "mockServerId": "ab6f0051-1ea2-4f26-bcfb-0e9ea431b824",
  "apiName": "string",
  "mockBaseUrl": "string",
  "created": true,
  "apiKey": "string"
}
{
  "status": 0,
  "title": "string",
  "detail": "string",
  "type": "string",
  "instance": "string"
}
{
  "error": "string",
  "message": "string"
}
{
  "type": "https://spec0.io/problems/plan-limit-exceeded",
  "title": "Plan limit reached",
  "status": 402,
  "detail": "Your organisation has reached its limit of 3 mock servers.",
  "instance": "string",
  "feature": "max_mock_servers",
  "limit": 3,
  "used": 3,
  "plan": "FREE"
}
{
  "status": 0,
  "title": "string",
  "detail": "string",
  "type": "string",
  "instance": "string"
}
{
  "status": 0,
  "title": "string",
  "detail": "string",
  "type": "string",
  "instance": "string"
}
Was this helpful?