> ## 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.

# The frames around a location

> Every frame that touches a bounding box, as a GeoJSON `FeatureCollection` carrying each frame's id and shape.

To get the frames around a point, build a box around it. The grid is roughly 0.01° across, so a box of ±0.01° around a location returns the frame it is in and its neighbours; ±0.05° returns a neighbourhood. The box is `minLon,minLat,maxLon,maxLat` in degrees, GeoJSON axis order.

At most 5,000 frames come back in one response, or fewer with `limit`. When the box held more than that, the response says so with `"truncated": true` rather than failing: narrow the box.

Alternatively, pass `ids` instead of `bbox` to fetch up to 100 named frames in full, bounding boxes included. That form answers with an array of frames rather than a collection.

Needs `frame.read`.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/frames
openapi: 3.1.0
info:
  title: LOCI API
  version: 1.0.0
  summary: >-
    The Milsat spatial index over HTTP: find the frame at a location, the frames
    around it, what is recorded on them, and a worded answer about them.
  description: >-
    Four calls, all under `/v1/frames`, all read-only, all with an API key.


    Nigeria is covered by a grid of **frames**: cells roughly a kilometre
    across, each with a stable numeric id. Every dataset on LOCI falls within
    frames, so a frame id is the key to everything known about a place. The API
    lets your code resolve a location to its frame, list the frames around a
    point, read what the datasets your organisation owns or licenses record on
    those frames, and ask a question about them in plain language.


    Every response is wrapped in an envelope: a success carries `data`, a
    failure carries `error` with a machine-readable `code` and a human
    `message`. Branch on the code; the message may be reworded.


    Send the key as `Authorization: Bearer loci_sk_…`. A key acts for one
    organisation, is read-only, and expires.
servers:
  - url: https://api.staging.loci.ng
    description: The LOCI API, which the app at loci.ng also uses.
  - url: http://localhost:8088
    description: A local development stack, which the examples here were captured against.
security:
  - apiKey: []
tags:
  - name: Frames
    description: The spatial index and what is recorded on it.
