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-11-01
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 on REST v1: fygment:read for GET /api/v1/audit; fygment:write for POST /api/v1/skills/{slug}/feedback and POST /api/v1/skills/{slug}/proposals; fygment:install for GET /api/v1/skills/{slug}/export, GET /api/v1/skills/{slug}/download and POST /api/v1/installations. The other operations (searching and reading skills, versions, diffs, proposals and installations, and POST /api/v1/skills/{slug}/updates) need a valid v1 token but no particular scope. The OpenAPI document lists the scope on each operation that needs one; a token without it gets 403 with a step-up challenge (see Errors). Over MCP, scopes are checked per tool instead, and there fygment:read also gates the read tools such as skill search.
An OAuth token is bound to the workspace approved at sign-in. Calls use that workspace; naming another one with ?workspace=<slug> gets 403.
Legacy workspace API keys: OAuth 2.1 tokens are the supported path, but existing integrations can still send a legacy key as Authorization: Bearer fyg_... or in the X-Fygment-Api-Key header, on /api/v1 as on the unversioned paths. API-key callers are not scope-checked. A key may need ?workspace=<slug>: when the key is not tied to one workspace and its user belongs to several, a call without it gets 400. An unrecognised key gets 401. Treat API keys as a legacy or development fallback: they will be retired, and the retirement will be announced with a Sunset header at least 90 days ahead (see Deprecation and sunset). New integrations should use OAuth.
Get a token
There is no page for creating personal REST tokens yet. A client gets a v1 token through the standard OAuth 2.1 authorization code flow, using the endpoints published at https://fygment.dev/.well-known/oauth-authorization-server.
- 1
Identify the client
Use a Client ID Metadata Document (an HTTPS URL as the
client_id; supported, and the default for public clients), or register at https://fygment.dev/register (dynamic client registration, RFC 7591). - 2
Send the user to the authorization endpoint
Open https://fygment.dev/authorize with
response_type=code, yourclient_idandredirect_uri, a PKCEcode_challengewithcode_challenge_method=S256,resource=https://fygment.dev/api/v1, and the scopes you need, for examplescope=fygment:read fygment:write fygment:install offline_access(offline_accessasks for a refresh token). The user signs in to Fygment and approves a workspace. - 3
Check the response and exchange the code
Check that
isson the redirect equalshttps://fygment.dev, then POST to https://fygment.dev/token withgrant_type=authorization_code, thecode, yourredirect_uriandclient_id, the PKCEcode_verifierandresource=https://fygment.dev/api/v1. - 4
Call the API and refresh
Send the
access_tokenasAuthorization: Bearer <token>; the examples below read it from$FYGMENT_TOKEN. When it expires, POSTgrant_type=refresh_tokenwith yourrefresh_token,client_idandresource=https://fygment.dev/api/v1to the same token endpoint.
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: per OAuth token, or per user for legacy API keys (v1 does not accept session cookies). 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
Most errors are 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. Two responses do not follow this shape yet: an export blocked or held by the trust review (422, below) and an invalid limit on GET /api/v1/audit (400 with only {"error": "..."}). When a response has no code, act on its HTTP status.
400 bad_request
Check: A parameter or body field failed validation. Or the error says "workspace query parameter is required": the API key is not tied to one workspace, its user belongs to several, and the call named none.
Next: Fix the fields listed in details and resend. For the workspace case, add ?workspace=<slug>.
401 unauthorized
Check: The token is missing, expired, revoked or issued for another resource, a legacy API key is not recognised, 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 and the token was approved for; the audit trail also needs a workspace owner or admin.
403 forbidden on /diff
Check: One of the versions hasn't passed review. Only a workspace owner or admin, the skill's owner or author, or a lead of a team it's shared with can compare it. On GET /api/v1/skills/{slug} and /versions, the same version keeps its row with manifest_withheld: true and no text, and manifest_version names the approved version returned instead.
Next: Use a version listed in details.available_versions, or ask a workspace owner or admin to review it.
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.
409 conflict
Check: The resource changed or failed verification, for example a package download whose checksum did not match.
Next: Fetch the resource again and retry.
422 unprocessable
Check: The request was understood but cannot be processed as asked. An export that the trust review blocked or held answers {"ok": false, "error": "...", "trustReview": {...}}, with no code.
Next: Read error and trustReview. Do not install a blocked package; a held export can be retried later, and if it keeps being held the package needs a manual review.
429 rate_limited
Check: The credential is over its rate limit.
Next: Wait for Retry-After seconds, then retry.
5xx server_error
Check: Fygment could not complete the request, for example an export whose checksum check failed (500). A 5xx with a JSON body carries code: "server_error"; act on the status if there is no body.
Next: Retry with backoff. If it keeps failing, contact support with the time and the request path.
Examples
curl -H "Authorization: Bearer $FYGMENT_TOKEN" 'https://fygment.dev/api/v1/skills?query=review'Search the workspace registry.
curl -H "Authorization: Bearer $FYGMENT_TOKEN" 'https://fygment.dev/api/v1/skills/YOUR_SKILL_SLUG/versions'List a skill's published versions. Replace YOUR_SKILL_SLUG with the skill's slug.
curl -i 'https://fygment.dev/api/v1'Read the API index and see the live RateLimit fields (no token needed).
curl 'https://fygment.dev/openapi.json'Fetch 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.