Snippets

snippets

Methods

List Zone Snippets -> V4PagePaginationArray<{ created_on, snippet_name, modified_on }>
get/zones/{zone_id}/snippets

Fetches all snippets belonging to the zone.

Get A Zone Snippet -> Envelope<{ created_on, snippet_name, modified_on }>
get/zones/{zone_id}/snippets/{snippet_name}

Fetches a snippet belonging to the zone.

Update A Zone Snippet -> Envelope<{ created_on, snippet_name, modified_on }>
put/zones/{zone_id}/snippets/{snippet_name}

Creates or updates a snippet belonging to the zone.

Delete A Zone Snippet -> Envelope<unknown>
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

path Parameters
zone_id: string

Use this field to specify the unique ID of the zone.

snippet_name: string

Identify the snippet.

Response fields
errors: Array<{ message, code }>

Lists error messages.

messages: Array<{ message, code }>

Contain warning messages.

result: unknown
Nullable

Contain the response result.

success: true

Indicate whether the API call was successful.

Request example
200Example
Snippets

Content

snippets.content

Methods

Get A Zone Snippet Content -> unknown
get/zones/{zone_id}/snippets/{snippet_name}/content

Fetches the content of a snippet belonging to the zone.

snippets.rules

Methods

List Zone Snippet Rules -> Envelope<unknown>
get/zones/{zone_id}/snippets/snippet_rules

Fetches all snippet rules belonging to the zone.

Update Zone Snippet Rules -> Envelope<unknown>
put/zones/{zone_id}/snippets/snippet_rules

Updates all snippet rules belonging to the zone.

Delete Zone Snippet Rules -> Envelope<unknown>
delete/zones/{zone_id}/snippets/snippet_rules

Deletes all snippet rules belonging to the zone.