Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/floriansalvi/HEIG-VD_Ocha-api/llms.txt

Use this file to discover all available pages before exploring further.

The List Stores endpoint returns a collection of stores registered in the Ocha platform. By default, results are paginated with ten stores per page. When the near query parameter is provided, the API switches to a geospatial mode and returns all stores within the given radius sorted by distance — pagination parameters are ignored in that mode.

Endpoint

GET /api/v1/stores
This endpoint is public and does not require authentication.

Query Parameters

page
number
default:1
The page number to retrieve. Used only when near is not provided.
limit
number
default:10
Number of stores returned per page. Used only when near is not provided.
near
string
Coordinates of the search origin in "lng,lat" format (e.g. "6.93,46.99"). When supplied, the response includes all stores within radius meters sorted by proximity. Pagination is disabled.
radius
number
default:10000
Maximum search distance in meters. Only applied when near is also provided.

Response — 200 OK

message
string
Human-readable status message (e.g. "List of stores" or "Nearby stores").
page
number
Current page number. Only present in paginated responses (when near is not used).
totalPages
number
Total number of available pages. Only present in paginated responses.
totalStores
number
Total number of stores matching the query.
stores
array
List of store objects.

Error Codes

StatusDescription
400Invalid query parameters (e.g. malformed near value).
500Unexpected server error.

Examples

Basic listing

curl https://api.ocha.ch/api/v1/stores
{
  "message": "List of stores",
  "page": 1,
  "totalPages": 3,
  "totalStores": 25,
  "stores": [
    {
      "_id": "64f1c2e9a1b2c3d4e5f12345",
      "name": "Ocha Neuchâtel",
      "slug": "ocha-neuchatel",
      "email": "[email protected]",
      "phone": "+41321234567",
      "address": {
        "line1": "Avenue de la Gare 1",
        "city": "Neuchâtel",
        "zipcode": "2000",
        "country": "Suisse"
      },
      "location": {
        "type": "Point",
        "coordinates": [6.93, 46.99]
      },
      "is_active": true,
      "opening_hours": [
        [],
        ["08:00", "18:00"],
        ["08:00", "18:00"],
        ["08:00", "18:00"],
        ["08:00", "20:00"],
        ["08:00", "20:00"],
        ["09:00", "17:00"]
      ],
      "created_at": "2024-01-15T10:00:00.000Z",
      "updated_at": "2024-03-20T14:30:00.000Z"
    }
  ]
}
curl "https://api.ocha.ch/api/v1/stores?near=6.93,46.99&radius=5000"
{
  "message": "Nearby stores",
  "totalStores": 2,
  "stores": [
    {
      "_id": "64f1c2e9a1b2c3d4e5f12345",
      "name": "Ocha Neuchâtel",
      "slug": "ocha-neuchatel",
      "location": {
        "type": "Point",
        "coordinates": [6.93, 46.99]
      }
    }
  ]
}

Pagination

curl "https://api.ocha.ch/api/v1/stores?page=2&limit=5"
{
  "message": "List of stores",
  "page": 2,
  "totalPages": 5,
  "totalStores": 25,
  "stores": []
}

Build docs developers (and LLMs) love