Documentation
Golbat
API

Golbat API

Golbat serves an HTTP API on port and a gRPC API on grpc_port. Maps such as ReactMap read Pokémon and forts from it instead of querying the database.

This page is an overview. Each Golbat instance also serves interactive docs at /docs (OpenAPI document at /openapi.json), which are always in sync with your version. The full written reference with every field is api.md (opens in a new tab) in the repository.

Authentication

EndpointCredentialConfig key
/api/*, /debug/pprof/*X-Golbat-Secret: <secret> headerapi_secret
gRPC GolbatApix-golbat-secret metadata (authorization: <secret> or authorization: Bearer <secret> also work)api_secret
POST /rawAuthorization: Bearer <token> headerraw_bearer
gRPC RawProtoauthorization metadata with the token, without Bearer raw_bearer
/metricsAuthorization: Bearer <token>prometheus.token
/docs, /openapi.json, /schemas, /health, /versionnone

An empty secret disables the corresponding check.

⚠️

gRPC server reflection is enabled and unauthenticated. It only exposes the schema, but grpc_port should still not be reachable from the internet.

Raw data ingestion

POST /raw

Receives game data from your MITM devices or Dragonite. The body is JSON:

{
  "uuid": "device_uuid",
  "username": "account_name",
  "trainerlvl": 30,
  "scan_context": "Pokemon",
  "lat_target": 40.7128,
  "lon_target": -74.0060,
  "have_ar": true,
  "contents": [
    { "payload": "<base64 response proto>", "type": 106, "request": "<base64 request proto>" }
  ]
}
FieldNotes
uuidDevice id, shown in /api/devices/all.
usernameAccount name.
trainerlvlDefaults to 30. Data from accounts below level 30 is ignored (except PROXY_SOCIAL_ACTION).
scan_contextScanner mode, used to pick scan rules.
lat_target, lon_targetWhere the device is scanning.
have_arWhether quests from this request are stored as AR or non-AR quests. Can be overridden per entry.
timestamp_msOptional receive time in unix milliseconds.
contents[]Game protos: payload (or data), method number in type (or method), optional request.
nebula_contents[]Battle-backend calls, used to read invasion lineups.
push_contents[]Push messages, used for raid and max battle lobby player counts.

When the request has an Origin header, Golbat expects the PogoDroid format instead: a JSON array of {"payload", "type", "lat", "lng", "quests_held"}.

Responses: 201 accepted (processing is asynchronous), 401 wrong bearer, 422 undecodable body. Bodies over 5 MiB are cut off. Under overload an accepted request can still be dropped; this is counted in golbat_raw_packets_shed_total.

gRPC RawProto.SubmitRawProto

The binary equivalent of /raw on grpc_port, defined in grpc/raw_receiver.proto (opens in a new tab). Payloads are raw bytes instead of base64. Unlike /raw, trainer_level defaults to 0, so it must be sent.

HTTP endpoints

All endpoints below need the API secret.

Status

MethodPathDescription
GET/health, /api/healthHealth check (/health needs no secret).
GET/versionGolbat version (no secret).
GET/api/statusEnabled features, effective result limits and supported filters. Maps use it to detect capabilities.

Pokémon

MethodPathDescription
GET/api/pokemon/id/{id}One Pokémon by encounter id.
GET/api/pokemon/availableSpecies and forms currently in memory, with counts.
POST/api/pokemon/v3/scanPokémon in a bounding box with filters. Current version, used by ReactMap.
POST/api/pokemon/v2/scan, /api/pokemon/scanOlder scan versions, kept for compatibility.
POST/api/pokemon/searchNearest Pokémon of given species around a point.

Forts

Fort scan and available endpoints require fort_in_memory. Gym and station lookups by id read through to the database and work without it; pokestop lookups by id only use the in-memory cache.

MethodPathDescription
POST/api/gym/scan, /api/pokestop/scan, /api/station/scanForts of one type in a bounding box with filters.
POST/api/fort/scanGyms, pokestops and stations in one request.
GET/api/gym/available, /api/pokestop/available, /api/station/available, /api/fort/availableWhat is currently available (raid bosses, quest rewards, invasions, lures, max battles…).
GET/api/gym/id/{id}, /api/pokestop/id/{id}, /api/station/id/{id}One fort by id.
POST/api/gym/query, /api/station/querySeveral forts by id.
POST/api/gym/searchSearch gyms by name, description or location.
POST/api/pokestop-positionsId and position of every pokestop inside a geofence.

Quests, tappables and devices

MethodPathDescription
POST/api/quest-statusNumber of quests held by pokestops inside a geofence.
POST/api/clear-questsClear AR and non-AR quests of every pokestop inside a geofence.
GET/api/tappable/id/{id}One tappable.
POST/api/tappable/scanTappables in a bounding box.
GET/api/tappable/availableReward types and encounter species of live tappables.
GET/api/devices/allLast reported location of each device, kept for cleanup.device_hours.

Fort tracker

MethodPathDescription
GET/api/fort-tracker/cell/{cell_id}Forts Golbat expects in an S2 cell.
GET/api/fort-tracker/forts/{fort_id}Tracking state of one fort (used for stale fort removal).

Admin

MethodPathDescription
GET, POST/api/reload-geojsonReload geofences from Koji or geojson/geofence.json and reset area stats.
GET, POST/api/skip-preserve-pokemonDon't save in-memory Pokémon on the next shutdown (with preserve_pokemon). Cleared only by a restart.

Debug

With tuning.profile_routes = true, the standard Go profiling endpoints are served under /debug/pprof/. Block and mutex profiles additionally need tuning.profile_contention.

gRPC API

Golbat serves the GolbatApi service (grpc/api.proto (opens in a new tab)) on grpc_port. Responses are smaller and faster to decode than JSON, which matters for large maps.

RPCHTTP equivalent
ScanPokemonPOST /api/pokemon/v3/scan
GetPokemonGET /api/pokemon/id/{id}, batched
ScanGyms, ScanPokestops, ScanStationsPOST /api/{gym,pokestop,station}/scan
ScanFortsPOST /api/fort/scan
ScanTappablesPOST /api/tappable/scan
GetTappableGET /api/tappable/id/{id}, batched

Encounter ids are numbers, not strings. Large fort scans can exceed gRPC's default 4 MB client limit; raise the client's maximum receive size or lower limit.

grpcurl -plaintext -H 'x-golbat-secret: golbat' -max-msg-sz 67108864 \
  localhost:50001 list golbat_api.GolbatApi