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

# Find nearby locations

> Returns the organization's locations within `radius` km of (`lat`, `lon`), sorted by ascending great-circle distance. Authenticated via a publishable API key (`cpk_*`) in the `X-API-Key` header — the same key embedded in the public store-locator widget. Coordinates are WGS 84 / EPSG:4326 (the standard used by browsers' `navigator.geolocation` and Google Maps); PostGIS computes distance on the geography type (`ST_Distance` over a spheroid), so values are correct globally and not just for short distances. Use `radius` to bound the spatial window and `limit` to cap the result count after distance sort.



## OpenAPI

````yaml /openapi/openapi-locations.json get /locations/api/v1/public/locations
openapi: 3.1.0
info:
  title: Locations API
  version: 1.0.0
  description: >
    Location management for physical stores.


    ## Authentication


    All endpoints require an API key passed via the `X-API-Key` HTTP header,
    unless otherwise noted.


    ```

    X-API-Key: csb_<body>_<checksum>

    ```


    Generate API keys in **Settings > API Keys** in your dashboard, or via the
    Account API.

    Session-based (cookie) authentication is also accepted for browser-based
    access.


    ## Rate Limits


    | Tier        | Requests / minute | Requests / day |

    |-------------|-------------------|----------------|

    | Default     | 300               | 10,000         |

    | Custom      | Contact us        | Contact us     |


    Rate-limit headers are included on every response so callers can
    self-throttle without

    hitting our 429s ("informed governor"):


    - `RateLimit-Policy` — every active window, e.g. `300;w=60, 10000;w=86400`

    - `RateLimit-Limit` — quota for the **most-restrictive** currently-active
    window

    - `RateLimit-Remaining` — requests left in that window

    - `RateLimit-Reset` — seconds until that window resets (relative; clock-skew
    safe)


    Legacy `X-RateLimit-*` aliases are also emitted for back-compat.
    `X-RateLimit-Reset`

    keeps the absolute Unix-timestamp shape to avoid breaking existing
    consumers.


    When rate-limited, you receive `429 Too Many Requests` with a
    `retry_after_seconds` field

    in the error envelope and a `Retry-After` header.


    ## Pagination


    List endpoints return paginated results in this envelope:


    ```json

    {
      "data": [...],
      "pagination": {
        "page": 1,
        "page_size": 25,
        "total_count": 342,
        "total_pages": 14,
        "has_next": true,
        "has_previous": false
      }
    }

    ```


    Use `?page=2&page_size=50` query parameters. Maximum page size is 100.


    ## Error Responses


    All errors conform to [RFC 9457 Problem
    Details](https://www.rfc-editor.org/rfc/rfc9457)

    with `Content-Type: application/problem+json`:


    ```json

    {
      "type": "https://closient.com/docs/errors/not_found",
      "title": "Not Found",
      "status": 404,
      "detail": "The requested resource was not found.",
      "error_code": "not_found",
      "retryable": false,
      "timestamp": "2026-03-31T12:00:00+00:00"
    }

    ```


    Common error codes: `unauthorized` (401), `forbidden` (403), `not_found`
    (404),

    `validation_error` (422), `rate_limited` (429), `internal_error` (500).
  termsOfService: https://www.closient.com/terms/
servers:
  - url: https://www.closient.com
security: []
tags:
  - name: Locations
    description: Manage physical store locations.
  - name: Store Locator (Public)
    description: Public endpoints for the embeddable store locator widget.
externalDocs:
  description: Closient Documentation
  url: https://docs.closient.com
paths:
  /locations/api/v1/public/locations:
    get:
      tags:
        - Store Locator (Public)
      summary: Find nearby locations
      description: >-
        Returns the organization's locations within `radius` km of (`lat`,
        `lon`), sorted by ascending great-circle distance. Authenticated via a
        publishable API key (`cpk_*`) in the `X-API-Key` header — the same key
        embedded in the public store-locator widget. Coordinates are WGS 84 /
        EPSG:4326 (the standard used by browsers' `navigator.geolocation` and
        Google Maps); PostGIS computes distance on the geography type
        (`ST_Distance` over a spheroid), so values are correct globally and not
        just for short distances. Use `radius` to bound the spatial window and
        `limit` to cap the result count after distance sort.
      operationId: apps_locations_api_public_list_public_locations
      parameters:
        - in: query
          name: lat
          schema:
            description: >-
              Latitude of the search centre in decimal degrees, WGS 84 /
              EPSG:4326. Typically obtained from the browser's
              `navigator.geolocation` API or a geocoded user query.
            maximum: 90
            minimum: -90
            title: Lat
            type: number
          required: true
          description: >-
            Latitude of the search centre in decimal degrees, WGS 84 /
            EPSG:4326. Typically obtained from the browser's
            `navigator.geolocation` API or a geocoded user query.
        - in: query
          name: lon
          schema:
            description: >-
              Longitude of the search centre in decimal degrees, WGS 84 /
              EPSG:4326.
            maximum: 180
            minimum: -180
            title: Lon
            type: number
          required: true
          description: >-
            Longitude of the search centre in decimal degrees, WGS 84 /
            EPSG:4326.
        - in: query
          name: radius
          schema:
            default: 50
            description: >-
              Search radius in kilometres. Locations farther than this from
              (`lat`, `lon`) are excluded. Defaults to 50 (a typical metro
              area); pass a larger value (e.g. 5000) to span a continent.
            exclusiveMinimum: 0
            title: Radius
            type: number
          required: false
          description: >-
            Search radius in kilometres. Locations farther than this from
            (`lat`, `lon`) are excluded. Defaults to 50 (a typical metro area);
            pass a larger value (e.g. 5000) to span a continent.
        - in: query
          name: limit
          schema:
            default: 20
            description: >-
              Maximum number of locations to return (1-100). Results are
              pre-sorted by distance ascending, so this acts as a 'top N
              nearest' truncation.
            maximum: 100
            minimum: 1
            title: Limit
            type: integer
          required: false
          description: >-
            Maximum number of locations to return (1-100). Results are
            pre-sorted by distance ascending, so this acts as a 'top N nearest'
            truncation.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LocationsResponse'
      security:
        - PublishableKeyAuth: []
