Snippets

Snippets

Methods

list(, ): <>
get/zones/{zone_id}/snippets

Fetches all snippets belonging to the zone.

get(, , ):
get/zones/{zone_id}/snippets/{snippet_name}

Fetches a snippet belonging to the zone.

update(, , ):
put/zones/{zone_id}/snippets/{snippet_name}

Creates or updates a snippet belonging to the zone.

delete(, , ): | null
delete/zones/{zone_id}/snippets/{snippet_name}

Deletes a snippet belonging to the zone.

Security

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example: Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY

Accepted Permissions (at least one required)

Snippets Write

Parameters
snippetName: string

The identifying name of the snippet.

zone_id: string

The unique ID of the zone.

Returns
SnippetDeleteResponse = string | null

A result.

Request example
200Example
Snippets

Content

Snippets.Content

Methods

get(, , ):
get/zones/{zone_id}/snippets/{snippet_name}/content

Fetches the content of a snippet belonging to the zone.

Snippets.Rules

Methods

list(, ): <>
get/zones/{zone_id}/snippets/snippet_rules

Fetches all snippet rules belonging to the zone.

update(, ): <>
put/zones/{zone_id}/snippets/snippet_rules

Updates all snippet rules belonging to the zone.

delete(, ): <>
delete/zones/{zone_id}/snippets/snippet_rules

Deletes all snippet rules belonging to the zone.