Docs menu

Authentication

Every request to a protected operation carries an API key as a bearer token:

Authorization: Bearer ivy_sk_…

The health probes GET /healthz and GET /readyz need no key. The API reference shows the scope each operation needs.

Service identities

A service identity is how an integration or agent acts in Ivy without a person behind it. Organisation owners and admins create them in the Ivy app. Each one has:

  • explicit access to the spaces it needs, with a space role (viewer, editor or admin) and the same rules as a person;
  • no organisation role: it is never an organisation admin or owner, whatever its keys’ scopes;
  • its own budget and spending limit for AI credits, on top of the organisation’s own limits;
  • its own API keys;
  • its own activity: everything it does is recorded under its name, with the ID of the key it used.

A service identity doesn’t take a seat. Disabling or deleting one stops its keys at once and cancels its running agent turns and code runs.

API keys

Keys belong to a service identity, never to a person. A person’s access follows your organisation’s sign-in rules (single sign-on, a second factor, session lifetime, offboarding), and a personal key would get around them. Use a service identity per integration instead.

Creating a key, or rotating one, needs an organisation owner or admin who signed in within the last 10 minutes; Ivy asks them to confirm it’s them otherwise. The key is shown once, in the response that creates it. Ivy keeps only a SHA-256 hash of it, so a lost key can’t be shown again: rotate it instead.

Key format

ivy_sk_<key ID: 12 characters>_<secret: 43 characters><checksum: 6 characters>

All three parts use the base62 alphabet (0-9, A-Z, a-z). The secret holds 256 random bits. The checksum is the CRC-32 of everything before it, in base62 and padded to 6 characters, so a mistyped key is refused without a lookup. The key ID isn’t secret: it appears in lists, in the activity log and in Ivy’s own logs, which never contain the secret.

To find leaked keys in code, logs or chat exports, give your secret scanner this pattern:

\bivy_sk_[0-9A-Za-z]{12}_[0-9A-Za-z]{49}\b

Scopes

A key only grants the scopes chosen when it was created. Scopes are <family>:<read|write>, and write includes read.

Scope Covers
workspaces:read the spaces the identity belongs to, their storage usage and event stream
files:read entries, folders, files, versions, downloads, search, trash listing
files:write upload, new versions, create, rename, move, trash, restore, delete from trash
conversations:read agent models, space agents, conversations, run streams, sandbox state
conversations:write create conversations, send messages (agent turns), cancel runs, apply/discard changes
code_runs:read code execution settings, runs, run streams, run logs
code_runs:write start and cancel code runs
share_links:read list and read share links in the identity’s spaces
share_links:write create share links for people in the organisation, revoke the identity’s own links
records:read collections, their schemas and records, record comments, and boards resolved
records:write create, change, move, delete and comment on records

Scopes and space roles both apply: a key with files:write still can’t upload to a space where its service identity is a viewer. Give each integration its own service identity with the narrowest scopes it needs, so that a leaked key exposes as little as possible.

A key can’t create share links for anyone outside the organisation or email them.

Never with a key

Whatever its scopes, a key can’t:

  • manage people: your own profile (/v1/me), users, invitations and space members;
  • see or change billing and usage;
  • request data exports;
  • change the organisation: its settings, sign-in and identity providers, imports, network access for code, or creating spaces and changing their settings;
  • manage service identities and API keys;
  • change the organisation’s rules for share links;
  • use the sign-in endpoints.

These operations aren’t in the API reference. Called with a key, they answer 403 with the code insufficient_scope.

SCIM tokens are a separate kind of key with the single scope scim. They only reach the SCIM routes, and API keys never do.

Which key is this?

GET /v1/api-key tells a key about itself: its key ID, scopes, expiry, service identity and organisation. It needs no scope, which makes it a good first request and a health check for an integration.

Rotation

Rotating a key issues a new key with the same name and scopes. The old key keeps working for an overlap you choose, from 0 seconds up to 7 days (1 day by default), and then expires. Deploy the new key within the overlap; there’s no downtime.

Rotate keys regularly, when someone who knew a key leaves, and whenever a key may have been seen by anyone else.

Revocation and expiry

  • Revoking a key takes effect on the next request.
  • Expiry: a key can have an expiry date. After it, the key stops working like a revoked one.
  • Disabling or deleting the service identity stops all its keys at once.

A request with a missing, mistyped, expired or revoked key gets 401 with the code unauthenticated. A valid key without the scope for an operation gets 403 with insufficient_scope. A space the service identity isn’t a member of answers 404, as if it didn’t exist; a role that isn’t enough answers 403 with forbidden.

Last use and audit

Ivy records when each key was last used and from which IP address, shortened (IPv4 to /24, IPv6 to /48). Organisation admins see this next to the key. Everything the service identity does appears in the organisation’s activity log with its name and the key ID.

Access tokens from your identity provider

Ivy still accepts access tokens (JWTs) issued by the identity provider that your Ivy deployment trusts. A token whose subject is a person in Ivy acts as that person, with their permissions. Use these for tools that act for a signed-in person; use API keys for integrations.

Keep keys on servers

API keys are server-side secrets. Don’t ship them in front-end code, mobile apps, browser extensions or source repositories. A browser application calls your own back end, which holds the key and calls Ivy. Ivy doesn’t check the Origin of requests that carry a bearer token and no cookie, so server-side clients work without one.