GeoCzech logo GeoCzech Docs

GeoCzech API

Authentication

Every request is identified by your API key. Keep it secret, restrict it, rotate it.

API keys

An API key is a long secret string that starts with gcz_live_. It tells the API who is calling — which account the credits come from and which limits apply.

Create and manage keys in the Console under Developers → API keys. You can have several keys (for example one per application or server) — the number depends on your plan.

Treat the key like a password

Anyone who has your key can use your credits. Do not put it into public code repositories, shared documents or web pages. If a key leaks, revoke or rotate it in the Console right away.

Map keys (gcz_map_…) are a second kind of key, made for MapServer URLs in QGIS and web maps. They are public, work only for MapServer and are rejected everywhere else — and API keys are never accepted by MapServer.

Sending the key

Send the key in the X-API-Key HTTP header with every request — this is what all examples in this documentation do.

Alternatives, when your tool cannot set headers:

Where How Works for
Header (recommended) X-API-Key: gcz_live_… all endpoints
Form field api_key=gcz_live_… in the multipart form POST /v2/tool/…
Query parameter ?api_key=gcz_live_… GET /v2/status/… and DELETE /v2/task/… only

Avoid the query parameter where you can — URLs tend to end up in logs and browser history.

A request with the X-API-Key header

Look up details of a coordinate system — a quick, free way to check that your key works.

curl -X POST "https://api.geoczech.dev/v2/tool/coordinates" \
  -H "X-API-Key: YOUR_API_KEY" \
  --form-string 'params={
    "method": "detail",
    "crs": "EPSG:32730",
    "response_type": "json"
  }' \
  -F "wait=true"

Keep the key out of your code

Instead of pasting the key into the script, store it in an environment variable and read it from there. Then you can share or publish the script safely.

Read the key from an environment variable
# macOS / Linux / Git Bash — set once per terminal session
export GEOCZECH_API_KEY="gcz_live_…"

curl -X POST "https://api.geoczech.dev/v2/tool/coordinates" \
  -H "X-API-Key: $GEOCZECH_API_KEY" \
  --form-string 'params={"method": "detail", "crs": "EPSG:32730", "response_type": "json"}' \
  -F "wait=true"

Restricting a key

Each key can be limited in the Console, so that a leaked key does as little harm as possible. Requests that break a restriction are rejected with 403 (or 402 for the credit limit).

Restriction What it does Typical use
Allowed IP addresses Only requests from these IPs or ranges (CIDR, e.g. 203.0.113.0/24) are accepted. A key used by your own server.
Allowed domains Only requests from web pages on these domains (checked via the Origin/Referer header; wildcards like *.example.com allowed). A key used in a browser app.
Allowed tools The key may only run selected tools. A key that should only convert, never anything else.
Monthly credit limit The key stops working for the rest of the month after spending this many credits. Protects your balance against bugs and loops.
Expiry date The key stops working after this date. Temporary access for a partner or a test.
Allowed data URLs (map keys only) MapServer renders only data whose URL starts with these prefixes. Every map key — see MapServer.

Rotating a key

Rotate a key in the Console to replace it with a new one without downtime: the new key works immediately and the old one keeps working for a short overlap period, so you have time to update your applications. After that the old key is rejected with api_key_rotated.

Authentication errors

HTTP code Meaning
401 missing_api_key No key in the request.
401 invalid_api_key The key does not exist (typo? copied only part of it?).
401 api_key_expired, api_key_revoked, api_key_paused The key exists but is not active.
401 api_key_rotated The key was rotated and the overlap period is over — use the new key.
403 ip_not_allowed, domain_not_allowed The request comes from an address/page the key is not allowed for.
403 scope_denied The key is not allowed to use this tool.
403 map_key_not_allowed A map key (gcz_map_…) was used — map keys work only for MapServer.
403 api_access_denied Your current plan does not include API access.
403 account_inactive The account is suspended or closed.
402 api_key_monthly_limit The key reached its monthly credit limit.

More in Errors.

Example error response
curl -X POST "https://api.geoczech.dev/v2/tool/coordinates" \
  -F "method=search" -F "q=UTM"
401 Unauthorized
{
  "detail": "API key is required",
  "code": "missing_api_key"
}

Last updated 2026-11-17