|
| 1 | +--- |
| 2 | +title: Get started |
| 3 | +pcx_content_type: get-started |
| 4 | +sidebar: |
| 5 | + order: 2 |
| 6 | +description: Enable Resource Tagging for a customer account and make your first API calls. |
| 7 | +--- |
| 8 | + |
| 9 | +This guide walks you through enabling tagging for an Enterprise account and verifying it works. |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +Before enabling Resource Tagging, ensure the account meets these requirements: |
| 14 | + |
| 15 | +- **Enterprise plan** -- Resource Tagging is only available to Enterprise customers. |
| 16 | +- **Super Admin access** -- At least one user with the Super Administrator, Workers Admin, or Tag Admin role. These roles can create, update, and delete tags. |
| 17 | +- **API familiarity** -- The feature is API-only during the private beta. Customers must be comfortable making authenticated HTTP requests. |
| 18 | + |
| 19 | +## 1. Request enablement |
| 20 | + |
| 21 | +Contact PM Wesley Evans to request tagging enablement for a customer account: |
| 22 | + |
| 23 | +- **G-Chat**: Join the "Tags for Cloudflare" space for real-time support |
| 24 | +- **Email**: wesley.evans@cloudflare.com |
| 25 | + |
| 26 | +Provide the following: |
| 27 | + |
| 28 | +- **Account ID** -- The customer's Cloudflare account ID, found in the Dashboard URL or via `GET /accounts`. |
| 29 | +- **Use case** -- A brief description of how the customer plans to use tagging (1-2 sentences). |
| 30 | +- **Products to be tagged** -- Which resource types the customer plans to tag initially (for example, `workers_script`, `zone`, `custom_hostnames`). |
| 31 | + |
| 32 | +Wesley will enable the feature via [gates.cloudflare.com](https://gates.cloudflare.com). Typical turnaround is 1-2 business days. |
| 33 | + |
| 34 | +## 2. Verify tagging is enabled |
| 35 | + |
| 36 | +After receiving enablement confirmation, test the API: |
| 37 | + |
| 38 | +```bash |
| 39 | +curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/keys" \ |
| 40 | + -H "Authorization: Bearer $API_TOKEN" \ |
| 41 | + -H "Content-Type: application/json" |
| 42 | +``` |
| 43 | + |
| 44 | +### Interpreting the response |
| 45 | + |
| 46 | +| Response | Meaning | Action | |
| 47 | +| --- | --- | --- | |
| 48 | +| **200 OK** with `{"success": true, "result": [...]}` | Tagging is enabled. An empty array is normal if no tags exist yet. | Proceed with onboarding. | |
| 49 | +| **403** mentioning "permission" or "role" | The caller lacks required permissions. This is not a gating issue. | Verify the caller has Super Admin role or the token has `#com.cloudflare.api.account.tag.list` scope. | |
| 50 | +| **403** mentioning "feature" or "gate" | Tagging is not enabled for this account. | Confirm the Account ID matches what was provided to Wesley. Contact the Tags for Cloudflare G-Chat space. | |
| 51 | +| **401 Unauthorized** | Authentication failed. | Verify the token is valid, not expired, and formatted correctly in the `Authorization: Bearer` header. | |
| 52 | +| Any other response | Unexpected error. | Capture the full response body and escalate to the Tags for Cloudflare G-Chat space with the Account ID, request details, and timestamp. | |
| 53 | + |
| 54 | +:::note |
| 55 | +Gate changes typically propagate within seconds, but may take up to 15 minutes in rare cases. If you receive a gating error immediately after enablement, wait briefly and retry. |
| 56 | +::: |
| 57 | + |
| 58 | +## 3. Create your first tags |
| 59 | + |
| 60 | +Set tags on a resource using `PUT`: |
| 61 | + |
| 62 | +```bash |
| 63 | +curl -X PUT "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags" \ |
| 64 | + -H "Authorization: Bearer $API_TOKEN" \ |
| 65 | + -H "Content-Type: application/json" \ |
| 66 | + -d '{ |
| 67 | + "resource_type": "workers_script", |
| 68 | + "resource_id": "'"$RESOURCE_ID"'", |
| 69 | + "tags": { |
| 70 | + "environment": "production", |
| 71 | + "team": "platform" |
| 72 | + } |
| 73 | + }' |
| 74 | +``` |
| 75 | + |
| 76 | +Then retrieve the tags: |
| 77 | + |
| 78 | +```bash |
| 79 | +curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags?resource_type=workers_script&resource_id=$RESOURCE_ID" \ |
| 80 | + -H "Authorization: Bearer $API_TOKEN" \ |
| 81 | + -H "Content-Type: application/json" |
| 82 | +``` |
| 83 | + |
| 84 | +## 4. List tagged resources |
| 85 | + |
| 86 | +Query all tagged resources in the account, optionally filtering by tag: |
| 87 | + |
| 88 | +```bash |
| 89 | +# All tagged resources |
| 90 | +curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources" \ |
| 91 | + -H "Authorization: Bearer $API_TOKEN" |
| 92 | + |
| 93 | +# Filter: only resources with environment=production |
| 94 | +curl -X GET "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/tags/resources?tag=environment=production" \ |
| 95 | + -H "Authorization: Bearer $API_TOKEN" |
| 96 | +``` |
| 97 | + |
| 98 | +## Next steps |
| 99 | + |
| 100 | +- Learn the full [tag filtering syntax](/resource-tagging/how-to/filter-resources/) for complex queries. |
| 101 | +- Understand the [GET, merge, PUT workflow](/resource-tagging/how-to/manage-tags/#add-a-single-tag) for modifying individual tags. |
| 102 | +- Review [supported resource types](/resource-tagging/reference/resource-types/) and their required fields. |
| 103 | +- Review [API limits and validation rules](/resource-tagging/reference/limits/). |
0 commit comments