components:
  schemas:
    LocationsResponse:
      examples:
        - locations:
            - address: 123 Main St, Springfield, IL 62701, United States of America
              distance_km: 0.42
              id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
              lat: 39.7817
              lon: -89.6501
              name: Downtown Store
              phone: '+15550123'
              website: https://example.com
            - address: 456 Oak Ave, Springfield, IL 62704, United States of America
              distance_km: 3.18
              id: b2c3d4e5-f6a7-8901-bcde-f23456789012
              lat: 39.7901
              lon: -89.684
              name: West Side Pickup
              phone: '+15550456'
              website: https://example.com/west
          organization:
            name: Acme Retail Corp.
            short_id: keATfB8VP2gSjcnTbsMNQL
      properties:
        locations:
          description: >-
            Locations within `radius` of (`lat`, `lon`), sorted ascending by
            great-circle distance. Empty list when no locations match. PostGIS
            geography distance is converted to kilometres and rounded to two
            decimals.
          items:
            $ref: '#/components/schemas/LocationOut'
          title: Locations
          type: array
        organization:
          $ref: '#/components/schemas/OrganizationOut'
          description: >-
            The organization the publishable API key belongs to. Lets the widget
            render branding without a second request.
      required:
        - locations
        - organization
      title: LocationsResponse
      type: object
    LocationOut:
      examples:
        - address: 123 Main St, Springfield, IL 62701, United States of America
          distance_km: 2.3
          id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
          lat: 39.7817
          lon: -89.6501
          name: Downtown Store
          phone: '+15550123'
          website: https://example.com
      properties:
        id:
          description: >-
            URL-safe 22-character shortuuid encoding of the row's UUID primary
            key. Stable across the row's lifetime; suitable for sharing in URLs,
            log lines, and external SDK clients. Accepted on input as either the
            shortuuid form or the canonical UUID form
            (``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``).
          format: shortuuid
          maxLength: 22
          minLength: 22
          pattern: ^[23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{22}$
          title: Id
          type: string
        name:
          description: >-
            Display name of the location, e.g. 'Downtown Store'. May be empty
            when only the address is meaningful.
          title: Name
          type: string
        address:
          description: >-
            Formatted full street address (line 1, optional line 2, city,
            region, postal code, country) joined with ', '.
          title: Address
          type: string
        lat:
          description: >-
            Latitude in decimal degrees, WGS 84 / EPSG:4326 (the same datum
            browsers and Google Maps use). Range: -90 to 90.
          maximum: 90
          minimum: -90
          title: Lat
          type: number
        lon:
          description: >-
            Longitude in decimal degrees, WGS 84 / EPSG:4326. Range: -180 to
            180.
          maximum: 180
          minimum: -180
          title: Lon
          type: number
        distance_km:
          description: >-
            Great-circle distance from the search point (`lat`, `lon`) in
            kilometres, rounded to two decimals. Computed by PostGIS on the
            geography type, so values account for the Earth's curvature.
          minimum: 0
          title: Distance Km
          type: number
        phone:
          default: ''
          description: >-
            Primary phone number in E.164 format (e.g. `+15550123`). Empty
            string when no phone is set.
          title: Phone
          type: string
        website:
          default: ''
          description: >-
            Primary website URL for the location, e.g. `https://example.com`.
            Empty string when no URL is set.
          title: Website
          type: string
      required:
        - id
        - name
        - address
        - lat
        - lon
        - distance_km
      title: LocationOut
      type: object
    OrganizationOut:
      examples:
        - name: Acme Retail Corp.
      properties:
        id:
          description: >-
            URL-safe 22-character shortuuid encoding of the row's UUID primary
            key. Stable across the row's lifetime; suitable for sharing in URLs,
            log lines, and external SDK clients. Accepted on input as either the
            shortuuid form or the canonical UUID form
            (``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``).
          format: shortuuid
          maxLength: 22
          minLength: 22
          pattern: ^[23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{22}$
          title: Id
          type: string
        name:
          description: Display name of the organization that owns the locations.
          title: Name
          type: string
      required:
        - id
        - name
      title: OrganizationOut
      type: object
  securitySchemes:
    PublishableKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````