Viam API keys

API keys grant access to organizations, locations, and machines.

To view all API keys in use for your organization and the locations and machines inside it, click on the organization dropdown in the top navigation bar and click on Settings.

API Keys table

Add an API key

On your organization’s page, click Generate key to generate a new key. Optionally, give the key a name. Click on the Resource menu and choose what organization, location, or machine you want the key to grant access to. If you select organization, your key grants access to all locations and machines contained within that organization. If you select location, your key grants access to all of the machines contained within that location.

For Role, assign either an Owner or Operator role. See Permissions for information about the privilege each role entails at each resource level.

Change an API key’s access

To edit an API key, click on Show details in the key’s row of the key table’s Resources column.

Additional details for a key

To edit the role, click on the dropdown menu next to the role and select Owner or Operator. See Permissions for information about the privilege each role entails at each resource level.

To change the entities it is able to access, click + Grant additional access. Select which organization, location, or machine you want the key to grant access to. Click Choose to confirm your selection.

Rotate an API key

Viam supports flexible key rotation with up to two keys in use at one time. If you ever need to rotate an API key you can use the Viam app:

  1. In the Viam app, click on the organization dropdown in the top navigation bar.
  2. Click on Settings and invites.
  3. Click the Generate Key button on the organization setting page to generate a new key.
  4. Update all code and integrations that use the key.
  5. Find the old API key on the page and click on Show details.
  6. Then click Remove API key.

Alternatively, you can use the RotateKey API method.