API
A REST API for the distribution company’s systems: metering (AMI), billing, customer portal. Data are uploaded and collected without manual exports. Permissions are the same as in the workspace: an account sees only its own organisation’s projects.
Full description for developers (OpenAPI 3): /api/v1/openapi.yaml. Change log: /api/v1/changelog. Metering point registry template with an example: xlsx, csv — accepted by upload as is. Meter profile template: csv, xlsx. A one-substation sample that is accepted and calculated: registry, one week of profiles.
Connection
- base URL:
https://gridinspector.com/api/v1(orhttps://gridinspector.ru/api/v1); - JSON in UTF-8; files as
multipart/form-data; - sign-in with the login and password of an account issued by GRID-IN; the response contains a token,
passed in the header
Authorization: Bearer <token>; - for a program that runs unattended — a service key (
POST /keys): no expiry, independent of the password, can be revoked at any time; - browser requests from a customer website — from origins agreed at connection;
- API revision — the date of the latest change: header
X-API-Revisionin every response; when it changes, the change log has a new entry; - errors — a code in the
errorfield and an HTTP status: 400 bad request, 401 not signed in, 404 not found, 405 wrong request method, 409 not possible now (e.g. no contract), 429 too many failed sign-ins; a readable text is in themessagefield; - after a dropped connection a request can be repeated safely: the
Idempotency-Keyheader on project creation, upload and calculation start returns the first request’s response — no second upload, no second charge; your own request id — headerX-Client-Request-Id, returned in the history; - when to ask about a task again — header
Retry-After; times are also given with a time zone (…_tzfields).
Requests
| Request | What it does |
|---|---|
POST /session | sign in: {"login", "password"} → {"token", "expires_in", "user"} |
GET /me | the signed-in account: login, name, role |
GET /projects | the organisation’s projects |
POST /projects | create a project: {"name", "name_en"} |
GET /projects/{id} | project: substations with data periods, number of the latest calculation |
POST /projects/{id}/files | upload files (field file, several allowed) → an ingest task per file |
GET /tasks/{id} | task status: queued, running, done, failed; progress (progress, stage); what was recognised in the file and which substation it belongs to |
GET /projects/{id}/uploads | uploads of the project: file, format, when received; DELETE …/uploads/{upload} — delete an upload (kept in GRID-IN deleted items, can be restored through the administrator) |
POST /projects/{id}/run | run a calculation → a task. An empty body — all substations for the whole period, as before; optionally — selected substations (substations) and a period (period_from, period_to) |
GET /projects/{id}/runs | finished calculations: period, what was requested, whether new data were uploaded afterwards |
GET /projects/{id}/runs/{run} | calculation summary per substation: supply, consumption, losses; with a network scheme — technical and non-technical |
GET /projects/{id}/tasks | task history of the project: uploads and calculations |
GET /projects/{id}/runs/{run}/targets | field targets in priority order |
GET /projects/{id}/meters | all metering points of the project: substation, meter number, supply or consumer, address, coordinates |
GET /projects/{id}/meters/{meter}/readings | readings of a metering point for a period (from, to): time and average power per interval, kW — as uploaded |
GET /contract | contract: term, volume and remaining metering points; whether uploads and calculations are possible now |
PUT /webhook | address for task completion notifications (https only); GET, DELETE — view, switch off |
POST /keys, GET /keys, DELETE /keys/{id} | service keys: issue, list, revoke |
Creating projects, uploading and deleting files, running calculations, issuing keys and setting notifications require the manager role; inspectors have read access. Lists are returned in full, readings — for the requested period.
Field target
| Field | Meaning |
|---|---|
priority | position in the visit order |
substation, pos | substation |
target | target key |
meter, label | meter number and its name |
address, lat, lon | address and coordinates |
kind | target type: theft — unmetered consumption, extra — meter of another substation, fault — fault, past — irregularity in an earlier period, not repeated in the latest one |
categories | finding codes for the target |
probability | probability of confirmation, %, where measured |
confidence | confidence: high, medium, low |
unaccounted_kwh, metered_kwh | estimated unmetered and metered energy for the period, kWh |
Notifications
- when an upload or a calculation finishes, a POST is sent to the address set with
PUT /webhook:{"event": "task_finished", "task", "kind", "project", "status", "run", "error", "at"}; - signature — header
X-GridIn-Signature: sha256=…(HMAC-SHA256 of the body with the secret issued when the address was set): it proves the notification came from GRID-IN; - one attempt, no retries; a missed one is visible in the project task history.
Coordinates and readings
- coordinates — for metering points and targets; WGS84, fields
lat(latitude) andlon(longitude); - source of coordinates — field
precision:house— the meter point,address— by address,settlement— centre of the settlement; coordinates may be absent; - readings are returned as uploaded, nothing is calculated: average power per interval, kW; the time stamp is the
end of the interval; the substation series is the readings of its supply meter (
input: true). - no supply meter data — the calculation still runs: without the balance, with findings from billing, meter event logs and meter faults.
Typical sequence
POST /session— get a token;POST /projects/{id}/files— send the export; wait for the tasks viaGET /tasks/{id}: a result for every file, with the file id and the uploads it produced;GET /projects/{id}/readiness— check whether a calculation is possible: substation coverage by readings, how many metering points it would charge, data revision; calculates and charges nothing;POST /projects/{id}/run— run a calculation (with the data revision from the check); wait for the task (or the notification), the calculation number is inresult.run;GET /projects/{id}/runs/{run}— balance and losses per substation;GET /projects/{id}/runs/{run}/targets— collect the targets;GET /projects/{id}/metersand…/readings— points for the map and charts.
API access is issued together with the organisation’s account.