---
title: "Create a route"
method: POST
path: "/v1/vehicles/{vehicleId}/routes/{name}"
tags: ["Route Management"]
---

# Create a route

`POST /v1/vehicles/{vehicleId}/routes/{name}`

## Request

- Base URL: `https://api.polymathrobotics.dev`
- URL: `https://api.polymathrobotics.dev/v1/vehicles/{vehicleId}/routes/{name}`
- Auth: HTTP bearer

Creates a new route. The route is validated and written as a single whole artifact.

## Path parameters

- `vehicleId` string, required
- `name` string, required

## Request body

- WriteRouteGraphRequest: Base for request bodies: unknown fields are rejected instead of silently dropped.
  - `nodes` RouteNode[], required: Nodes that make up the route.
    - `id` integer, required: 16-bit unique identifier of the node within this route graph, which can also be used to send a navigation goal later.
    - `coordinate_system` 0 | 1: An enumeration.
    - `wgs84_position` GeoPoint: Base for request bodies: unknown fields are rejected instead of silently dropped.
      - `lat` number, required: Latitude
      - `lon` number, required: Longitude
      - `altitude` number: Altitude (meters)
      - `yaw` number: Yaw (radians). Robot body frame: x forward, y left, z up; positive yaw is counter-clockwise.
    - `map_position` MapPoint: Base for request bodies: unknown fields are rejected instead of silently dropped.
      - `x` number, required: X position in the map frame (meters).
      - `y` number, required: Y position in the map frame (meters).
    - `name` string: Optional human-readable name for the node, which can be used to send a navigation goal later.
  - `edges` RouteEdge[], required: Edges connecting the nodes, referencing node IDs via from_node_id/to_node_id.
    - `from_node_id` integer, required: ID of the node this edge starts from.
    - `to_node_id` integer, required: ID of the node this edge ends at.
    - `id` integer, required: 16-bit unique identifier of this edge.
    - `cost` integer: Cost/penalty of traversing this edge.

## Response `201`

Confirmation that the route was created or updated.

- WriteRouteGraphResponse
  - `status` 'success', required: JSend status.
  - `message` string, required: Human-readable message, propagated from the ROS service.

## Other responses

- `400`: Route failed server-side validation
- `409`: A route with this name already exists
- `422`: Request body failed validation
- `500`: Internal server error

## Changes

- **2026-09-09** `7bb062ddb622`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/polymathrobotics/apis/polymath-api/changes/v1/vehicles/:vehicleId/routes/:name/post.md)

---

[API](https://skmtc.dev/polymathrobotics/apis/polymath-api.md) - [All operations](https://skmtc.dev/polymathrobotics/apis/polymath-api/llms.txt) - [OpenAPI document](https://skmtc.dev/polymathrobotics/apis/polymath-api/revisions/3b5ff2f21338?raw)
