API reference
Authentication and idempotency
Credentials, scopes, Idempotency-Key and request IDs for every SciFig API call.
Bearer authentication#
Send Authorization: Bearer <credential> on every request except GET /pricing, GET /openapi.json and GET /openapi.yaml. Credentials in query parameters or other headers are ignored.
Credentials use Bearer authentication; DPoP-bound credentials are not supported.
- API keys start with
sk_live_. Create them under Settings → API Keys; the key is shown once. Keep it on a server and never ship it in a browser or mobile app. We email you 7 days before a key expires. - OAuth access tokens start with
sf_at_. MCP clients receive them after you approve the client; you can disconnect a client under Settings → API Keys → Connected apps. - A missing, invalid, expired or revoked credential returns
401 UNAUTHORIZED. An account that cannot use the API (for example, one being deleted) returns401 ACCOUNT_UNAVAILABLE. - Revoking a key stops new requests with it; jobs it already created keep running and stay readable with another credential of the same account.
Scopes#
| Scope | Grants | API key type |
|---|---|---|
| images:generate | /images/generations | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| images:edit | /images/edits | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| images:edit | /images/upscales | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| images:edit | /images/text-detections | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| images:convert | /images/conversions | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| charts:generate | /charts/generations | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| charts:generate | /charts/edits | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| flowcharts:generate | /flowcharts/generations | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| flowcharts:generate | /flowcharts/edits | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| files:write | /files | Keys with any write scope require an active subscription or a positive credit-pack balance and expire after 30, 90 or 365 days. Read-only keys may also have no expiry. |
| jobs:read | /jobs | Read-only key; may never expire |
| jobs:read | /jobs/{id} | Read-only key; may never expire |
| jobs:read | /files/{id} | Read-only key; may never expire |
| credits:read | /credits | Read-only key; may never expire |
A request outside the credential’s scope returns 403 SCOPE_DENIED. Use a separate key per application and environment so that you can revoke one without affecting the others.
Choose any of eight independent scopes. None grants another scope; uploads, job reads and balance reads require their own permissions.
GET /api/v1/capabilities requires a valid credential, but no business scope. It returns only granted_scopes, never balance, plan or account data.
Every authenticated call, including permission denials and other errors, is recorded as metadata for 30 days. No prompts, content, file names, IP addresses or credentials are stored. Logging is best effort during platform failures. Settings shows keys, request history and connected apps in separate lists of 10 per page. Request credits describe the associated job’s settlement; do not sum replay rows as spending.
Idempotency#
- Every create request (
POST /images/*,/charts/*,/flowcharts/*) requires anIdempotency-Keyheader of 1–255 visible ASCII characters. A random UUID per request is the simplest choice. Uploads toPOST /filesmay send one too (see files). - The same key with the same body returns the same job and never reserves credits again. For chart uploads the bytes of the data file are part of the body.
- The same key with a different body returns
409 IDEMPOTENCY_CONFLICT. Concurrent requests with the same key never create two jobs: each returns the same job, or409 IDEMPOTENCY_IN_PROGRESSwithRetry-After: 1while the first one is still being admitted. - Retry with the same key after a timeout, a network error, a
429or a503: it is the only way to be sure a job is not created twice. - Once the job exists, a retryable error (
429,503,409 IDEMPOTENCY_IN_PROGRESS) or500 INTERNAL_ERRORcarriesdetails.job_id. Retry with the same key or pollGET /jobs/{job_id}; do not switch to a new key, which would create and charge a second job. A job that was accepted but could not be read back is answered with202and statusqueued. - A refused request (for example
402 INSUFFICIENT_CREDITS) keeps that answer for its key. After topping up or upgrading, send it again with a new key.
OAuth clients#
- MCP clients use OAuth 2.1 with PKCE. Access tokens (
sf_at_…) are valid for 1 hour. A client that asks for theoffline_accessscope also receives a refresh token (sf_rt_…) valid for 30 days, so it stays connected until you disconnect it; withoutoffline_accessyou sign in again when the access token expires. - Refresh tokens rotate: each refresh returns a new one. Presenting a refresh token that was already used is treated as reuse and revokes the tokens issued from it, so the client has to sign in again.
- Dynamic client registration accepts a body of at most 16 KB, with limits on the length of each field and the number of redirect URIs. Token endpoint authentication is
none(public clients with PKCE) orclient_secret_basic. - A client registered but never authorized is deleted after 24 hours.
- An authorization request with
prompt=loginormax_ageasks for a fresh sign-in. If you are already signed in, SciFig asks you to confirm before signing you out and back in. - Rate limits for OAuth credentials count per client and per account, so other users of the same assistant do not use up your limits.
- Only allowed
CIMDclients may useprivate_key_jwtwith verified public keys and replay protection; anonymous dynamic registration still accepts onlynoneorclient_secret_basic.
Request IDs#
Every response carries X-Request-Id; error bodies repeat it as error.request_id. It identifies the request in our logs without exposing anything else, so it is safe to log and to include when you contact support.