paths:
  /v1/frames:
    get:
      tags:
        - Frames
      summary: The frames around a location
      description: >-
        Every frame that touches a bounding box, as a GeoJSON
        `FeatureCollection` carrying each frame's id and shape.


        To get the frames around a point, build a box around it. The grid is
        roughly 0.01° across, so a box of ±0.01° around a location returns the
        frame it is in and its neighbours; ±0.05° returns a neighbourhood. The
        box is `minLon,minLat,maxLon,maxLat` in degrees, GeoJSON axis order.


        At most 5,000 frames come back in one response, or fewer with `limit`.
        When the box held more than that, the response says so with
        `"truncated": true` rather than failing: narrow the box.


        Alternatively, pass `ids` instead of `bbox` to fetch up to 100 named
        frames in full, bounding boxes included. That form answers with an array
        of frames rather than a collection.


        Needs `frame.read`.
      operationId: framesAround
      parameters:
        - name: bbox
          in: query
          required: false
          description: >-
            `minLon,minLat,maxLon,maxLat` in degrees. Required unless `ids` is
            given.
          schema:
            type: string
          example: 7.485,9.048,7.505,9.068
        - name: limit
          in: query
          required: false
          description: At most this many frames, up to 5,000, which is also the default.
          schema:
            type: integer
            minimum: 1
            maximum: 5000
          example: 3
        - name: ids
          in: query
          required: false
          description: >-
            Instead of `bbox`: comma-separated frame ids, at most 100. Returns
            full frames with bounding boxes.
          schema:
            type: string
          example: 2163551,2163725
      responses:
        '200':
          description: >-
            The frames in the box as a `FeatureCollection`, or, with `ids`, an
            array of frames. Empty when nothing matches.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    oneOf:
                      - $ref: '#/components/schemas/FrameCollection'
                      - type: array
                        items:
                          $ref: '#/components/schemas/Frame'
                required:
                  - data
              examples:
                box:
                  summary: A box around a point, limited to 3
                  description: >-
                    Captured with `limit=3` so the truncation flag shows;
                    coordinate rings are abridged.
                  value:
                    data:
                      type: FeatureCollection
                      features:
                        - type: Feature
                          id: '2163725'
                          geometry:
                            type: Polygon
                            coordinates:
                              - - - 7.4904
                                  - 9.05143
                                - - 7.4805
                                  - 9.05143
                                - - 7.4805
                                  - 9.06201
                                - - 7.4904
                                  - 9.06201
                                - - 7.4904
                                  - 9.05143
                        - type: Feature
                          id: '2163731'
                          geometry:
                            type: Polygon
                            coordinates:
                              - - - 7.4904
                                  - 9.04434
                                - - 7.48158
                                  - 9.04434
                                - - 7.48158
                                  - 9.05143
                                - - 7.4904
                                  - 9.05143
                                - - 7.4904
                                  - 9.04434
                        - type: Feature
                          id: '2163732'
                          geometry:
                            type: Polygon
                            coordinates:
                              - - - 7.49509
                                  - 9.04434
                                - - 7.4904
                                  - 9.04434
                                - - 7.4904
                                  - 9.05143
                                - - 7.49509
                                  - 9.05143
                                - - 7.49509
                                  - 9.04434
                      truncated: true
                ids:
                  summary: Named frames in full
                  value:
                    data:
                      - id: '2163551'
                        geometry:
                          type: Polygon
                          coordinates:
                            - - - 7.5003
                                - 9.05143
                              - - 7.49131
                                - 9.05143
                              - - 7.49129
                                - 9.05145
                              - - 7.48751
                                - 9.05811
                              - - 7.48753
                                - 9.06201
                              - - 7.5003
                                - 9.06201
                              - - 7.5003
                                - 9.05143
                        bbox:
                          - 7.48751
                          - 9.05143
                          - 7.5003
                          - 9.06201
        '400':
          description: >-
            `bbox` is missing or malformed, or `ids` names more than 100 frames.
            Codes `invalid_bbox` and `invalid`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: invalid_bbox
                  message: bbox=minLon,minLat,maxLon,maxLat is required
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/InsufficientScope'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/Internal'
components:
  schemas:
    FrameCollection:
      type: object
      properties:
        type:
          type: string
          const: FeatureCollection
        features:
          type: array
          items:
            $ref: '#/components/schemas/FrameFeature'
        truncated:
          type: boolean
          description: Present and `true` when the box held more frames than were returned.
      required:
        - type
        - features
    Frame:
      type: object
      description: A cell of the spatial index.
      properties:
        id:
          type: string
          description: The frame's stable id, a numeric string.
          example: '2163551'
        geometry:
          $ref: '#/components/schemas/Geometry'
        bbox:
          $ref: '#/components/schemas/BBox'
      required:
        - id
        - geometry
        - bbox
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Stable and machine-readable. Branch on it.
            message:
              type: string
              description: For people. May be reworded.
          required:
            - code
            - message
      required:
        - error
    FrameFeature:
      type: object
      properties:
        type:
          type: string
          const: Feature
        id:
          type: string
        geometry:
          $ref: '#/components/schemas/Geometry'
      required:
        - type
        - id
        - geometry
    Geometry:
      type: object
      description: A GeoJSON geometry.
      properties:
        type:
          type: string
          example: Polygon
        coordinates:
          description: Positions as `[lon, lat]`, nested as GeoJSON requires for the type.
      required:
        - type
        - coordinates
    BBox:
      type: array
      description: '`[minLon, minLat, maxLon, maxLat]` in degrees.'
      items:
        type: number
      minItems: 4
      maxItems: 4
  responses:
    Unauthorized:
      description: >-
        No credential (`unauthorized`), or a key that is unknown, expired or
        revoked (`invalid_key`). A bad key is not treated as anonymous: the
        `loci_sk_` prefix proves a key was meant.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            none:
              value:
                error:
                  code: unauthorized
                  message: sign in, or send an API key
            invalid:
              value:
                error:
                  code: invalid_key
                  message: that API key is not valid, has expired, or was revoked
    InsufficientScope:
      description: >-
        The key does not carry `frame.read`. Every preset grants it, so this
        only arises on a key minted with an explicit capability list.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: insufficient_scope
              message: this API key does not carry the frame.read scope
    RateLimited:
      description: >-
        A budget is spent. `Retry-After` says how many seconds until the next
        request will pass.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: too many requests — retry in 5s
    Internal:
      description: >-
        Something failed on the server. The message is deliberately vague; retry
        once.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: internal
              message: could not look up the frame
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      bearerFormat: loci_sk_…
      description: >-
        An API key minted in the Developers tab of the LOCI app, sent as
        `Authorization: Bearer loci_sk_…`. Acts for one organisation, is
        read-only, and expires.

````

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