# Solve a clustering problem

The Cluster endpoint is used with a POST request towards
https://graphhopper.com/api/1/cluster?key=. The solution will be provided in the JSON response.
Please note that for problems that take longer than 10 seconds a bad request error is returned.
In this case please use the asynchronous Batch Cluster Endpoint instead.

Endpoint: POST /cluster
Version: 1.0.0
Security: key

## Request fields (application/json):

  - `configuration` (object)

  - `configuration.response_type` (string)
    Specifies the response format. You can either choose geojson or json.
    Example: "json"

  - `configuration.routing` (object)

  - `configuration.routing.profile` (string)
    The routing profile. It determines the network, speed and other physical attributes used when computing the route. See the section about [routing profiles](#tag/Map-Data-and-Routing-Profiles) for more details and valid profile values.

  - `configuration.routing.cost_per_second` (number)
    Cost per second (travel time)
    Example: 1

  - `configuration.routing.cost_per_meter` (number)
    Cost per meter (travel distance)

  - `configuration.clustering` (object)

  - `configuration.clustering.num_clusters` (number)
    Specifies the number of clusters
    Example: 10

  - `configuration.clustering.max_quantity` (number)
    Specifies max. quantity in a cluster
    Example: 50

  - `configuration.clustering.min_quantity` (number)
    Specifies min. quantity in a cluster
    Example: 30

  - `clusters` (array)

  - `clusters.name` (string)
    id of customer
    Example: "GraphHopper GmbH"

  - `clusters.center` (object)

  - `clusters.center.lon` (number)
    Longitude
    Example: 11.53941

  - `clusters.center.lat` (number)
    Latitude
    Example: 48.118434

  - `clusters.center.street_hint` (string)
    Optional parameter. Provide a hint that includes only the street name for each address to better snap the coordinates (lon,lat) to road network. E.g. if there is an address or house with two or more neighboring streets you can control for which street the closest location is looked up.
    Example: "Lindenschmitstraße 52"

  - `clusters.min_quantity` (number)
    Specifies min. quantity of this cluster
    Example: 10

  - `clusters.max_quantity` (number)
    Specifies max. quantity of this cluster
    Example: 10

  - `customers` (array)

  - `customers.id` (string)
    id of customer
    Example: "GraphHopper GmbH"

  - `customers.address` (object)

  - `customers.quantity` (number)
    demand of customer
    Example: 10

## Response 200 fields (application/json):

  - `copyrights` (array)
    Example: ["GraphHopper","OpenStreetMap contributors"]

  - `status` (string)
    Indicates the current status of the job
    Enum: "waiting_in_queue", "processing", "finished"

  - `waiting_time_in_queue` (number)

  - `processing_time` (number)
    Example: 4900

  - `clusters` (array)

  - `clusters.quantity` (number)
    Cluster size
    Example: 40

  - `clusters.ids` (array)
    Array of customer ids assigned to this specific cluster
    Example: ["GraphHopper GmbH"]

## Response 400 fields (application/json):

  - `message` (string)
    Short error message
    Example: "Bad Request"

  - `hints` (array)
    Optional error information.

  - `hints.message` (string)
    error message
    Example: "unsupported json property [vehiles]. allowed properties: [vehicles, vehicle_types, services, shipments, relations, algorithm, objectives, cost_matrices, configuration]"

  - `hints.details` (string)
    Details
    Example: "class java.lang.IllegalArgumentException"

  - `status` (string)
    status
    Example: "finished"

## Response 500 fields (application/json):

  - `code` (integer)
    Example: 500

  - `message` (string)
    Details
    Example: "There has been an internal server error."


