Skip to content

Commit ef8191c

Browse files
Update API tokens and client keys pages (#9143)
1 parent e5e7e2f commit ef8191c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+171
-365
lines changed

frontend/src/component/integrations/IntegrationList/AvailableIntegrations/AvailableIntegrations.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const AvailableIntegrations: VFC<IAvailableIntegrationsProps> = ({
163163
need a client SDK (software developer kit) for your
164164
programming language and an{' '}
165165
<a
166-
href='https://docs.getunleash.io/how-to/how-to-create-api-tokens'
166+
href='https://docs.getunleash.io/reference/api-tokens-and-client-keys'
167167
target='_blank'
168168
rel='noopener noreferrer'
169169
>

src/lib/openapi/spec/create-pat-schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { FromSchema } from 'json-schema-to-ts';
33
export const createPatSchema = {
44
$id: '#/components/schemas/createPatSchema',
55
description:
6-
'Describes the properties required to create a [personal access token](https://docs.getunleash.io/how-to/how-to-create-personal-access-tokens), or PAT. PATs are automatically scoped to the authenticated user.',
6+
'Describes the properties required to create a [personal access token](https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens), or PAT. PATs are automatically scoped to the authenticated user.',
77
type: 'object',
88
required: ['description', 'expiresAt'],
99
properties: {

src/lib/openapi/spec/pat-schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const patSchema = {
55
$id: '#/components/schemas/patSchema',
66
type: 'object',
77
description:
8-
'Describes a [personal access token](https://docs.getunleash.io/how-to/how-to-create-personal-access-tokens), or PAT. PATs are automatically scoped to the authenticated user.',
8+
'Describes a [personal access token](https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens), or PAT. PATs are automatically scoped to the authenticated user.',
99
required: ['id', 'createdAt', ...createPatSchema.required],
1010
properties: {
1111
id: {

src/lib/openapi/spec/pats-schema.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const patsSchema = {
55
$id: '#/components/schemas/patsSchema',
66
type: 'object',
77
description:
8-
'Contains a collection of [personal access tokens](https://docs.getunleash.io/how-to/how-to-create-personal-access-tokens), or PATs. PATs are automatically scoped to the authenticated user.',
8+
'Contains a collection of [personal access tokens](https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens), or PATs. PATs are automatically scoped to the authenticated user.',
99
properties: {
1010
pats: {
1111
type: 'array',

src/lib/routes/admin-api/project/api-token.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export class ProjectApiTokenController extends Controller {
9191
operationId: 'getProjectApiTokens',
9292
summary: 'Get api tokens for project.',
9393
description:
94-
'Returns the [project API tokens](https://docs.getunleash.io/how-to/how-to-create-project-api-tokens) that have been created for this project.',
94+
'Returns the project-specific [API tokens](https://docs.getunleash.io/reference/api-tokens) that have been created for this project.',
9595
responses: {
9696
200: createResponseSchema('apiTokensSchema'),
9797
...getStandardResponses(401, 403, 404),

src/lib/routes/admin-api/user/pat.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default class PatController extends Controller {
6262
summary:
6363
'Get all personal access tokens (PATs) for the current user.',
6464
description:
65-
'Returns all of the [personal access tokens](https://docs.getunleash.io/how-to/how-to-create-personal-access-tokens) (PATs) belonging to the current user.',
65+
'Returns all of the [personal access tokens](https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens) (PATs) belonging to the current user.',
6666
responses: {
6767
200: createResponseSchema(patsSchema.$id),
6868
...getStandardResponses(401, 403, 404),
@@ -82,7 +82,7 @@ export default class PatController extends Controller {
8282
summary:
8383
'Create a new personal access token (PAT) for the current user.',
8484
description:
85-
'Creates a new [personal access token](https://docs.getunleash.io/how-to/how-to-create-personal-access-tokens) (PAT) belonging to the current user.',
85+
'Creates a new [personal access token](https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens (PAT) belonging to the current user.',
8686
requestBody: createRequestSchema(createPatSchema.$id),
8787
responses: {
8888
201: resourceCreatedResponseSchema(patSchema.$id),
@@ -105,7 +105,7 @@ export default class PatController extends Controller {
105105
summary:
106106
'Delete a personal access token (PAT) for the current user.',
107107
description:
108-
'Deletes a [personal access token](https://docs.getunleash.io/how-to/how-to-create-personal-access-tokens) (PAT) belonging to the current user.',
108+
'Deletes a [personal access token](https://docs.getunleash.io/reference/api-tokens-and-client-keys#personal-access-tokens) (PAT) belonging to the current user.',
109109
parameters: [
110110
{
111111
name: 'id',

website/docs/feature-flag-tutorials/serverless/implementing-feature-flags-in-aws-lambda.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ You should only initialize the Unleash SDK once during the lifespan of a serverl
3131

3232
Why? AWS Lambda is designed to reuse the same instance for multiple invocations, enabling the expensive initialization process to occur only during the Lambda's "cold start." Subsequent "warm" invocations can then leverage the SDK, which has been pre-initialized, with all feature flag configurations cached in memory. This ensures efficient operation by minimizing initialization overhead and enhancing performance.
3333

34-
You’ll also need to provide an [Unleash Server side API Token](/how-to/how-to-create-api-tokens) as an environment variable for the AWS Lambda. This authorizes the SDK to connect to the Unleash API.
34+
You’ll also need to provide an [Unleash Server side API Token](/reference/api-tokens-and-client-keys) as an environment variable for the AWS Lambda. This authorizes the SDK to connect to the Unleash API.
3535

3636
```javascript
3737
import {

website/docs/how-to/how-to-create-api-tokens.mdx

+4-31
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,9 @@
22
title: How to create API Tokens
33
---
44

5-
import newTokenImage from '/img/admin_create_token_form.png';
5+
Depending on your [permissions](../reference/api-tokens-and-client-keys#api-token-permissions), you can create API tokens in the Unleash Admin UI in three ways:
6+
- **Admin > API access**: for client or frontend tokens; requires the Admin root role, or a custom root role with API token permissions.
7+
- **Settings > API access** inside a project: for project-specific client or frontend tokens; permitted for project Members or users with a [corresponding root role](../reference/api-tokens-and-client-keys#api-token-permissions).
8+
- **Profile > View profile settings > Personal API tokens**: for personal access tokens.
69

7-
:::info Permissions
810

9-
Creating API tokens requires you to have the `CREATE_API_TOKEN` permission. This means that, as of now, **only instance admins can create API tokens.**
10-
11-
All users can see tokens with `CLIENT` level access, but only instance admins can see tokens with `ADMIN` level access.
12-
13-
:::
14-
15-
Unleash SDKs use API tokens to authenticate to the Unleash API. Unleash supports different types of API tokens, each with different levels of access and privileges. Refer to the [API tokens and client keys documentation](../reference/api-tokens-and-client-keys.mdx) for a complete overview of the different token types.
16-
17-
## Step 1: Navigate to the API token creation form {#step-1}
18-
19-
Navigate to the _API access_ page in the admin UI (available at the URL `/admin/api`). Use the navigation menu item "Configure" and select "API access".
20-
21-
![The admin UI navigation "Configure" submenu with the API access item highlighted.](/img/admin_configure_api.png)
22-
23-
On the API access page, use the "New API token" button to navigate to the token creation form.
24-
25-
![The API access page with the "New API token" button highlighted.](/img/admin_new_api_key_button.png)
26-
27-
## Step 2: Fill in the API token form {#step-2}
28-
29-
![API token creation form. ](/img/admin_create_token_form.png)
30-
31-
Fill in the form with the desired values for the token you want to create. Refer to the [API tokens and client keys](../reference/api-tokens-and-client-keys.mdx#token-data) article for a detailed explanation of what all the fields mean.
32-
33-
## Using API tokens
34-
35-
When you have created the API token, it will be listed on the API access page. If you have the required permissions to see the token, you can copy it for easy use in your applications.
36-
37-
![API access token table with a "copy token" button highlighted.](/img/admin_copy_token.png)

website/docs/how-to/how-to-create-personal-access-tokens.mdx

-41
This file was deleted.

website/docs/how-to/how-to-create-project-api-tokens.mdx

-33
This file was deleted.

website/docs/how-to/how-to-create-service-accounts.mdx

-45
This file was deleted.

website/docs/how-to/how-to-use-the-admin-api.md

+10-12
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,34 @@
22
title: How to use the Admin API
33
---
44

5-
This guide explains the steps required to getting access to and using the Admin API.
5+
This guide explains the steps required to using the Admin API.
66

7-
## Step 1: Create API token {#step-1-create-api-token}
7+
## Create API token
88

9-
You'll need either an [admin token](../reference/api-tokens-and-client-keys.mdx#admin-tokens) or a [personal access token](../reference/api-tokens-and-client-keys.mdx#personal-access-tokens) for this to work. To create one, follow the steps in the [_how to create API tokens_](../how-to/how-to-create-api-tokens.mdx) guide or the [_how to create personal access tokens_](./how-to-create-personal-access-tokens.mdx) guide, respectively.
9+
First, you'll need to create a [personal access token](/reference/api-tokens-and-client-keys.mdx#personal-access-tokens).
1010

1111
Please note that it may take up to 60 seconds for the new key to propagate to all Unleash instances due to eager caching.
1212

1313
:::note
1414

15-
If you need an API token to use in a client SDK you should create a "client token" as these have fewer access rights.
15+
If you need an API token to use in a client SDK you should create a client token instead, as these have fewer access rights.
1616

1717
:::
1818

19-
## Step 2: Use Admin API {#step-2-use-admin-api}
19+
## Use Admin API
2020

21-
Now that you have an access token with admin privileges we can use that to perform changes in our Unleash instance.
21+
Now that you have an access token with admin privileges, you can use it to make changes in your Unleash instance.
2222

23-
In the example below we will use the [Unleash Admin API](/reference/api/legacy/unleash/admin/features.md) to enable the “Demo” feature flag using curl.
23+
In the example below we will use the [Unleash Admin API](/reference/api/legacy/unleash/admin/features.md) to enable the `checkout-flow` feature flag in `development` using curl.
2424

2525
```sh
2626
curl -X POST -H "Content-Type: application/json" \
27-
-H "Authorization: some-token" \
28-
https://app.unleash-hosted.com/demo/api/admin/features/Demo/toggle/on
27+
-H "Authorization: <your-token>" \
28+
https://app.unleash-hosted.com/docs-demo/api/admin/projects/docs-project/features/checkout-flow/environments/development/on
2929
```
3030

31-
**Great success!** We have now enabled the feature flag. We can also verify that it was actually changed by the API user by navigating to [Event Log](/reference/events#event-log) and filtering events for this feature flag.
31+
We have now enabled the feature flag. We can also verify that it was actually changed by the API user by navigating to [Event Log](/reference/events#event-log) and filtering events for this feature flag.
3232

3333
![Feature flag events showing that it was last updated by "admin-api".](/img/api_access_history.png)
3434

35-
## API overview {#api-overview}
36-
3735
You can find the full documentation on everything the Unleash API supports in the [Unleash API documentation](/reference/api/legacy/unleash/admin/features.md).

0 commit comments

Comments
 (0)