# Martin Endpoints

> [!TIP]
>
> **OpenAPI Documentation**
>
> If you want to explore the API endpoints programmatically or generate client code, you can use our [OpenAPI Documentation](<https://github.com/maplibre/martin/raw/main/martin/openapi.json>).

> [!TIP]
>
> **OGC compliant API endpoints**
>
> Martin also serves its tiles through [OGC API - Tiles](<https://maplibre.org/martin/ogc-api/index.md>) under `/ogc`, for clients that need an OGC compliant API. We only recommend them if OGC compliance is a requirement, because they are more complicated to use than the endpoints below.

Martin data is available via these HTTP `GET` endpoints:

| URL | Description |
| --- | --- |
| `/` | Web UI |
| `/catalog` | [List of all sources](<#catalog>) |
| `/{sourceID}` | [Source TileJSON](<#source-tilejson>) |
| `/{sourceID}/{z}/{x}/{y}` | Map Tiles |
| `/{source1},…,{sourceN}` | [Composite Source TileJSON](<#source-tilejson>) |
| `/{source1},…,{sourceN}/{z}/{x}/{y}` | [Composite Source Tiles](<https://maplibre.org/martin/sources-composite/index.md>) |
| `/sprite/{spriteID}[@2x].{json,png}` | [Sprite sources](<https://maplibre.org/martin/sources-sprites/index.md>) |
| `/sdf_sprite/{spriteID}[@2x].{json,png}` | [SDF Sprite sources](<https://maplibre.org/martin/sources-sprites/index.md>) |
| `/font/{font}/{start}-{end}` | [Font source](<https://maplibre.org/martin/sources-fonts/index.md>) |
| `/font/{font1},…,{fontN}/{start}-{end}` | [Composite Font source](<https://maplibre.org/martin/sources-fonts/index.md>) |
| `/style/{style}` | [Style source](<https://maplibre.org/martin/sources-styles/index.md>) |
| `/style/{style}/{z}/{x}/{y}.{ext}` | [Rendered raster tiles](<https://maplibre.org/martin/sources-styles/rendering/index.md>) (Linux) |
| `/style/{style}/static/{camera}/{size}.{ext}` | [Static images](<https://maplibre.org/martin/sources-styles/rendering/#static-images>) (Linux) |
| `/ogc`, `/ogc/...` | [OGC API - Tiles](<https://maplibre.org/martin/ogc-api/index.md>) |
| `/health` | Martin server health check: returns 200 `OK` |
| `/_/metrics` | Martin server Prometheus metrics |

### Postprocessing

Martin can postprocess tiles before serving - for example, converting between MVT and [MLT format](<https://maplibre.org/martin/postprocessing/mlt/index.md>) in either direction. Postprocessing is configured via the `convert_to_mlt` and `convert_to_mvt` keys in the [configuration file](<https://maplibre.org/martin/postprocessing/index.md>), not through the HTTP API. Clients receive the postprocessed tiles transparently.

### Duplicate Source ID

In case there is more than one source that has the same name, e.g. a PG function is available in two schemas/connections, or a table has more than one geometry columns, sources will be assigned unique IDs such as `/points`, `/points.1`, etc.

### Reserved Source IDs

Some source IDs are reserved for internal use. If you try to use them, they will be automatically renamed to a unique ID the same way as duplicate source IDs are handled, e.g. a `catalog` source will become `catalog.1`.

Here are the reserved source IDs: `_`, `catalog`, `config`, `font`, `health`, `help`, `index`, `manifest`, `metrics`, `ogc`, `refresh`, `reload`, `sprite`, `status`.

### Source TileJSON

All tile sources have a [TileJSON](<https://github.com/mapbox/tilejson-spec>) endpoint available at the `/{SourceID}`.

For example, a `points` function or a table will be available as `/points`. Composite source combining `points` and `lines` sources will be available at `/points,lines` endpoint.

```bash
curl localhost:3000/points | jq
curl localhost:3000/points,lines | jq
```

### Catalog

A list of all available sources is available via catalogue endpoint

```bash
curl localhost:3000/catalog | jq
```

> [!NOTE]
>
> **Example**
>
> ```yaml
> {
>   "tiles" {
>     "function_zxy_query": {
>       "name": "public.function_zxy_query",
>       "content_type": "application/x-protobuf"
>     },
>     "points1": {
>       "name": "public.points1.geom",
>       "content_type": "image/webp"
>     },
>     ...
>   },
>   "sprites": {
>     "cool_icons": {
>       "images": [
>         "bicycle",
>         "bear",
>       ]
>     },
>     ...
>   },
>   "fonts": {
>     "Noto Mono Regular": {
>       "family": "Noto Mono",
>       "style": "Regular",
>       "glyphs": 875,
>       "start": 0,
>       "end": 65533
>     },
>     ...
>   },
>   "styles": {
>     "maplibre_demo": {
>       "path": "path/to/maplibre_demo.json",
>     },
>   },
> }
> ```
