JavaScript
Fetch entries from genko.me with the SDK in Node.js or plain fetch, and decide when a delivery API key can be used in the browser.
The genko.me delivery API uses HTTP GET and JSON. You can fetch entries from Node.js or a browser without an additional runtime.
If you use a framework, start with its guide: Next.js, Nuxt, SvelteKit, or Astro. This guide covers framework-independent JavaScript.
What to use
| Method | Where it works | Details |
|---|---|---|
@genko-me/sdk | Node.js, browsers, and Edge runtimes | The official JavaScript SDK. It has no runtime dependencies and uses only the global fetch and URL APIs |
Plain fetch | The same environments | No installation. You build URLs and handle errors yourself |
The SDK is not specific to Next.js. You can use @genko-me/sdk in build scripts, Express, Hono, Cloudflare Workers, and browsers. Next.js features live in a separate entry point, @genko-me/sdk/next.
Plain fetch is enough if you do not need generated types or another dependency. You will write the query parameters, convert 404 responses to null, and handle pagination when fetching all entries yourself.
Can you put an API key in the browser?
Anyone who opens the page can read a delivery API key sent to the browser. It is visible in developer tools whether you embed it in a JavaScript bundle or send it in a fetch header. Decide with that constraint in mind.
Only use a key in the browser when all of these are true:
- Everything the key can read is already public.
- The key is scoped to “Selected APIs only.”
- If someone else uses the key, the only material impact is consuming the 300 requests per minute rate limit.
Make the request on the server if any of these apply:
- The same key can read an unpublished API or another API.
- You need to preview a saved draft with
draftKey. - You need to reserve the rate limit for your own site.
Server-side requests can run in a Node.js API route, a Cloudflare Worker, or a static build. Send only the fetched JSON to the browser.
Good fit
- Fetch entries in a Node.js build script and generate HTML or JSON.
- Read entries in an existing Express, Fastify, or Hono server and pass them to a template.
- Add a small announcements widget to an existing page.
- Receive webhooks to clear a cache or trigger a rebuild.
Limitations
- Creating or updating entries. The delivery API is read-only. Create and publish entries in the dashboard.
- Showing a list of drafts. A
draftKeycan fetch one entry; there is no draft-list endpoint. - Serving private content to individual members. Anyone with the API key can read the same published content. Your app must control access.
- Full-text search.
qperforms a case-insensitive substring match. It has no relevance ranking or linguistic analysis.
Next steps
- Get started: configure an API key and show a list and a single entry with either the SDK or
fetch - Tutorial: pagination, previewing drafts, and webhook signature verification
- Delivery API: endpoint and response specifications
Last updated: October 6, 2026