Snippets

Snippets

Methods

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

Fetches all snippets 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 Snippets Read

Parameters
zone_id: string

Path param: The unique ID of the zone.

page?: number
(minimum: 1)

Query param: The current page number.

per_page?: number
(minimum: 1)

Query param: The number of results to return per page.

Returns
SnippetListResponse{

A snippet object.

created_on: string
(format: date-time)

The timestamp of when the snippet was created.

snippet_name: string

The identifying name of the snippet.

modified_on?: string
(format: date-time)

The timestamp of when the snippet was last modified.

Request example
200Example
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.

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.