Public API

Fetch John Snow Code snippets via REST API. Read only, no API key, and open CORS.

BASE URL
https://johnsnow-snippet.vercel.app
GET/api/v1/snippets

Snippet List

Fetch the latest snippets. Filter by search, category, language, tag, limit up to 50, and offset.

curl "https://johnsnow-snippet.vercel.app/api/v1/snippets?limit=10&language=javascript"
GET/api/v1/snippets/:slug

Snippet Detail

Fetch a single snippet complete with its code content.

curl "https://johnsnow-snippet.vercel.app/api/v1/snippets/example-slug"
GET/api/v1/snippets/:slug/raw

Raw Code

Code content as plain text. Add download=1 to download it directly as a file.

curl "https://johnsnow-snippet.vercel.app/api/v1/snippets/example-slug/raw?download=1" -o snippet.js
PAGE/embed/:slug

Embed Widget

Display the snippet on a blog or website via iframe. The Embed button is also available on the code detail page.

<iframe src="https://johnsnow-snippet.vercel.app/embed/example-slug" width="100%" height="420" style="border:0" loading="lazy"></iframe>