Reference
REST API reference
How to call the Fygment REST API: base URL, authentication, versioning and deprecation policy, rate limits and the error format.
- Audience
- Developers and agents calling Fygment from scripts, integrations or API plugins.
- Updated
- 2026-10-11
The REST API lives at https://fygment.dev/api/v1 and is described by the OpenAPI 3.1 document at https://fygment.dev/openapi.json. Agents in Claude, ChatGPT, Gemini, Cursor and other MCP clients usually connect through the MCP server at https://fygment.dev/api/mcp instead.
Base URL and description
Base URL: https://fygment.dev/api/v1. Every operation in the OpenAPI document at https://fygment.dev/openapi.json is listed with its full versioned path, for example GET https://fygment.dev/api/v1/skills.
Responses carry `Link: <https://fygment.dev/openapi.json>; rel="service-desc"` so a client can find the description from any call.
GET https://fygment.dev/api/v1 is the public API index. It needs no token and returns JSON with the major version, links to the OpenAPI document, this page, OAuth discovery for v1 and the MCP server card, and the authentication, deprecation and rate-limit policy.
Authentication
Send an OAuth 2.1 access token in the Authorization header: `Authorization: Bearer <token>`. Never put a token in the query string.
The REST API v1 is its own protected resource, `https://fygment.dev/api/v1`, with its own metadata (RFC 9728) at https://fygment.dev/.well-known/oauth-protected-resource/api/v1. Request tokens with `resource=https://fygment.dev/api/v1` (RFC 8707) on the authorization request and the token request. A call without a usable token gets 401 with `WWW-Authenticate: Bearer resource_metadata="https://fygment.dev/.well-known/oauth-protected-resource/api/v1", scope="..."`.
v1 is bearer-only: session cookies from a signed-in browser are not accepted there (401), so a web page cannot make v1 calls on a visitor's behalf.
Tokens issued for the MCP resource (https://fygment.dev/api/mcp) are deprecated on v1 as of 2026-10-11. They are accepted until 2027-01-31T00:00:00Z, and every such response carries `Deprecation: @1791676800`, `Sunset: Sun, 31 Jan 2027 00:00:00 GMT` and a `Link` to this page with `rel="deprecation"`. From that instant, the REST layer refuses them with 401 and `WWW-Authenticate: Bearer error="invalid_token"` plus an `error_description`; use a token issued for `https://fygment.dev/api/v1`. Move to v1 tokens: a client holding a refresh token for the MCP resource can ask the token endpoint for a v1 access token from the same grant by sending `resource=https://fygment.dev/api/v1` with `grant_type=refresh_token`.
The authorization server metadata is at https://fygment.dev/.well-known/oauth-authorization-server. Clients register with a Client ID Metadata Document or dynamic client registration and use PKCE (S256). Every authorization response (the code, or an error sent to the redirect URI) carries `iss` (RFC 9207); check that it equals the `issuer` in the metadata.
Scopes: `fygment:read` (audit trail), `fygment:write` (feedback and change proposals), `fygment:install` (installation reports). Each operation in the OpenAPI document lists the scope it needs; a token without it gets 403 with a step-up challenge (see Errors).
Versioning
The major version is in the path: /api/v1. Within v1 every change is additive: new operations, new optional parameters and new response fields. Clients must ignore response fields they do not recognise.
A breaking change (removing or renaming a field or operation, tightening validation, changing a type or a default) ships as a new major version under /api/v2. The previous major version keeps working for at least 12 months after its successor is released.
Deprecation and sunset
A deprecated path or operation keeps working and answers with a `Deprecation` header (RFC 9745, for example `Deprecation: @1791590400`) and a `Link` header pointing at its `rel="successor-version"` and at this page as `rel="deprecation"`. Deprecated operations are also marked `deprecated: true` in the OpenAPI document.
Removal is announced with a `Sunset` header (RFC 8594) at least 90 days before the date, and listed in the changelog. Nothing is removed without a Sunset date having been announced first.
The unversioned paths (/api/skills, /api/installations, /api/audit and the paths below them) were deprecated on 2026-10-10 in favour of /api/v1. They still work and have no sunset date yet; move to /api/v1 when convenient.
Rate limits
REST: 600 requests per 60 seconds per credential (OAuth token, API key or signed-in user). MCP: 300 requests per 60 seconds per user and workspace.
The public API index, GET https://fygment.dev/api/v1, is the one endpoint open without a token. It has its own anonymous policy: 60 requests per 60 seconds per client IP (`RateLimit-Policy: "anonymous";q=60;w=60`).
Responses carry `RateLimit-Policy: "rest";q=600;w=60` (quota q and window w in seconds) and, once the request has been counted, `RateLimit: "rest";r=<requests left>;t=<seconds until a slot frees>`, on successful responses as well as on 429. Both fields follow draft-ietf-httpapi-ratelimit-headers, which may still change before it becomes an RFC.
Over the limit, the API answers 429 with a `Retry-After` header in seconds and the JSON error code `rate_limited`. Wait that long, then retry; back off further if the next attempt is also limited.
Errors
Every error is JSON: `{"error": "...", "code": "...", "hint": "...", "docs_url": "https://fygment.dev/openapi.json"}`, with `details` on validation failures. Act on `code`, not on the wording of `error`.
400 bad_request
Check: A parameter or body field failed validation.
Next: Fix the fields listed in `details` and resend.
401 unauthorized
Check: The token is missing, expired, revoked or issued for another resource, or the call sent a session cookie instead of a token.
Next: Refresh the token, or sign in again through OAuth with resource=https://fygment.dev/api/v1.
403 forbidden
Check: The caller cannot use this workspace, or the token lacks the scope. When the scope is missing, the response carries `WWW-Authenticate: Bearer error="insufficient_scope", scope="...", resource_metadata="..."`, where `scope` is everything the token already holds plus the scope the operation needs.
Next: For a missing scope, re-authorise with exactly the `scope` in the challenge (the authorization server is named by `resource_metadata`), then retry. Otherwise use a workspace you belong to.
404 not_found
Check: The skill, version, workspace or path does not exist.
Next: List skills with GET /api/v1/skills and check the slug.
429 rate_limited
Check: The credential is over its rate limit.
Next: Wait for Retry-After seconds, then retry.
Examples
curl -H "Authorization: Bearer $FYGMENT_TOKEN" https://fygment.dev/api/v1/skills?query=reviewSearch the workspace registry.
curl -H "Authorization: Bearer $FYGMENT_TOKEN" https://fygment.dev/api/v1/skills/<slug>/versionsList a skill's published versions.
curl -i https://fygment.dev/api/v1Read the API index and see the live RateLimit fields (no token needed).
curl https://fygment.dev/openapi.jsonFetch the OpenAPI 3.1 description (no token needed).
Related docs
- Set up Fygment MCP
MCP setup gives AI clients access to workspace-scoped Fygment tools. Hosted clients use OAuth; local clients use guided setup and a local authenticated proxy where needed.
- CLI reference
The CLI is the local bridge between a governed workspace and writable AI harness targets. Use it for setup, install state, update checks, setup checks, and selected imports.
- Security and privacy boundaries
The Fygment trust model is metadata-minimizing: keep customer Skill content, package bodies, prompts, secrets, tokens, and raw local paths out of admin, support, analytics, and billing surfaces.