GZW DataAPI & SDK examples
Copy, adapt, ship

One API.
Pick your client.

Every example uses the public, read-only v1 API. Choose plain HTTP for any language, or the official TypeScript client for typed helpers.

Versioned base URL
https://gzw-data.dev/api/v1
AuthenticationNoneNo key or account required.
ResponseJSONRead-only GET routes.
Rate limitBest-effortCache and respect Retry-After.
01 · Any language

REST requests with cURL

Use the versioned endpoint directly. The API discovers published datasets automatically; check the live route catalog for the current list.

List a page

curl -sS "https://gzw-data.dev/api/v1/weapons?page=1&per_page=5"

REST uses per_page; the SDK uses the equivalent camelCase option perPage.

Fetch one record by ID

curl -sS https://gzw-data.dev/api/v1/weapons/ak-12

Search and inspect metadata

curl -sS "https://gzw-data.dev/api/v1/search?q=AK&dataset=weapons&limit=5" curl -sS "https://gzw-data.dev/api/v1/metadata?full=true"

Search and metadata parameters are documented in the query guide and metadata reference.

02 · JavaScript / TypeScript

Use the SDK for typed helpers

Install @zoniboy/gzw-data-client in Node.js 18+ or a modern browser app. It has no runtime dependencies and needs no API key.

npm install @zoniboy/gzw-data-client
import { GzwDataClient } from "@zoniboy/gzw-data-client"; const gzw = new GzwDataClient(); const page = await gzw.dataset("weapons").list({ page: 1, perPage: 5 }); console.log(page.data); console.log(page.total);

Runnable, type-checked quick-start source ↗ · Full SDK guide →

03 · Newly added data

Build a live dataset picker

Read names from the API registry at runtime. New datasets and fields are available without updating the npm package; compile-time autocomplete remains a local snapshot.

const registry = await gzw.metadata(); const datasetNames = registry.datasets.map(({ name }) => name); const selectedName: string = datasetNames[0] ?? "weapons"; const resource = gzw.dataset(selectedName); const info = await resource.info(); const firstPage = await resource.list({ page: 1, perPage: 20 });

Unknown record fields use the generic GzwRecord fallback. See the autocomplete explanation and runnable discovery example ↗.

04 · No SDK required

Fetch from a browser app

For a small prototype or a non-JavaScript SDK, the REST endpoint can be called with standard fetch. Check response.ok before treating the body as a successful result.

const params = new URLSearchParams({ page: "1", per_page: "5" }); const response = await fetch( `https://gzw-data.dev/api/v1/weapons?${params}`, { headers: { Accept: "application/json" } }, ); if (!response.ok) throw new Error(`GZW Data API: HTTP ${response.status}`); const payload = await response.json(); console.log(payload.data);
05 · Python

Use query parameters safely

Pass query values separately instead of building an encoded URL by hand.

import requests response = requests.get( "https://gzw-data.dev/api/v1/search", params={"q": "AK", "dataset": "weapons", "limit": 5}, timeout=10, ) response.raise_for_status() print(response.json()["data"])

For exact parameter names, response shapes, errors, caching and rate limits, use the API reference.

Next steps

Keep exploring

☕ Support GZW Data