Skip to content

Documentation

How to connect the Kazmap map: the JS SDK for websites and the HTTP API for everything else.

Quick start: JS SDK

Sign in to the console, add an organization and create a browser key. List the site addresses (origins) it may be used from, for example https://example.kz.

Include the SDK and styles, then create the map:

index.html
<link rel="stylesheet" href="https://platform.kazmap.kz/sdk/v1/kazmap.css">
<script src="https://platform.kazmap.kz/sdk/v1/kazmap.js"></script>

<div id="map" style="height: 420px"></div>
<script>
  const map = kazmap.createMap({
    container: 'map',
    key: 'kzg_live_…',          // браузерный ключ из кабинета
    center: [76.93, 43.26],     // [долгота, широта]
    zoom: 11,
    lang: 'en',          // язык страницы: ru, kk или en
  });
</script>

createMap returns a regular MapLibre GL map (maplibregl.Map) with the Kazmap style, so MapLibre markers, layers and events work on it. Options:

  • container an element or its id
  • key the browser key from the console
  • center center, [longitude, latitude]; Almaty by default
  • zoom zoom; 11 by default
  • lang label language: ru, kk or en
  • apiBase API address, https://kazmap.kz by default; http:// is allowed only for localhost, 127.0.0.1 and *.localhost (development)
  • geolocate geolocation button position, 'top-right' by default; false for no button
  • mapOptions other maplibregl.Map settings (pitch, minZoom…); style, transformRequest and attribution cannot be changed
  • workerUrl path to maplibre-gl-worker.mjs — ESM build only (see below)

An ESM build is available for bundlers; maplibre-gl is a dependency of your project there, and the MapLibre worker goes into your site static files and is passed as workerUrl:

app.js
// npm install maplibre-gl@6
// Из https://platform.kazmap.kz/sdk/v1/ в ваш проект:
//   kazmap.esm.js, kazmap.css — рядом с кодом;
//   maplibre-gl-worker.mjs и maplibre-gl-shared.mjs — в статику сайта, рядом друг с другом (public/kazmap/)
import { createMap } from './kazmap.esm.js';
import './kazmap.css';

const map = createMap({
  container: 'map',
  key: 'kzg_live_…',
  workerUrl: '/kazmap/maplibre-gl-worker.mjs',
});

The attribution "© Kazmap" is always shown and cannot be turned off.

The geolocation button is on by default. The browser shows the permission prompt only after the user presses it.

HTTP API

Pass the key in the X-Api-Key header, or as the key query parameter (for tiles and wherever a header cannot be set):

shell
curl 'https://kazmap.kz/v1/geocode/search?q=Абая+10' \
  -H 'X-Api-Key: kzg_live_…'
url
https://kazmap.kz/v1/styles/…/style.json?key=kzg_live_…

Keep a server key on your backend and never send it to a browser. In the browser use a browser key restricted by origin.

What is counted, and under which product

ProductPaths
Maps maps/v1/tiles/basemap/*, /v1/styles/*, /fonts/*, /sprites/*, /v1/tiles/relief*
Geocoder geocode/v1/geocode/search, /autocomplete, /reverse, /lookup
Place search search/v1/places*, /v1/categories
Routing routing/v1/route

The full description of methods and schemas is in the OpenAPI specification.

Errors

Errors come as Problem Details (RFC 9457) with code and trace_id fields. Include the trace_id when you contact support.

StatusCodeMeaning
401api_key_missing, api_key_invalid, api_key_expiredThe key is missing, invalid or revoked.
403origin_not_allowedThe site address is not in the browser key origin list.
403insufficient_scopeThe key has no permission for this method.
429quota_exceededThe monthly limit of the product is used up. Retry-After is the number of seconds until the next month starts.
429rate_limitedToo many requests. Wait Retry-After seconds and try again.
503authz_unavailableKey verification is temporarily unavailable. Retry after Retry-After seconds.

Quotas and rate limits

The monthly quota applies to the organization, is shared by all its keys, and is counted per product: Maps, Geocoder, Place search, Routing. Daily usage and the month against the limit are in the console, "Usage". Test keys (kzg_test_…) get up to 1,000 requests per day per product and are never billed.

When the limit is used up, what happens depends on the plan: either 429 quota_exceeded until the month starts, or requests go through and are counted over the limit for an extra charge. The console warns you at 80% and 100% of the limit.

On top of the quota there is a request rate limit. Responses carry RateLimit-Policy and RateLimit headers (IETF draft httpapi-ratelimit-headers): how many requests remain in the window and when it ends. 429 and 503 carry Retry-After. Retry with a pause and random jitter, and no faster than allowed.

HTTP
RateLimit-Policy: "default";q=10;w=1     # q — запросов в секунду на ключ
RateLimit: "default";r=7;t=1               # r — осталось, t — секунд до полного ведра
Retry-After: 2                             # только при 429 и 503

Location data

By connecting the Kazmap map you agree to pass us anonymous location and movement data from your users. Below is exactly what we collect and how we handle it. The legal terms are in the offer.

What we collect

  • Points: time, latitude and longitude, accuracy, speed and heading when the device provides them.
  • A random device identifier. It lives in the browser and changes once a day. We never store it raw.
  • We do not collect or store: IP address, User-Agent, name, email, phone or any other sign of identity.

Why

  • To fix and complete the map: roads, turns, restrictions.
  • At the second stage, to estimate road conditions (traffic) from the speed of the flow.

Only with the user’s consent

The SDK never requests geolocation permission by itself and never works around it. Collection starts when the user presses the geolocation button on the map and allows access in the browser, or when permission was already granted to your site.

You tell your users about this transfer in your privacy policy and do not switch collection off. The offer with this condition must be accepted before the first key is issued.

Anonymization

The device identifier is immediately replaced with an HMAC-SHA256 of the pair "organization + device" with a daily salt. The salt is kept secret and in memory, never in the database, and changes every day: one device cannot be linked across days.

We drop inaccurate points (worse than 100 m), points from the future or older than a day, points far outside Kazakhstan (a rough box around the country, so border areas of neighbouring countries fall inside), and impossible speed jumps (over 250 km/h).

Retention and location

Raw points are kept for 7 days and then deleted automatically. Storage is on servers in Kazakhstan. Access is limited to a dedicated service role and the superadministrator.

For server and mobile integrations

Points can be sent directly: POST /v1/telemetry/probes with a key that has the telemetry:write permission. Up to 500 points and 256 KB per request; the answer is 202 with the accepted and rejected counts. These requests do not count against the quota.

Intake limits. A day is counted in Astana time (UTC+5). Your organization has a daily point limit set by its plan (see the Plan section); a test key has 20,000 per day. There are also shared limits for the whole service. Exceeding a limit is not an error: the answer stays 202, and the points over the limit are dropped and counted in rejected.

If points were not accepted because of a limit, the response has a reason field: daily_limit (the limit of your organization), pool_limit or global_limit (shared service limits), storage_guard (temporary storage protection). Remaining allowance and timing are in the headers X-Kzgeo-Probes-Limit (limit), X-Kzgeo-Probes-Remaining (left) and X-Kzgeo-Probes-Reset (seconds until the end of the day). 429 is returned only for requests that are too frequent.

shell
curl -X POST 'https://kazmap.kz/v1/telemetry/probes' \
  -H 'X-Api-Key: kzg_live_…' -H 'Content-Type: application/json' \
  -d '{"device_id":"7f1c…","source":"server","points":[
        {"t":"2026-11-18T10:00:00Z","lat":43.25,"lon":76.93,"acc":12,"speed":38}]}'

Offer