Manage API tokens
Create, edit, rotate and delete API tokens on a folder: scopes, the mandatory expiry, CORS and IP allow-lists, and the secret that is shown once.
An API token is what an application uses to log in to BIM.works without a username and password. A token belongs to the account that created it and is rooted on a Node: every call made with it sees that node as the root of the tree and nothing above it. This guide manages tokens in the browser; using one from code is Log in with an API token.
Before you start#
Switch the interface to Developer mode in the profile menu if the API Tokens section is missing: End user mode hides it. You need write access to the node.
Create a token#
- Click the name of the folder in the Models tree and open the API Tokens section of its popup. Tokens are normally created on a folder; the section also exists on a model, with a warning, for the uncommon case of giving an integration exactly one model and nothing else.
- Click Add and fill in the form:
- Name — only for recognising the token in this list.
- Expires on — mandatory. One month ahead by default and at most three years; the token stops working on that day. Reminders are mailed before a token expires.
- BIM context — how uploaded models are interpreted; fixed once the token exists.
- Only allow certain CORS domains — a comma-separated list of origins. It only takes effect when the instance's administrator has set
web_security.corstoREQUIRED; then a browser page on an origin that is not on the list cannot use the token. On the default setting every origin can. Off by default. - Only allow white listed IP addresses — a comma-separated list; useful for a token that only a server should use. Off by default.
- Scopes — what the token may do. Pick a preset (Read-only integration, Full integration) or tick scopes one by one; at least one is required.
- Click Add. The secret is shown once. Copy it with Copy and close; Close stays disabled until you have copied it, because there is no way to see it again.
Edit, rotate and delete#
Each token is a card with the last four characters of its secret, its expiry, its scopes and its restrictions. From its menu:
- Edit changes the name, the expiry, the scopes and both allow-lists. A token from before scopes existed shows its legacy READ or READ/WRITE rights; saving converts them to the equivalent explicit scopes.
- Rotate secret issues a new secret and shows it once; the old one stops working immediately, and the name, scopes and restrictions stay.
- Delete revokes the token. Applications using it fail from that moment.
Every account gets a Demo folder with a Demo API Token on it when it is created. The interactive SDK examples use that token, and it is stored in your user settings as demo_api_token. Treat it like any other token: rotate it if it leaks.
Check#
Log in with the new token from the SDK of your choice (Log in with an API token) and list the root: you see the folder the token was created on, and its Last login on the card is updated.