# set_route_facilities

Replace the places a route uses.

`PUT /v1/routes/{routeId}/facilities` · MCP tool `set_route_facilities` · scope `write` · stable · since 2026-09-17

Full replacement: [{ facilityId, order }].

## Path parameters

- `routeId` (string, required): Id of the route.

## Body parameters

- `facilities` (array of objects, required): Ordered [{ facilityId, order }], at most 50.
  - `facilityId` (string, required): A place of this guide (from list_facilities), listed once.
  - `order` (number, required): The place's position on the route (ascending, any number).

## Returns

200.

- `ok` (boolean, required): Always true: the write went through. Always `true`.
- `routeId` (string, required): The route's id.
- `edges` (number, required): How many links the list now holds.

## Examples

### Link the trailhead parking to the trail

```bash
curl -X PUT "https://sceniq.earth/api/v1/routes/kx7f2h8j4k0k6z2x8c4v0b6n2m8q4w0e/facilities" \
  -H "Authorization: Bearer $SCENIQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "facilities": [
    {
      "facilityId": "km7d4f6g8h0j2k4k6z8x0c2v4b6n8m0q",
      "order": 1024
    }
  ]
}'
```

MCP `tools/call`:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "set_route_facilities",
    "arguments": {
      "routeId": "kx7f2h8j4k0k6z2x8c4v0b6n2m8q4w0e",
      "facilities": [
        {
          "facilityId": "km7d4f6g8h0j2k4k6z8x0c2v4b6n8m0q",
          "order": 1024
        }
      ]
    }
  }
}
```

Response 200:

```json
{
  "ok": true,
  "routeId": "kx7f2h8j4k0k6z2x8c4v0b6n2m8q4w0e",
  "edges": 1
}
```

## 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/set_route_facilities
