Skip to content

Commit cae4775

Browse files
authored
Merge pull request #250 from nocodb/docs/authorization-header
docs: Update API token authentication methods in api-tokens.mdx
2 parents 7d589c0 + 7c82521 commit cae4775

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

content/docs/account-settings/api-tokens.mdx

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,62 @@ Follow the steps below to create API Token
1919
3. Enter the name for the API Token
2020
4. Click on `Save` button to save the changes
2121
5. Copy the API Token by clicking on `Copy` button displayed under `Actions` menu
22-
6. Use the API Token in the services that require it to authenticate as `xc-token` in the headers.
22+
6. Use the API Token in the services that require it to authenticate. You can use either the `xc-token` header or the `Authorization` header with bearer token format.
23+
24+
**Option 1: Using xc-token header**
2325
```json
2426
{
2527
"headers": {
2628
"xc-token": "Copied API token here under quotes"
2729
}
2830
}
2931
```
32+
33+
**Option 2: Using Authorization header (since v0.264.7)**
34+
```json
35+
{
36+
"headers": {
37+
"Authorization": "Bearer Copied API token here under quotes"
38+
}
39+
}
40+
```
3041

3142
![Create API Token](/img/v2/account-settings/api-token-1.png)
3243

3344
![Create API Token](/img/v2/account-settings/api-token-2.png)
3445

35-
<Callout type="info">API Token does not expire, but can be deleted anytime</Callout>
46+
<Callout type="info">API Token does not expire, but can be deleted anytime. Both `xc-token` and `Authorization: Bearer` header formats are supported for authentication.</Callout>
3647

3748
API Token created will get added to the list. Copy API token by clicking on `Copy` button displayed under `Actions` menu
3849

3950
![Create API Token](/img/v2/account-settings/api-token-3.png)
4051

52+
## Authentication Methods
53+
54+
NocoDB supports two methods for API token authentication:
55+
56+
### Method 1: xc-token Header
57+
Use the `xc-token` header with your API token value directly:
58+
```json
59+
{
60+
"headers": {
61+
"xc-token": "your_api_token_here"
62+
}
63+
}
64+
```
65+
66+
### Method 2: Authorization Header (since v0.264.7)
67+
Use the standard `Authorization` header with Bearer token format:
68+
```json
69+
{
70+
"headers": {
71+
"Authorization": "Bearer your_api_token_here"
72+
}
73+
}
74+
```
75+
76+
Both methods are equivalent and provide the same level of security. Choose the one that best fits your application's authentication patterns.
77+
4178
## Delete API Token
4279
<Callout type="warn">
4380
Note that, all the services using the API Token will stop working once the API Token is deleted.

0 commit comments

Comments
 (0)