Skip to content

REST API Reference

SnipShare exposes a full REST API for building apps, single-page frontends, and external integrations.

  • Namespace: snipshare/v1
  • Base URL: /wp-json/snipshare/v1/
  • In-browser (same site): WordPress cookie authentication plus the X-WP-Nonce request header.
  • External / mobile clients: WordPress Application Passwords (HTTP Basic auth).

Read endpoints for public data (listing and viewing public pastes, tags, and embeds) are open. Endpoints that create, edit, delete, or moderate require an authenticated user with the appropriate ability; see Permissions & Abilities.

List endpoints accept these query parameters:

Parameter Default Notes
page 1 Page number.
per_page 20 1–100.
orderby created_at One of created_at, updated_at, view_count, star_count, fork_count.
order DESC ASC or DESC.
search Keyword search.
language Filter pastes by a file language.
tag Filter by tag slug.
user Filter by user ID or username.

Paginated responses include X-WP-Total and X-WP-TotalPages headers. Responses also support the standard WordPress _fields and _embed query parameters.

Method Route Purpose
GET /pastes List pastes.
POST /pastes Create a paste.
GET /pastes/{id} Get a single paste.
PUT/PATCH /pastes/{id} Update a paste.
DELETE /pastes/{id} Delete a paste.
POST /pastes/{id}/fork Fork a paste.
POST /pastes/{id}/star Toggle star on a paste.
POST /pastes/{id}/report Report a paste.
POST /pastes/{id}/unlock Unlock a password-protected paste for the session.
GET /pastes/{id}/revisions List a paste’s revisions.
GET /pastes/{id}/diff Diff two versions of a paste.
GET /pastes/{id}/raw Raw content of all files.
GET /pastes/{id}/raw/{file_id} Raw content of a single file.
GET /pastes/{id}/download Download the paste (ZIP for multi-file).
Method Route Purpose
POST /pastes/{paste_id}/files Add a file to a paste.
PUT/PATCH /pastes/{paste_id}/files/{id} Update a file.
DELETE /pastes/{paste_id}/files/{id} Delete a file.
Method Route Purpose
GET /pastes/{paste_id}/revisions List revisions.
GET /pastes/{paste_id}/revisions/{id} Get a single revision.
GET /pastes/{paste_id}/diff Diff between versions.
Method Route Purpose
GET /stars The current user’s starred pastes.
GET /pastes/{paste_id}/starred Whether the current user has starred a paste.

To star or unstar, use POST /pastes/{id}/star (in the Pastes group above).

Method Route Purpose
GET /tags List tags.
GET /tags/{slug}/pastes List pastes for a tag.
Method Route Purpose
GET /collections List collections.
POST /collections Create a collection.
GET /collections/{id} Get a collection.
PUT/PATCH /collections/{id} Update a collection.
DELETE /collections/{id} Delete a collection.
POST /collections/{id}/pastes Add a paste to a collection.
DELETE /collections/{id}/pastes/{paste_id} Remove a paste from a collection.
Method Route Purpose
GET /embed/{hash} Embed metadata for a paste by share hash.

These require the moderate ability.

Method Route Purpose
GET /admin/reports List reports.
PUT/PATCH /admin/reports/{id} Review or dismiss a report.
PUT/PATCH /admin/pastes/{id}/status Change a paste’s status (for example, trash it).
Method Route Purpose
GET /oembed oEmbed 1.0 JSON provider for paste URLs.

See oEmbed.