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

# Distribute Jobs

> You can distribute multiple jobs, e.g. 100 jobs, into a few regions/clusters, e.g. 10 clusters.

This API endpoint is designed to distribute a set of jobs across specified regions or clusters.

### REQUEST

```shell theme={null}
POST https://api.hellotracks.com/api/distributejobs

{
	data: {
		jobs:  [
			"<job_id_1>",
			"<job_id_2>",
			   ...
			"<job_id_n>"
		],
		"regions": 5,
		"max": 10,
		"method": "distance"
	}
}
```

**jobs** `array` *required*

Array of job ids.

**regions** `number` *required*

Number of regions/clusters to split all jobs ids into.

**max** `number` (default: 28)

The maximum number of jobs per cluster.

**method** `string` (default: distance)

Assignment method: `distance`, `zones`, or `size`.

### RESPONSE

```shell theme={null}
{
	"status": 0,
	"clusters": [
			{
				"id": <number>,
				"name": "Cluster 1",
				"center_lat": <latitude>,
				"center_lng": <longitude>,
				"jobs": ["<job_id>",...,"<job_id>"]
			},
			...
			{ ... }
	]
}
```

**status** `number`

Status code. `0` indicates success.

**clusters** `array`

An array of cluster objects, each containing:

* `id` (number): Unique cluster identifier
* `name` (string): Cluster name (e.g., "Cluster 1", "Cluster 2")
* `center_lat` (double): Latitude of cluster center point
* `center_lng` (double): Longitude of cluster center point
* `jobs` (array): Array of job IDs assigned to this cluster

### Usage Notes

* The clustering algorithm groups jobs geographically to minimize travel distance within each cluster
* The `max` parameter prevents any single cluster from becoming too large
* Empty clusters may be returned if the number of jobs is less than the requested regions
* The algorithm uses the company location as the initial center point for all clusters


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.