# Maps and Route Planner

*Create, edit, read and delete your company's TrackSim map routes with the v3 API*

The Maps endpoints let your application open the TrackSim route planner for your company's map and read back the routes your drivers and admins save.

All endpoints live under `https://api.tracksim.app/v3/maps`. Paths have no trailing slash.

## Requirements

- Every request needs your company API key in the `Authorization` header. See [Authentication](/docs/api/authentication).
- Your company must have a TrackSim map. Maps need a paid TrackSim plan.
- Your company needs the Route Planner add-on, or the route planner enabled on its map.
- Requests are limited to 60 a minute.

***Note:** If your company drops to the free plan, its map and all its routes are deleted.*

## Typical flow

1. Call [Create a route link](#create-a-route-link) to get a one-time `full_url`.
2. Send the driver or admin to `full_url`. They build and save the route on the map.
3. Call [List routes](#list-routes) and [Get a route](#get-a-route) to read the route back.

## Errors

Errors are returned in this shape:

```json
{
  "error": "<message>"
}
```

- `403` - The API key is missing or invalid, the route doesn't exist or belongs to another company (`Map not found`), or the company can't use the route planner.
- `500` - A server error.

If your company doesn't have the Route Planner add-on, or the route planner isn't enabled on its map, every endpoint returns:

```json
{
  "error": "You don't have permission to access the route planner"
}
```

## Create a route link

Make a one-time link that opens your company's map route planner so a new route can be created.

`POST https://api.tracksim.app/v3/maps/create`

There's no request body.

### Response

```json
{
  "full_url": "https://<map-domain>?flags=<flag>",
  "flag": "<jwt>"
}
```

- `full_url` - Uses your company's verified custom domain. Until the custom domain is verified, it uses the default TrackSim map domain.
- `flag` - A signed token that expires after 24 hours.

***Note:** Treat `full_url` and `flag` as secrets. Anyone with the link can create a route for your company until it expires.*

## Create a route edit link

Make a one-time link that opens an existing route in the route planner for editing.

`PATCH https://api.tracksim.app/v3/maps/{route_id}/edit`

`route_id` is the route's UUID. There's no request body.

### Response

The response has the same shape as [Create a route link](#create-a-route-link). The `flag` is tied to that route and also expires after 24 hours.

```json
{
  "full_url": "https://<map-domain>?flags=<flag>",
  "flag": "<jwt>"
}
```

### Errors

- `403 Map not found` - The route doesn't exist or belongs to another company.

## List routes

List your company's saved routes. Waypoints are not included.

`GET https://api.tracksim.app/v3/maps/routes`

### Response

```json
[
  {
    "id": "3f1c9a52-7d0e-4b8a-9c61-2e5f8d4b7a10",
    "game": "eut2",
    "map": "...",
    "name": "Convoy to Berlin",
    "convoy": true,
    "created_at": "2026-11-13T02:19:58.153Z",
    "updated_at": "2026-11-13T02:19:58.153Z"
  }
]
```

- `game` - `eut2` or `ats`.
- `name` - Can be `null`.

## Get a route

Return one route in full, including its waypoints.

`GET https://api.tracksim.app/v3/maps/{route_id}/route`

### Response

```json
{
  "id": "3f1c9a52-7d0e-4b8a-9c61-2e5f8d4b7a10",
  "game": "eut2",
  "map": "...",
  "name": "Convoy to Berlin",
  "convoy": false,
  "waypoints": [ ... ],
  "tenant": {
    "id": 123,
    "slug": "my-vtc",
    "name": "My VTC",
    "custom_domain": {
      "domain": "map.myvtc.com"
    }
  },
  "created_at": "2026-11-13T02:19:58.153Z",
  "updated_at": "2026-11-13T02:19:58.153Z"
}
```

- `waypoints` - The route's stored waypoint list, the same data the route planner saves.
- `tenant.custom_domain.domain` - Can be `null`.

### Errors

- `403 Map not found` - The route doesn't exist or belongs to another company.

## Delete a route

Delete a route.

`DELETE https://api.tracksim.app/v3/maps/{route_id}/route`

### Response

```json
{
  "deleted": true
}
```

### Errors

- `403 Map not found` - The route doesn't exist or belongs to another company.
