# API: Trails

| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | `/v1/data/activities/:token` | A shared activity (its start, end and privacy zones left out) (no sign-in) | — |
| GET | `/v1/data/commons/:id` | A Wikimedia Commons photo near a trail (credit it as the trail's commons_photos say) (no sign-in) | — |
| GET | `/v1/data/lists/:token` | A list of trails someone shared by link (no sign-in) | — |
| GET | `/v1/data/live/:token` | A live location someone shared with you (no sign-in) | — |
| GET | `/v1/data/photos/:key` | A published trail photo (no sign-in) | — |
| GET | `/v1/data/places` | Towns, ZIP codes and parks whose name starts with what was typed ("boulder", "maplewood, nj", "07040", "rocky mountain"), with where to move the map (a park's box); `go` is the one place a state or ZIP code made certain (no sign-in) | — |
| GET | `/v1/data/routes/:token` | A planned route someone shared by link (no sign-in) | — |
| GET | `/v1/data/states` | The states with trails, and how many each has (no sign-in) | — |
| GET | `/v1/data/states/:state/download` | Every trail in a state as one GeoJSON file, under the Open Database License (no sign-in) | — |
| GET | `/v1/data/states/:state/index` | Every trail in a state: its address, name and when it changed (for the public site's pages and sitemaps) (no sign-in) | — |
| GET | `/v1/data/trails` | Trails in a map area, by name, or near a point, with filters for difficulty, length, climb, activity, route type and dogs (no sign-in) | — |
| GET | `/v1/data/trails/:id` | One trail: its line, elevation profile, length, climb, estimated difficulty and time, trailhead, what is along it, sources and nearby trails (no sign-in) | — |
| GET | `/v1/data/trails/:id/commons` | Free-license photos from Wikimedia Commons taken near a trail, each with its credit (no sign-in) | — |
| GET | `/v1/data/trails/:id/gpx` | A trail's line as a GPX file, for a GPS or another app (no sign-in) | — |
| GET | `/v1/data/trails/:id/reviews` | A trail's published reviews, photos and recent conditions, with its average rating (no sign-in) | — |
| GET | `/v1/data/trails/:id/weather` | The forecast and active alerts at a trail's trailhead (or its middle), from the National Weather Service (no sign-in) | — |
| GET | `/v1/data/trails/ids` | Only the ids of the trails in a map area that the same filters as the list keep, so the map draws only those lines (no sign-in) | — |
| GET | `/v1/trails/activities` | Your recorded and imported activities, newest first | `trails:read` |
| POST | `/v1/trails/activities` | Save a recorded activity (the track packed by the app); safe to retry with the same client_id | `trails:write` |
| DELETE | `/v1/trails/activities/:id` | Delete an activity for good | `trails:write` |
| GET | `/v1/trails/activities/:id` | One activity: its line, elevation and numbers | `trails:read` |
| PATCH | `/v1/trails/activities/:id` | Rename an activity, change its kind, or share it (private, anyone with the link, or public) | `trails:write` |
| GET | `/v1/trails/activities/:id/export` | An activity as GeoJSON (for maps) or CSV (a row a point, for a spreadsheet) | `trails:read` |
| GET | `/v1/trails/activities/:id/gpx` | An activity as a GPX file, every point (it's yours) | `trails:read` |
| POST | `/v1/trails/activities/import` | Import an activity from a GPX file's text or a FIT file (base64), as watches and other apps export them | `trails:write` |
| GET | `/v1/trails/lists` | Your saved lists, with how many trails each holds | `trails:read` |
| POST | `/v1/trails/lists` | Make a new list | `trails:write` |
| DELETE | `/v1/trails/lists/:id` | Delete a list (the trails stay on the map) | `trails:write` |
| GET | `/v1/trails/lists/:id` | One list and its trails (yours, or one shared with your account) | `trails:read` |
| PATCH | `/v1/trails/lists/:id` | Rename a list, share it by link, or share it with everyone in your account | `trails:write` |
| PUT | `/v1/trails/lists/order` | Put your lists in this order (Want to go stays first) | `trails:write` |
| GET | `/v1/trails/live` | Your live shares, newest first | `trails:read` |
| POST | `/v1/trails/live` | Start sharing where you are (a link you send yourself; optional due-back time and up to 3 email contacts) | `trails:write` |
| PATCH | `/v1/trails/live/:id` | Change a running share's due-back time or contacts (the link stays the same) | `trails:write` |
| POST | `/v1/trails/live/:id/end` | End a live share (I'm back): the link stops showing where you are | `trails:write` |
| PUT | `/v1/trails/live/:id/position` | Where you are now, for a running share (only the latest is kept) | `trails:write` |
| GET | `/v1/trails/photos/:key` | One of your photos, published or not | `trails:read` |
| POST | `/v1/trails/plan` | A route through points, along the trails between them where it can (a preview: nothing is saved) | `trails:read` |
| GET | `/v1/trails/plus` | Which Plus features your account has (all, until paid plans open) | `trails:read` |
| GET | `/v1/trails/privacy-zones` | Your privacy zones | `trails:read` |
| POST | `/v1/trails/privacy-zones` | Add a privacy zone (a circle 200 m to 1.6 km across the middle of it) | `trails:write` |
| DELETE | `/v1/trails/privacy-zones/:id` | Remove a privacy zone | `trails:write` |
| POST | `/v1/trails/reports` | Report a review, photo or condition to our moderators | `trails:write` |
| DELETE | `/v1/trails/review-photos/:id` | Delete one of your photos | `trails:write` |
| DELETE | `/v1/trails/reviews/:trail_id` | Delete your review of a trail, with its photos | `trails:write` |
| GET | `/v1/trails/reviews/:trail_id` | Your review of a trail, whatever its status (null when you haven't written one) | `trails:read` |
| PUT | `/v1/trails/reviews/:trail_id` | Write or change your review of a trail (stars, words, when you went, and what it was like) | `trails:write` |
| POST | `/v1/trails/reviews/:trail_id/photos` | Add a photo to your review (JPEG, PNG or WebP, base64; its location and camera data are removed) | `trails:write` |
| GET | `/v1/trails/routes` | Your planned routes, newest first | `trails:read` |
| POST | `/v1/trails/routes` | Save a planned route (the line is made from the points) | `trails:write` |
| DELETE | `/v1/trails/routes/:id` | Delete a planned route (its link stops working) | `trails:write` |
| GET | `/v1/trails/routes/:id` | One of your planned routes, with its line and profile | `trails:read` |
| PATCH | `/v1/trails/routes/:id` | Rename a planned route, change its points, or share it by link | `trails:write` |
| GET | `/v1/trails/routes/:id/gpx` | A planned route as a GPX file | `trails:read` |
| DELETE | `/v1/trails/saved/:trail_id` | Take a trail off a list (or off all your lists) | `trails:write` |
| GET | `/v1/trails/saved/:trail_id` | Which of your lists hold a trail | `trails:read` |
| PUT | `/v1/trails/saved/:trail_id` | Save a trail to a list (Want to go, unless you name one) | `trails:write` |
| GET | `/v1/trails/setup` | Your first steps and which are done | `trails:read` |
| GET | `/v1/trails/team` | Your team: each member, their role and what they may do | `members:read` |
| PUT | `/v1/trails/team/:user_id` | Set what a team member may do: a role, or abilities one by one. Only an owner gives or takes settings access (web app only) | `members:write` |
| POST | `/v1/trails/team/invite` | Invite someone to the team by email with a role, which they get when they accept (owners only) (web app only) | `members:write` |

## Examples

### GET /v1/data/activities/$TOKEN

A shared activity (its start, end and privacy zones left out). No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/activities/$TOKEN"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/activities/${token}`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/commons/$ID

A Wikimedia Commons photo near a trail (credit it as the trail's commons_photos say). No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/commons/$ID"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/commons/${id}`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/lists/$TOKEN

A list of trails someone shared by link. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/lists/$TOKEN"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/lists/${token}`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/live/$TOKEN

A live location someone shared with you. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/live/$TOKEN"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/live/${token}`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/photos/$KEY

A published trail photo. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/photos/$KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/photos/${key}`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/places

Towns, ZIP codes and parks whose name starts with what was typed ("boulder", "maplewood, nj", "07040", "rocky mountain"), with where to move the map (a park's box); `go` is the one place a state or ZIP code made certain. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/places"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/places`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/routes/$TOKEN

A planned route someone shared by link. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/routes/$TOKEN"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/routes/${token}`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/states

The states with trails, and how many each has. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/states"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/states`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/states/$STATE/download

Every trail in a state as one GeoJSON file, under the Open Database License. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/states/$STATE/download"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/states/${state}/download`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/states/$STATE/index

Every trail in a state: its address, name and when it changed (for the public site's pages and sitemaps). No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/states/$STATE/index"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/states/${state}/index`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/trails

Trails in a map area, by name, or near a point, with filters for difficulty, length, climb, activity, route type and dogs. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/trails"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/trails`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/trails/$ID

One trail: its line, elevation profile, length, climb, estimated difficulty and time, trailhead, what is along it, sources and nearby trails. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/trails/$ID"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/trails/${id}`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/trails/$ID/commons

Free-license photos from Wikimedia Commons taken near a trail, each with its credit. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/trails/$ID/commons"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/trails/${id}/commons`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/trails/$ID/gpx

A trail's line as a GPX file, for a GPS or another app. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/trails/$ID/gpx"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/trails/${id}/gpx`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/trails/$ID/reviews

A trail's published reviews, photos and recent conditions, with its average rating. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/trails/$ID/reviews"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/trails/${id}/reviews`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/trails/$ID/weather

The forecast and active alerts at a trail's trailhead (or its middle), from the National Weather Service. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/trails/$ID/weather"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/trails/${id}/weather`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/data/trails/ids

Only the ids of the trails in a map area that the same filters as the list keep, so the map draws only those lines. No sign-in, so it sends no key.

```bash
curl -s "https://api.tarnpath.com/v1/data/trails/ids"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/data/trails/ids`, {
  method: "GET",
});
const data = await res.json();
```

### GET /v1/trails/activities

Your recorded and imported activities, newest first

```bash
curl -s "https://api.tarnpath.com/v1/trails/activities" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/activities

Save a recorded activity (the track packed by the app); safe to retry with the same client_id

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/activities" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/trails/activities/$ID

Delete an activity for good

```bash
curl -s -X DELETE "https://api.tarnpath.com/v1/trails/activities/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/activities/$ID

One activity: its line, elevation and numbers

```bash
curl -s "https://api.tarnpath.com/v1/trails/activities/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### PATCH /v1/trails/activities/$ID

Rename an activity, change its kind, or share it (private, anyone with the link, or public)

```bash
curl -s -X PATCH "https://api.tarnpath.com/v1/trails/activities/$ID" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities/${id}`, {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/activities/$ID/export

An activity as GeoJSON (for maps) or CSV (a row a point, for a spreadsheet)

```bash
curl -s "https://api.tarnpath.com/v1/trails/activities/$ID/export" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities/${id}/export`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/activities/$ID/gpx

An activity as a GPX file, every point (it's yours)

```bash
curl -s "https://api.tarnpath.com/v1/trails/activities/$ID/gpx" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities/${id}/gpx`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/activities/import

Import an activity from a GPX file's text or a FIT file (base64), as watches and other apps export them

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/activities/import" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/activities/import`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/lists

Your saved lists, with how many trails each holds

```bash
curl -s "https://api.tarnpath.com/v1/trails/lists" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/lists`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/lists

Make a new list

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/lists" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/lists`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/trails/lists/$ID

Delete a list (the trails stay on the map)

```bash
curl -s -X DELETE "https://api.tarnpath.com/v1/trails/lists/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/lists/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/lists/$ID

One list and its trails (yours, or one shared with your account)

```bash
curl -s "https://api.tarnpath.com/v1/trails/lists/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/lists/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### PATCH /v1/trails/lists/$ID

Rename a list, share it by link, or share it with everyone in your account

```bash
curl -s -X PATCH "https://api.tarnpath.com/v1/trails/lists/$ID" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/lists/${id}`, {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### PUT /v1/trails/lists/order

Put your lists in this order (Want to go stays first)

```bash
curl -s -X PUT "https://api.tarnpath.com/v1/trails/lists/order" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/lists/order`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/live

Your live shares, newest first

```bash
curl -s "https://api.tarnpath.com/v1/trails/live" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/live`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/live

Start sharing where you are (a link you send yourself; optional due-back time and up to 3 email contacts)

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/live" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/live`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### PATCH /v1/trails/live/$ID

Change a running share's due-back time or contacts (the link stays the same)

```bash
curl -s -X PATCH "https://api.tarnpath.com/v1/trails/live/$ID" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/live/${id}`, {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/trails/live/$ID/end

End a live share (I'm back): the link stops showing where you are

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/live/$ID/end" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/live/${id}/end`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### PUT /v1/trails/live/$ID/position

Where you are now, for a running share (only the latest is kept)

```bash
curl -s -X PUT "https://api.tarnpath.com/v1/trails/live/$ID/position" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/live/${id}/position`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/photos/$KEY

One of your photos, published or not

```bash
curl -s "https://api.tarnpath.com/v1/trails/photos/$KEY" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/photos/${key}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/plan

A route through points, along the trails between them where it can (a preview: nothing is saved)

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/plan" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/plan`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/plus

Which Plus features your account has (all, until paid plans open)

```bash
curl -s "https://api.tarnpath.com/v1/trails/plus" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/plus`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/privacy-zones

Your privacy zones

```bash
curl -s "https://api.tarnpath.com/v1/trails/privacy-zones" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/privacy-zones`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/privacy-zones

Add a privacy zone (a circle 200 m to 1.6 km across the middle of it)

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/privacy-zones" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/privacy-zones`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/trails/privacy-zones/$ID

Remove a privacy zone

```bash
curl -s -X DELETE "https://api.tarnpath.com/v1/trails/privacy-zones/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/privacy-zones/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/reports

Report a review, photo or condition to our moderators

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/reports" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/reports`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/trails/review-photos/$ID

Delete one of your photos

```bash
curl -s -X DELETE "https://api.tarnpath.com/v1/trails/review-photos/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/review-photos/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### DELETE /v1/trails/reviews/$TRAIL_ID

Delete your review of a trail, with its photos

```bash
curl -s -X DELETE "https://api.tarnpath.com/v1/trails/reviews/$TRAIL_ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/reviews/${trail_id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/reviews/$TRAIL_ID

Your review of a trail, whatever its status (null when you haven't written one)

```bash
curl -s "https://api.tarnpath.com/v1/trails/reviews/$TRAIL_ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/reviews/${trail_id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### PUT /v1/trails/reviews/$TRAIL_ID

Write or change your review of a trail (stars, words, when you went, and what it was like)

```bash
curl -s -X PUT "https://api.tarnpath.com/v1/trails/reviews/$TRAIL_ID" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/reviews/${trail_id}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### POST /v1/trails/reviews/$TRAIL_ID/photos

Add a photo to your review (JPEG, PNG or WebP, base64; its location and camera data are removed)

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/reviews/$TRAIL_ID/photos" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/reviews/${trail_id}/photos`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/routes

Your planned routes, newest first

```bash
curl -s "https://api.tarnpath.com/v1/trails/routes" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/routes`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### POST /v1/trails/routes

Save a planned route (the line is made from the points)

```bash
curl -s -X POST "https://api.tarnpath.com/v1/trails/routes" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/routes`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### DELETE /v1/trails/routes/$ID

Delete a planned route (its link stops working)

```bash
curl -s -X DELETE "https://api.tarnpath.com/v1/trails/routes/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/routes/${id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/routes/$ID

One of your planned routes, with its line and profile

```bash
curl -s "https://api.tarnpath.com/v1/trails/routes/$ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/routes/${id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### PATCH /v1/trails/routes/$ID

Rename a planned route, change its points, or share it by link

```bash
curl -s -X PATCH "https://api.tarnpath.com/v1/trails/routes/$ID" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/routes/${id}`, {
  method: "PATCH",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/routes/$ID/gpx

A planned route as a GPX file

```bash
curl -s "https://api.tarnpath.com/v1/trails/routes/$ID/gpx" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/routes/${id}/gpx`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### DELETE /v1/trails/saved/$TRAIL_ID

Take a trail off a list (or off all your lists)

```bash
curl -s -X DELETE "https://api.tarnpath.com/v1/trails/saved/$TRAIL_ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/saved/${trail_id}`, {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/saved/$TRAIL_ID

Which of your lists hold a trail

```bash
curl -s "https://api.tarnpath.com/v1/trails/saved/$TRAIL_ID" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/saved/${trail_id}`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### PUT /v1/trails/saved/$TRAIL_ID

Save a trail to a list (Want to go, unless you name one)

```bash
curl -s -X PUT "https://api.tarnpath.com/v1/trails/saved/$TRAIL_ID" \
  -H "Authorization: Bearer $TR_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/saved/${trail_id}`, {
  method: "PUT",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();
```

### GET /v1/trails/setup

Your first steps and which are done

```bash
curl -s "https://api.tarnpath.com/v1/trails/setup" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/setup`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

### GET /v1/trails/team

Your team: each member, their role and what they may do

```bash
curl -s "https://api.tarnpath.com/v1/trails/team" \
  -H "Authorization: Bearer $TR_API_KEY"
```

```js
const res = await fetch(`https://api.tarnpath.com/v1/trails/team`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.TR_API_KEY}` },
});
const data = await res.json();
```

Request and response schemas: [https://www.tarnpath.com/openapi.json](https://www.tarnpath.com/openapi.json). All resources: [API reference](https://www.tarnpath.com/docs/api).
