Skip to main content

zone_tags

Creates, updates, deletes, gets or lists a zone_tags resource.

Overview

Namezone_tags
TypeResource
Idcloudflare.resource_tagging.zone_tags

Fields

The following fields are returned by SELECT queries:

Get tags for single resource response.

NameDatatypeDescription
idstringIdentifies the unique resource. (example: 023e105f4ecef8ad9ca31a8372d0c353)
namestringHuman-readable name of the resource. (example: my-worker-script)
access_application_idstring (uuid)Access application ID is required only for access_application_policy resources (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415)
worker_idstringWorker ID is required only for worker_version resources (example: 3f72a691-44b3-4c11-8642-c18a88ddaa5e)
zone_idstringZone ID is required only for zone-level resources (example: 023e105f4ecef8ad9ca31a8372d0c353)
etagstringETag identifier for optimistic concurrency control. Formatted as "v1:<hash>" where the hash is the base64url-encoded SHA-256 (truncated to 128 bits) of the tags map canonicalized using RFC 8785 (JSON Canonicalization Scheme). Clients should treat ETags as opaque strings and pass them back via the If-Match header on write operations. (example: v1:RBNvo1WzZ4oRRq0W9-hkng)
tagsobjectContains key-value pairs of tags.
typestring (access_application)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectzone_idresource_id, resource_type, access_application_idRetrieves tags for a specific zone-level resource.
updatereplacezone_id, resource_id, resource_typeIf-MatchCreates or updates tags for a specific zone-level resource. Replaces all existing tags for the resource.
deletedeletezone_idIf-MatchRemoves all tags from a specific zone-level resource.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
zone_idstringThe Cloudflare zone ID.
If-MatchstringETag value for optimistic concurrency control. When provided, the server will verify the current resource ETag matches before applying the write. Returns 412 Precondition Failed if the resource has been modified since the ETag was obtained. Omit this header for unconditional writes.
access_application_idstring (uuid)Access application ID identifier. Required for access_application_policy resources.
resource_idstringThe ID of the resource to retrieve tags for.
resource_typestringThe type of the resource.

SELECT examples

Retrieves tags for a specific zone-level resource.

SELECT
id,
name,
access_application_id,
worker_id,
zone_id,
etag,
tags,
type
FROM cloudflare.resource_tagging.zone_tags
WHERE zone_id = '{{ zone_id }}' -- required
AND resource_id = '{{ resource_id }}'
AND resource_type = '{{ resource_type }}'
AND access_application_id = '{{ access_application_id }}'
;

REPLACE examples

Creates or updates tags for a specific zone-level resource. Replaces all existing tags for the resource.

REPLACE cloudflare.resource_tagging.zone_tags
SET
resource_id = '{{ resource_id }}',
resource_type = '{{ resource_type }}',
tags = '{{ tags }}',
access_application_id = '{{ access_application_id }}'
WHERE
zone_id = '{{ zone_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND resource_type = '{{ resource_type }}' --required
AND If-Match = '{{ If-Match}}'
RETURNING
errors,
messages,
result,
success;

DELETE examples

Removes all tags from a specific zone-level resource.

DELETE FROM cloudflare.resource_tagging.zone_tags
WHERE zone_id = '{{ zone_id }}' --required
AND If-Match = '{{ If-Match }}'
;