# update_hike

Edit a hike.

`PATCH /v1/hikes/{hikeId}` · MCP tool `update_hike` · scope `write` · beta · since 2026-10-06.8

Only sent fields change. Strings clear on empty string; the difficulty, the figures, the gear list and the line clear on null; arrays are full replacements.

## Path parameters

- `hikeId` (string, required): Id of the hike (from list_hikes).

## Body parameters

- `descentM` (number or null, optional): Descent in meters, 0 or more. Never derived from gainM: give it when the source does. null clears.
- `description` (string, optional): The hike in the creator's words, shown on the hike card. Empty string clears.
- `difficulty` (string or null, optional): One of four words: easy, moderate, hard or expert. Buyers read it before the grade (Moderate · T2), and the easiest hike of a spot fills its Accessibility. null clears. One of `easy`, `moderate`, `hard`, `expert`.
- `distanceKm` (number or null, optional): Distance in kilometers, 0 or more. null clears.
- `durationMin` (number or null, optional): Walking time in minutes, 0 or more, as the creator or the trail page gives it. null clears.
- `equipment` (array of strings or null, optional): Gear, full replacement, at most 50 items; [] means explicitly no special gear (shown as None), null clears back to unknown.
- `gainM` (number or null, optional): Elevation gain in meters, 0 or more. null clears.
- `grade` (string, optional): The technical grade as the creator or the trail page writes it, at most 24 characters: T2 (SAC hiking), K3 (via ferrata), Class 3 (US), EE (Italy). Optional; empty string clears.
- `name` (string, optional): Hike name, e.g. Oeschinensee panorama loop or Fairy Falls trail. Without one the apps show Hike from <start>, or Hike N when there is no start either. Empty string clears.
- `sources` (array of strings, optional): Where the facts come from, full replacement ([] clears), at most 25 entries: links to official trail pages or plain text (the creator's GPX). Buyers see them under Sources, links by their host.
- `start` (string, optional): Trailhead or starting point in words. Empty string clears.
- `startMapsUrl` (string, optional): Map link to the trailhead: https on Google Maps, Apple Maps, Swisstopo, OpenStreetMap or SchweizMobil, or a geo: URI. Empty string clears.
- `track` (HikeTrack or null, optional): The hike's line (see create_hike), replaced whole; null removes it.
  Fields of HikeTrack: https://developers.sceniq.earth/fields/hike-track.md
- `transit` (array of TransitNote, optional): Transit notes shown under Transit on the hike card, full replacement ([] clears), at most 20: [{ mode: train|bus|cable_car|car|boat|ferry|plane, note }]. Rows with an empty note are dropped.
  Fields of TransitNote: https://developers.sceniq.earth/fields/transit-note.md

## Returns

200.

- `ok` (boolean, required): Always true: the write went through. Always `true`.
- `hikeId` (string, required): The hike's id.

## Examples

### Correct the figures after a second recording

```bash
curl -X PATCH "https://sceniq.earth/api/v1/hikes/kx7q3e5s7c9h1n3m5e7r9s1t3v5w7y9a" \
  -H "Authorization: Bearer $SCENIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "durationMin": 180,
  "gainM": 450,
  "descentM": 450
}'
```

MCP `tools/call`:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "update_hike",
    "arguments": {
      "hikeId": "kx7q3e5s7c9h1n3m5e7r9s1t3v5w7y9a",
      "durationMin": 180,
      "gainM": 450,
      "descentM": 450
    }
  }
}
```

Response 200:

```json
{
  "ok": true,
  "hikeId": "kx7q3e5s7c9h1n3m5e7r9s1t3v5w7y9a"
}
```

### Remove the line and the gain (null clears) and the grade (empty string clears)

```bash
curl -X PATCH "https://sceniq.earth/api/v1/hikes/kx7f2h8j4k0k6z2x8c4v0b6n2m8q4w0e" \
  -H "Authorization: Bearer $SCENIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "track": null,
  "gainM": null,
  "descentM": null,
  "grade": ""
}'
```

MCP `tools/call`:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "update_hike",
    "arguments": {
      "hikeId": "kx7f2h8j4k0k6z2x8c4v0b6n2m8q4w0e",
      "track": null,
      "gainM": null,
      "descentM": null,
      "grade": ""
    }
  }
}
```

Response 200:

```json
{
  "ok": true,
  "hikeId": "kx7f2h8j4k0k6z2x8c4v0b6n2m8q4w0e"
}
```

## Errors

- `invalid_argument` (400): A required field is missing, a field is unknown, or a value does not match its type (the Convex validator's path and value are in the message).
- `invalid_request` (400): A writer refused a value: a map link on a host that is not allowed, a title that is too long, a date that does not exist, too many items in a list. The message is the writer's own sentence.
- `unauthenticated` (401): The request carries no key. Send it as Authorization: Bearer sk_sceniq_... (or X-Api-Key).
- `invalid_api_key` (401): The key is unknown, revoked or expired.
- `api_scope_required` (403): A read-only key called a write operation, or a key without the publish option called publish_changes.
- `forbidden` (403): The key belongs to a creator account that is no longer active.
- `not_found` (404): The id does not exist or belongs to another creator. The two answers are identical on purpose, so ids never reveal what exists.
- `payload_too_large` (413): A JSON body over 2 MB, an image over 6 MB, a batch upload over 19 MB, or an MCP message over 2 MB.
- `rate_limited` (429): Over a limit: requests per key per minute, per creator per hour, uploads per key per minute, or check_links per guide per hour.
- `internal_error` (500): An unexpected failure. The message is hidden on purpose.

Reference: https://developers.sceniq.earth/reference/update_hike
