OpenAPI JSON

API resource

Code Snippets

Code Snippets are saved body-only PHP scripts for WordPress sites in your account. Use Code Snippets to save reusable PHP source, list or inspect saved snippets, remove snippets, and start background execution tasks across accessible sites.

12 operations · Each operation has a stable reference URL.

GET

List Code Snippets

Returns active Code Snippets in the authenticated account without their PHP source.

/code-snippets
POST

Create a Code Snippet

Creates a saved Code Snippet from body-only PHP source.

/code-snippets
POST

Validate PHP source

Parses body-only PHP through the dedicated Dragoman validation boundary without executing

/code-snippets/validate
GET

List Code Snippet executions

Returns retained Code Snippet execution tasks visible to the authenticated account. Each

/code-snippets/executions
GET

Show a Code Snippet

Returns one active Code Snippet, including its decrypted current PHP source.

/code-snippets/{code_snippet_id}
DELETE

Delete a Code Snippet

Soft deletes one active Code Snippet. Deleted Code Snippets are no longer available through this API.

/code-snippets/{code_snippet_id}
POST

Update a Code Snippet

Applies a partial update to one active Code Snippet. A changed `code` value creates the next

/code-snippets/{code_snippet_id}/update
POST

Validate source for a saved Code Snippet

Applies the same stateless Dragoman parse-only validation as the collection route after

/code-snippets/{code_snippet_id}/validate
POST

Execute a Code Snippet

Accepts a background task that executes the Code Snippet's current source on accessible sites.

/code-snippets/{code_snippet_id}/execute
GET

List Code Snippet versions

Returns every retained immutable version newest first, without PHP source.

/code-snippets/{code_snippet_id}/versions
GET

Show a Code Snippet version

Returns one retained immutable version including its decrypted PHP source.

/code-snippets/{code_snippet_id}/versions/{number}
POST

Restore a Code Snippet version

Copies the selected historical PHP source into a new current version while retaining the

/code-snippets/{code_snippet_id}/versions/{number}/restore