跳转到主要内容

Tags

import { APIRequest } from "~/components";

Use tags to organize, search, and filter user Workers at scale. Tag Workers based on customer ID, plan type, project ID, or environment. After you tag user Workers, you can perform bulk operations like deleting all Workers for a specific customer.

:::note

You can set a maximum of eight tags per script. Avoid special characters like , and & when naming your tag.

:::

Add tags via dashboard

  1. Go to Workers for Platforms in the Cloudflare dashboard and select your namespace.
  2. Select a user Worker from the list.
  3. Go to Settings > Tags.
  4. Add your tags (for example, customer-123, pro-plan, production).
  5. Select Save.

You can also search and filter Workers by tags in the namespace view.

Tags API reference

For complete API documentation, refer to Workers for Platforms API.

Get script tags

Fetch all tags for a Worker script.

Set script tags

Replace all tags on a Worker script. Existing tags not in the request are removed.

Add a single tag

Add one tag to a Worker script without affecting existing tags.

Delete a single tag

Remove one tag from a Worker script.

Filter Workers by tag

List all Workers that match a tag filter. Use tag:yes to include or tag:no to exclude.

<APIRequest method="GET" path="/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts" parameters={{ tags: "production:yes" }} />

Delete Workers by tag

Delete all Workers matching a tag filter. Use this to bulk delete Workers when a customer leaves your platform.

<APIRequest method="DELETE" path="/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts" parameters={{ tags: "customer-123:yes" }} />