Spec0docsCLI 0.7.0

Publish or update a public API

First call (no publicApiId) creates a new public API. Subsequent calls with the same publicApiId update the existing one. Each call records an immutable version snapshot keyed on version.

Creating a new public API counts against the plan's max_public_apis limit; publishing a new version of an existing one never does. At the limit, a create returns 402 with the limit, the current count and the plan.

Requires scope write:public-apis.

POST
/api/v1/public/apis

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/apis" \  -H "Content-Type: application/json" \  -d '{    "openapiSpec": "string"  }'
{
  "publicApiId": "6cdb160e-37b9-4802-86c1-ee5fed60dba5",
  "apiSlug": "string",
  "orgSlug": "string",
  "version": "string",
  "visibility": "string",
  "created": true,
  "versionCreated": true,
  "publicUrl": "string",
  "lintScore": 0,
  "lintErrorCount": 0,
  "lintWarningCount": 0
}
{
  "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?