API tokens

To access the Nominal platform, via the API or the command-line interface, requires a system generated password called a token. Setting a token is the first step in any scripted workflow.

There are two types of tokens:

  • API keys are long-lived tokens, intended for services, instruments, repeated use, etc.
  • Personal access tokens are short lived, typically used for quick, one-off experiments.

Generating a token

Tokens are generated from the profile page:

Profile Page — Generating API tokens

  • API key: Click API keysGenerate API key. Give the key a name and an expiry date, and click Generate key. Copy the key: you won’t be able to see it again.
  • Personal access token: Click Personal access tokensCopy access token. The token is copied to the clipboard.

Setting a token

You may now use the token to authenticate, either via the API or the CLI:

1import nominal as nm
2
3nm.set_token(
4 url = 'https://api.gov.nominal.io/api',
5 token = '<TOKEN>'
6)
1$ nom auth set-token <TOKEN>
2Successfully set token for 'https://api.gov.nominal.io/api' in /home/user/.nominal.yml
Built with