Skip to content

Commit d0d3a3a

Browse files
authored
Add API key page (#3845)
1 parent 3113cbd commit d0d3a3a

File tree

8 files changed

+55
-16
lines changed

8 files changed

+55
-16
lines changed

docs/dev/reference/apis/billing-client.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ You will also need an API key and API key ID to authenticate your session.
3333
Your API key needs to have [Org owner permissions](/manage/manage/rbac/#organization-settings-and-roles) to use the billing client API.
3434
To get an API key (and corresponding ID), you have two options:
3535

36-
- [Create an API key using the Viam app](/cloud/rbac/#add-an-api-key)
36+
- [Create an API key using the Viam app](/operate/control/api-keys/#add-an-api-key)
3737
- [Create an API key using the Viam CLI](/dev/tools/cli/#create-an-organization-api-key)
3838

3939
The following example instantiates a `ViamClient`, authenticating with an API key, and then instantiates a `BillingClient`:

docs/dev/reference/apis/data-client.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ To use the Viam data client API, you first need to instantiate a [`ViamClient`](
4949
You will also need an API key and API key ID to authenticate your session.
5050
To get an API key (and corresponding ID), you have two options:
5151

52-
- [Create an API key using the Viam app](/cloud/rbac/#add-an-api-key)
52+
- [Create an API key using the Viam app](/operate/control/api-keys/#add-an-api-key)
5353
- [Create an API key using the Viam CLI](/dev/tools/cli/#create-an-organization-api-key)
5454

5555
The following example instantiates a `ViamClient`, authenticating with an API key, and then instantiates a `DataClient`:

docs/manage/manage/access.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ You can also remove the user by clicking on **Remove user**.
9898

9999
You can remove any organization except the primary owner from the shared list by clicking the **X** to the right of the location in the shared list.
100100

101-
## Rotate an API key
102-
103-
If you ever need to rotate an API key, click on the **Generate Key** button on the organization setting page to generate a new key.
104-
105-
Viam supports flexible key rotation with up to two keys in use at one time.
106-
After generating a new secret key, update all references to the key in your code as soon as possible and then remove the old key.
107-
108101
## Collaborate safely
109102

110103
When you or your collaborators change the configuration of a machine or a group of machines in the Viam app, `viam-server` automatically synchronizes the configuration and updates the running resources within 15 seconds.

docs/operate/control/api-keys.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: "API keys"
3+
linkTitle: "API keys"
4+
weight: 50
5+
layout: "docs"
6+
type: "docs"
7+
description: "Run control logic on a machine."
8+
images: ["/general/code.png"]
9+
date: "2024-01-13"
10+
---
11+
12+
API keys grant access to organizations, locations, and machines.
13+
14+
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**.
15+
16+
{{<imgproc src="/fleet/api-keys.png" resize="700x" declaredimensions=true alt="API Keys table">}}
17+
18+
## Add an API key
19+
20+
On your organization's page, click **Generate key** to generate a new key.
21+
Optionally, give the key a name.
22+
Click on the **Resource** menu and choose what organization, location, or machine you want the key to grant access to.
23+
If you select organization, your key grants access to all locations and machines contained within that organization.
24+
If you select location, your key grants access to all of the machines contained within that location.
25+
26+
For **Role**, assign either an **Owner** or **Operator** role.
27+
See [Permissions](/manage/manage/rbac/) for information about the privilege each role entails at each resource level.
28+
29+
## Change an API key's access
30+
31+
To edit an API key, click on **Show details** in the key's row of the key table's **Resources** column.
32+
33+
{{<imgproc src="/fleet/additional-details.png" resize="700x" declaredimensions=true alt="Additional details for a key">}}
34+
35+
To edit the role, click on the dropdown menu next to the role and select **Owner** or **Operator**.
36+
See [Permissions](/manage/manage/rbac/) for information about the privilege each role entails at each resource level.
37+
38+
To change the entities it is able to access, click **+ Grant additional access**.
39+
Select which organization, location, or machine you want the key to grant access to.
40+
Click **Choose** to confirm your selection.
41+
42+
## Rotate an API key
43+
44+
If you ever need to rotate an API key, click on the **Generate Key** button on the organization setting page to generate a new key.
45+
46+
Viam supports flexible key rotation with up to two keys in use at one time. After generating a new secret key, update all references to the key in your code as soon as possible and then remove the old key.

static/include/app/apis/generated/app.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
803803

804804
### GetRobotAPIKeys
805805

806-
Gets the [API keys](/cloud/rbac/#api-keys) for the machine.
806+
Gets the [API keys](/operate/control/api-keys/) for the machine.
807807

808808
{{< tabs >}}
809809
{{% tab name="Python" %}}
@@ -2140,7 +2140,7 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
21402140

21412141
### CreateKey
21422142

2143-
Create a new [API key](/cloud/rbac/#api-keys).
2143+
Create a new [API key](/operate/control/api-keys/).
21442144

21452145
{{< tabs >}}
21462146
{{% tab name="Python" %}}
@@ -2184,7 +2184,7 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
21842184

21852185
### DeleteKey
21862186

2187-
Delete an [API key](/cloud/rbac/#api-keys).
2187+
Delete an [API key](/operate/control/api-keys/).
21882188

21892189
{{< tabs >}}
21902190
{{% tab name="Python" %}}
@@ -2210,7 +2210,7 @@ For more information, see the [Python SDK Docs](https://python.viam.dev/autoapi/
22102210

22112211
### RotateKey
22122212

2213-
Rotate an [API key](/manage/manage/access/#rotate-an-api-key).
2213+
Rotate an [API key](/operate/control/api-keys/#rotate-an-api-key).
22142214

22152215
{{< tabs >}}
22162216
{{% tab name="Python" %}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Gets the [API keys](/cloud/rbac/#api-keys) for the machine.
1+
Gets the [API keys](/operate/control/api-keys/) for the machine.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Rotate an [API key](/manage/manage/access/#rotate-an-api-key).
1+
Rotate an [API key](/operate/control/api-keys/#rotate-an-api-key).

static/include/program/authenticate.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ To authenticate yourself to your machine, you need
44

55
<!-- we will be releasing the ability to create API keys across all types of resources and combinations soon (i.e an API key can have an authorization on a org, location, machine or any combination of all three). this is correct for now though but it will be changing shortly. -->
66

7-
To authenticate, [use a machine part API key](/cloud/machines/#api-keys) or [an API key](/dev/tools/cli/#authenticate) with access to the machine.
7+
To authenticate, [use a machine part API key](/operate/control/api-keys/) or [an API key](/dev/tools/cli/#authenticate) with access to the machine.
88
Copy and paste the API key ID and the API key into your environment variables or directly into the code:
99

1010
{{< tabs >}}

0 commit comments

Comments
 (0)