> ## Documentation Index
> Fetch the complete documentation index at: https://docs.justrouting.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Solve the traveling salesman problem for the given coordinates



## OpenAPI

````yaml /openapi/osrm.json get /trip/v1/{profile}/{coordinates}
openapi: 3.1.0
info:
  title: JustRouting OSRM API
  version: v1
  description: >-
    OSRM-compatible routing services hosted by JustRouting: route, table, match,
    trip, and nearest. All requests require a Bearer API key. Coordinates use
    `lng,lat` order and must be within a single country (Southeast Asia).
  contact:
    email: hello@justrouting.tech
    name: JustRouting
    url: https://justrouting.tech
servers:
  - url: https://api.justrouting.tech
    description: Production
security:
  - bearerAuth: []
tags:
  - name: route
    description: Directions between coordinates
  - name: table
    description: N×N travel time/distance matrix
  - name: match
    description: Map matching for GPS traces
  - name: trip
    description: Traveling salesman optimization
  - name: nearest
    description: Snap a coordinate to the road network
paths:
  /trip/v1/{profile}/{coordinates}:
    get:
      tags:
        - trip
      summary: Solve the traveling salesman problem for the given coordinates
      operationId: getTrip
      parameters:
        - name: profile
          in: path
          required: true
          schema:
            type: string
            enum:
              - driving
              - motorcycle
        - name: coordinates
          in: path
          required: true
          schema:
            type: string
        - name: roundtrip
          in: query
          schema:
            type: boolean
            default: true
        - name: source
          in: query
          schema:
            type: string
            enum:
              - any
              - first
            default: any
        - name: destination
          in: query
          schema:
            type: string
            enum:
              - any
              - last
            default: any
        - $ref: '#/components/parameters/Steps'
        - $ref: '#/components/parameters/Geometries'
        - $ref: '#/components/parameters/Overview'
      responses:
        '200':
          description: Trip found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TripResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OsrmError'
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
components:
  parameters:
    Steps:
      name: steps
      in: query
      schema:
        type: boolean
        default: false
      description: Return turn-by-turn steps.
    Geometries:
      name: geometries
      in: query
      schema:
        type: string
        enum:
          - polyline
          - polyline6
          - geojson
        default: polyline
      description: Geometry encoding of the response.
    Overview:
      name: overview
      in: query
      schema:
        type: string
        enum:
          - full
          - simplified
          - 'false'
        default: simplified
      description: How much route geometry to return.
  schemas:
    TripResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - Ok
        waypoints:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/Waypoint'
              - type: object
                properties:
                  trips_index:
                    type: integer
                  waypoint_index:
                    type: integer
        trips:
          type: array
          items:
            $ref: '#/components/schemas/Route'
    OsrmError:
      type: object
      properties:
        code:
          type: string
          enum:
            - InvalidUrl
            - InvalidService
            - InvalidVersion
            - InvalidOptions
            - InvalidQuery
            - InvalidValue
            - NoSegment
            - NoRoute
            - NoTable
            - NoMatch
            - NoTrips
            - TooBig
            - DisabledDataset
        message:
          type: string
    AuthError:
      type: object
      properties:
        code:
          type: string
          enum:
            - missing_auth
            - invalid_api_key
        message:
          type: string
    RateLimitError:
      type: object
      properties:
        code:
          type: string
          enum:
            - rate_limited
        message:
          type: string
    Waypoint:
      type: object
      properties:
        name:
          type: string
          description: Street name the coordinate snapped to.
        location:
          type: array
          items:
            type: number
          minItems: 2
          maxItems: 2
          description: Snapped position as `[lng, lat]`.
        distance:
          type: number
          description: Snapping offset in meters.
        hint:
          type: string
          description: Opaque segment identifier, reusable as the `hints` parameter.
        nodes:
          type: array
          items:
            type: integer
          description: OSM node ids of the segment.
    Route:
      type: object
      properties:
        distance:
          type: number
          description: Total distance in meters.
        duration:
          type: number
          description: Total duration in seconds.
        weight:
          type: number
        weight_name:
          type: string
          example: routability
        geometry:
          oneOf:
            - type: string
              description: Encoded polyline (precision 5 or 6).
            - type: object
              description: GeoJSON LineString when geometries=geojson.
              required:
                - type
                - coordinates
              properties:
                type:
                  type: string
                  enum:
                    - LineString
                coordinates:
                  type: array
                  items:
                    type: array
                    items:
                      type: number
        legs:
          type: array
          items:
            $ref: '#/components/schemas/RouteLeg'
    RouteLeg:
      type: object
      properties:
        distance:
          type: number
          description: Meters.
        duration:
          type: number
          description: Seconds.
        weight:
          type: number
        summary:
          type: string
        steps:
          type: array
          items:
            $ref: '#/components/schemas/RouteStep'
        annotation:
          $ref: '#/components/schemas/Annotation'
    RouteStep:
      type: object
      properties:
        distance:
          type: number
          description: Meters.
        duration:
          type: number
          description: Seconds.
        geometry:
          type: string
          description: Polyline geometry.
        name:
          type: string
        ref:
          type: string
        mode:
          type: string
        maneuver:
          $ref: '#/components/schemas/StepManeuver'
    Annotation:
      type: object
      properties:
        distance:
          type: array
          items:
            type: number
        duration:
          type: array
          items:
            type: number
        speed:
          type: array
          items:
            type: number
        nodes:
          type: array
          items:
            type: integer
    StepManeuver:
      type: object
      properties:
        location:
          type: array
          items:
            type: number
          description: '[lng, lat]'
        bearing_before:
          type: integer
        bearing_after:
          type: integer
        type:
          type: string
          description: >-
            turn, depart, arrive, merge, on ramp, off ramp, roundabout, fork,
            continue, ...
        modifier:
          type: string
          enum:
            - uturn
            - sharp right
            - right
            - slight right
            - straight
            - slight left
            - left
            - sharp left
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key created in the JustRouting dashboard.

````