diff --git a/src/content/docs/fundamentals/api/how-to/create-via-api.mdx b/src/content/docs/fundamentals/api/how-to/create-via-api.mdx
index 06c1fda17b2428a..b3ea27fb775a722 100644
--- a/src/content/docs/fundamentals/api/how-to/create-via-api.mdx
+++ b/src/content/docs/fundamentals/api/how-to/create-via-api.mdx
@@ -6,7 +6,7 @@ sidebar:
---
-import { Render } from "~/components"
+import { Render, Tabs, TabItem } from "~/components"
Generate new API tokens on the fly via the API. Before you can do this, you must create an API token in the Cloudflare dashboard that can create subsequent tokens.
@@ -24,7 +24,7 @@ Cloudflare also recommends limiting the use of the token via client IP address f
## Creating API tokens with the API
-Once you create an API token that can create other tokens, you can now use it in the API. Refer to the [API schema docs](/api/resources/user/subresources/tokens/methods/create/) for more information.
+You can create a user owned token or account owned token to use with the API. Refer to the [user owned token](/api/resources/user/subresources/tokens/methods/create/) or the [account owned token](/api/resources/accounts/subresources/tokens/methods/create/) API schema docs for more information.
To create a token:
@@ -130,6 +130,93 @@ Each parameter in the `in` and `not_in` objects must be in CIDR notation. For ex
Combine the previous information to create a token as in the following example:
+
+
+```bash
+curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/tokens" \
+--header "Authorization: Bearer " \
+--header "Content-Type: application/json" \
+--data '{
+ "name": "readonly token",
+ "policies": [
+ {
+ "effect": "allow",
+ "resources": {
+ "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*",
+ "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*"
+ },
+ "permission_groups": [
+ {
+ "id": "c8fed203ed3043cba015a93ad1616f1f",
+ "name": "Zone Read"
+ },
+ {
+ "id": "82e64a83756745bbbb1c9c2701bf816b",
+ "name": "DNS Read"
+ }
+ ]
+ }
+ ],
+ "not_before": "2020-04-01T05:20:00Z",
+ "expires_on": "2020-04-10T00:00:00Z",
+ "condition": {
+ "request.ip": {
+ "in": [
+ "199.27.128.0/21",
+ "2400:cb00::/32"
+ ],
+ "not_in": [
+ "199.27.128.1/32"
+ ]
+ }
+ }
+}'
+```
+
+
+```bash
+curl "https://api.cloudflare.com/client/v4/user/tokens" \
+--header "Authorization: Bearer " \
+--header "Content-Type: application/json" \
+--data '{
+ "name": "readonly token",
+ "policies": [
+ {
+ "effect": "allow",
+ "resources": {
+ "com.cloudflare.api.account.zone.eb78d65290b24279ba6f44721b3ea3c4": "*",
+ "com.cloudflare.api.account.zone.22b1de5f1c0e4b3ea97bb1e963b06a43": "*"
+ },
+ "permission_groups": [
+ {
+ "id": "c8fed203ed3043cba015a93ad1616f1f",
+ "name": "Zone Read"
+ },
+ {
+ "id": "82e64a83756745bbbb1c9c2701bf816b",
+ "name": "DNS Read"
+ }
+ ]
+ }
+ ],
+ "not_before": "2020-04-01T05:20:00Z",
+ "expires_on": "2020-04-10T00:00:00Z",
+ "condition": {
+ "request.ip": {
+ "in": [
+ "199.27.128.0/21",
+ "2400:cb00::/32"
+ ],
+ "not_in": [
+ "199.27.128.1/32"
+ ]
+ }
+ }
+}'
+```
+
+
+
```bash
curl "https://api.cloudflare.com/client/v4/user/tokens" \
--header "Authorization: Bearer " \