---
title: "Specs"
description: "REST endpoints for specs. Bearer-auth required."
section: "API"
group: "REST"
order: 62
---

## GET /api/specs

List specs.

**Query parameters**

- `limit` (optional): Page size (1–100, default 100).
- `after` (optional): Keyset cursor — return the page after this row (next page).
- `before` (optional): Keyset cursor — return the page before this row (prev page).
- `ids` (optional): Comma-separated list of IDs. Narrows results to these IDs within the caller's accessible scope (does not bypass access checks).
- `filter` (optional): Nested filter expression (`<Entity>Filter`): AND/OR/NOT + per-field comparison operators + relation traversal. JSON-encoded on the query string.
- `orderBy` (optional): Multi-key sort (`<Entity>OrderBy[]`): array of `{ field: direction }` applied in order. Directions: asc/desc plus the four explicit nulls variants. JSON-encoded on the query string.
- `workspace_id` (optional): Filter to specs in this workspace. When omitted, returns specs across every workspace the caller is a member of (admins see all).
- `name` (optional): Case-insensitive substring match on name.
- `include_deleted` (optional): Soft-deleted spec visibility. `false` (default) — active rows only. `true` — active plus soft-deleted. `only` — soft-deleted only (trash view).
- `spec_format` (optional): Shorthand: filter where `specFormat` equals this value.
- `current_version_id` (optional): Shorthand: filter where `currentVersionId` equals this value.
- `solution_id` (optional): Shorthand: filter where `solutionId` equals this value.
- `created_by` (optional): Shorthand: filter where `createdBy` equals this value.
- `retention_tier` (optional): Shorthand: filter where `retentionTier` equals this value.

**Response**

```json
{
  "data": [
    {
      "id": "<...>",
      "workspaceId": "<...>",
      "name": "<...>",
      "description": "<...>",
      "sourceUrl": "<...>",
      "specFormat": "<...>",
      "currentVersionId": "<...>",
      "baseUrl": "<...>",
      "authHeaderName": "<...>",
      "authValuePrefix": "<...>",
      "authSecretId": "<...>",
      "solutionId": "<...>",
      "createdBy": "<...>",
      "deletedAt": "<...>",
      "retentionTier": "<...>",
      "createdAt": "<...>",
      "updatedAt": "<...>"
    }
  ],
  "pageInfo": {
    "total": "number",
    "hasNextPage": "boolean",
    "hasPreviousPage": "boolean",
    "startCursor": "string",
    "endCursor": "string"
  }
}
```

## POST /api/specs

Create a spec

Persists the spec row, optionally creates / links a wrapping Solution, and fetches + ingests the OpenAPI spec on the same call. Ingest failure is non-fatal — the row is returned and refresh can retry.

**Request body**

```json
{
  "workspaceId": "string",
  "name": "string",
  "description?": "string",
  "sourceUrl": "string",
  "baseUrl?": "string",
  "authHeaderName?": "string",
  "authValuePrefix?": "string",
  "authSecretId?": "string",
  "solutionId?": "string",
  "autoCreateSolution?": "boolean"
}
```

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "sourceUrl": "string",
  "specFormat": "openapi-3.0 | openapi-3.1 | swagger-2.0",
  "currentVersionId": "string",
  "baseUrl": "string",
  "authHeaderName": "string",
  "authValuePrefix": "string",
  "authSecretId": "string",
  "solutionId": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## GET /api/specs/{id}

Get a spec by ID.

**Path parameters**

- `id` (required): Spec to retrieve.

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "sourceUrl": "string",
  "specFormat": "openapi-3.0 | openapi-3.1 | swagger-2.0",
  "currentVersionId": "string",
  "baseUrl": "string",
  "authHeaderName": "string",
  "authValuePrefix": "string",
  "authSecretId": "string",
  "solutionId": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## PATCH /api/specs/{id}

Update spec metadata or auth config

Does NOT re-fetch the spec. Call refresh to pick up upstream changes after updating the source URL or auth.

**Path parameters**

- `id` (required): The spec's prefixed ID (e.g. `spc_...`).

**Request body**

```json
{
  "name?": "string",
  "description?": "string",
  "sourceUrl?": "string",
  "baseUrl?": "string",
  "authHeaderName?": "string",
  "authValuePrefix?": "string",
  "authSecretId?": "string",
  "solutionId?": "string"
}
```

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "sourceUrl": "string",
  "specFormat": "openapi-3.0 | openapi-3.1 | swagger-2.0",
  "currentVersionId": "string",
  "baseUrl": "string",
  "authHeaderName": "string",
  "authValuePrefix": "string",
  "authSecretId": "string",
  "solutionId": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```

## DELETE /api/specs/{id}

Soft-delete a spec. Generated entities cascade-remove via spec_member; the wrapping solution is preserved (unwraps).

**Path parameters**

- `id` (required): Spec to soft-delete. Generated entities are soft-removed via spec_member; the wrapping solution is preserved (unwraps to set_null).

**Response**

```json
{
  "success": "boolean"
}
```

## DELETE /api/specs/{id}/purge

Permanently delete a soft-deleted spec.

**Path parameters**

- `id` (required): Soft-deleted spec to permanently delete.

**Response**

```json
{
  "success": "boolean"
}
```

## POST /api/specs/{id}/refresh

Refresh the spec

Re-fetches the OpenAPI spec from sourceUrl, diffs against the current version, and upserts generated entities. Returns the new version row + a diff summary. When the fetched spec is byte-identical to the current version, no new version is written and `diff.unchanged` is true.

**Path parameters**

- `id` (required): The spec's prefixed ID (e.g. `spc_...`).

**Response**

```json
{
  "spec": {
    "id": "<...>",
    "workspaceId": "<...>",
    "name": "<...>",
    "description": "<...>",
    "sourceUrl": "<...>",
    "specFormat": "<...>",
    "currentVersionId": "<...>",
    "baseUrl": "<...>",
    "authHeaderName": "<...>",
    "authValuePrefix": "<...>",
    "authSecretId": "<...>",
    "solutionId": "<...>",
    "createdBy": "<...>",
    "deletedAt": "<...>",
    "retentionTier": "<...>",
    "createdAt": "<...>",
    "updatedAt": "<...>"
  },
  "version": {
    "id": "<...>",
    "specId": "<...>",
    "version": "<...>",
    "spec?": "<...>",
    "parentId": "<...>",
    "fetchedAt": "<...>"
  },
  "diff": {
    "added": "integer",
    "modified": "integer",
    "removed": "integer",
    "unchanged": "boolean"
  }
}
```

## POST /api/specs/{id}/restore

Restore a soft-deleted spec.

**Path parameters**

- `id` (required): Soft-deleted spec to restore.

**Response**

```json
{
  "id": "string",
  "workspaceId": "string",
  "name": "string",
  "description": "string",
  "sourceUrl": "string",
  "specFormat": "openapi-3.0 | openapi-3.1 | swagger-2.0",
  "currentVersionId": "string",
  "baseUrl": "string",
  "authHeaderName": "string",
  "authValuePrefix": "string",
  "authSecretId": "string",
  "solutionId": "string",
  "createdBy": "string",
  "deletedAt": "string",
  "retentionTier": "any",
  "createdAt": "string",
  "updatedAt": "string"
}
```
