# Create a custom waypoint

Creates a custom waypoint by grouping provided jobs together

Endpoint: POST /v1/tours/{tourId}/custom-waypoints
Version: 1.0.0
Security: ApiKeyAuth

## Security:

  - `ApiKeyAuth` (unknown)
    apiKey in header x-api-key

## Path parameters:

  - `tourId` (string, required)
    Unique tour identifier (generated by Better Route backend)

## Request fields (application/json):

  - `jobIds` (any)
    IDs of the jobs to be added under the custom waypoint

  - `jobIds.internalIds` (array, required)
    A list of internal Job IDs assigned by Bettermile

  - `jobIds.externalIds` (array, required)
    A list of external Job IDs assigned by the tenant

  - `address` (any)
    Specifies address to be used for the custom waypoint. If omitted or explicitly null, the address is inherited from the jobs assigned to this waypoint.

  - `address.street` (string)
    Street

  - `address.streetNumber` (string)
    Street number

  - `address.locality` (string)
    City, town, village etc

  - `address.subLocality` (string)
    Subdivision of city, district etc

  - `address.postalCode` (string)
    Postal/zip code

  - `address.country` (string)
    Country as "alpha-2 code" of ISO 3166 (https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)

  - `address.streetCoordinates` (any)

  - `address.streetCoordinates.lat` (number)
    Latitude

  - `address.streetCoordinates.lon` (number)
    Longitude

  - `address.rooftopCoordinates` (any)

## Request examples:

  - `Group jobs by Bettermile-internal job IDs` (unknown)

  - `Group jobs by tenant-provided external job IDs, with an explicit address` (unknown)

## Response 200:

  - `200` (unknown)
    Successfully created a custom waypoint

## Response 200 fields (application/json):

  - `waypointId` (string)
    Internal ID of the created custom waypoint

## Response 400:

  - `400` (unknown)
    Error response returned when the request is invalid. In most cases this implies that some data in the request is either missing or has incorrect format.

## Response 400 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 401:

  - `401` (unknown)
    Error response returned when the provided API key is missing or invalid

## Response 401 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 404:

  - `404` (unknown)
    Error response returned in cases the requested endpoint or data can't be found

## Response 404 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 429:

  - `429` (unknown)
    Error response returned in case operation encounter rate limit

## Response 429 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

## Response 500:

  - `500` (unknown)
    Error response returned whenever the server fails to process the request

## Response 500 fields (application/json):

  - `error` (object)
    Error response

  - `error.status` (integer)
    HTTP error status
    Example: 400

  - `error.message` (string)
    Human readable error message
    Example: 'depot' field can't be null

  - `error.errorCode` (string)
    Machine-friendly error message containing only alphanumeric characters and '.'
    Example: tour.list.fetch.failed.bad.request

  - `error.details` (array)

