> ## Documentation Index
> Fetch the complete documentation index at: https://docs.loci.ng/llms.txt
> Use this file to discover all available pages before exploring further.

# LOCI API

> The Milsat spatial index over HTTP: the frame at a location, the frames around it, what is recorded on them, and a worded answer about them.

Nigeria is covered by a grid of **frames**: cells roughly a kilometre across,
each with a stable numeric id. Everything on LOCI falls within frames. The
administrative identity of a place, its population, its buildings, its
physical setting and its cultural make-up are recorded on frames, and so is
every dataset an organisation adds or licenses. A frame id is therefore the
key to everything known about a place.

The API is how your own code uses that. It is four calls, all read-only, all
with an API key that acts for your organisation.

| Call | What it answers |
| - | - |
| `GET /v1/frames/at` | Which frame is this location in? |
| `GET /v1/frames` | Which frames are around this location? |
| `GET /v1/frames/data` | What is recorded on these frames? |
| `POST /v1/frames/insight` | A question about these frames, answered in plain language. |

The first takes a latitude and longitude and returns a frame. The second takes
a box and returns the frames in it. The third takes frame ids and returns what
every dataset you can read says about each one. The fourth takes frame ids and
a question and returns an answer whose figures were computed from the data
and whose wording was checked against those figures.

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Mint a key and make all four calls, with the responses they really return.
  </Card>

  <Card title="Authentication" icon="key" href="/authentication">
    What a key is, how it is minted, and what happens when it expires or leaks.
  </Card>

  <Card title="Scopes" icon="list-checks" href="/scopes">
    The three presets, and which of the four calls each one reaches.
  </Card>

  <Card title="API reference" icon="square-terminal" href="/api-reference/introduction">
    Every parameter, every response field, every error code.
  </Card>
</CardGroup>

## What a key can and cannot do

A key reads. It cannot create, change or delete anything, cannot buy or sell
data, cannot manage members, and cannot mint another key. There is no write
capability a key can hold, so a leaked key can read what its scope permitted
and nothing more. Everything else is done by a signed-in person in the app.

A key acts for exactly one organisation, the one it was minted in, and sees
that organisation's own datasets and the ones it has licensed from the
marketplace. It can be narrowed further at mint time to named datasets.

## How answers are made

Figures are never generated. `GET /v1/frames/data` returns stored values as
they are. `POST /v1/frames/insight` computes its figures from those values,
has a model word them, and then checks every number in the wording against
the computed results; wording that fails the check is dropped and the computed
sentence stands alone. The answer says which happened in its `engine` field.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.