Skip to content
Authentication

Authentication

Use a bearer API key for every request.

Create a key#

Open Settings → API keys. Copy your new key; it is shown only once.

Follow the Quick start to make your first authenticated request with this key.

Store it on your server, outside source control and model messages.

Server environment
export SMALLWORLD_API_KEY="swk_replace_with_your_key"

Authenticate requests#

Request headers
Authorization: Bearer swk_replace_with_your_key

Use the JSON content type for request bodies. Browser login cookies do not authenticate /api/v1.

Access and identity#

Keys access the owner’s entire workspace. Your backend must authorize each user’s access to sessions, executions, connections, and approvals.

Derive userId from your authenticated application user. It is your identifier, not a Smallworld login ID.

To connect a user’s external account, create a connect session.

IP restrictions and key rotation

IP restrictions apply to every /api/v1 request made with your API keys, including keys created by the dashboard Quick start. Disallowed addresses receive 403 ip_not_allowed. The dashboard and the Playground, which uses a Smallworld-managed key, work from any address.

To rotate a key, create a replacement, update your backend, then revoke the old key in Settings.