> ## 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.

# Create Jobs

> Create one or multiple jobs.

### Request

```shell theme={null}
POST https://api.hellotracks.com/api/createjobs
{
	data: {
		jobs: [
			 job_1,
			 job_2,
			   ...
			 job_n
		 ],
		 sendRouteChange: <boolean>,
		 autoassign: <boolean>,
		 isTemplate: <boolean>
	}
}
```

> [!NOTE]
>
> See also [Job-API-Object](https://api-docs.hellotracks.com/api-reference/job-object.md) to see properties of a job.

> [!NOTE]
>
> To directly assign a user, set the `worker` property in the job to the worker's username. To get
> the worker's username, retrieve the `username` in [Member-API-Object](https://api-docs.hellotracks.com/api-reference/member-object.md), for
> example via `/getaccounts`.

```bash Example Request theme={null}
curl -X POST https://api.hellotracks.com/api/createjobs \
--header 'API-Key: ...' -d \
'
{
    "data": {
        "jobs": [
            {
                "destinationLat": 37.7749,
                "destinationLng": -122.4194,
                "destinationName": "Job in San Francisco created via API",
                "worker": "username@example.com",
                "day": 20231110
            }
        ]
    }
}
'
```

**jobs** `array` *required*

An array of objects, each object needs to confirm the Job API Object schema.

**Important Notes:**

* Do not set the `id` field, this will be set automatically upon creation.
* You can optionally set the `uidSecondary` field as a custom external identifier. If a job with the same `uidSecondary` already exists for the company, the existing job will be updated instead of creating a new one.
* To assign a job during creation, set the `worker` field to the worker's username or set `receiverUid` to the worker's UID.
* For custom job fields, use either `customFields` as an array of `{ "key": "...", "val": "..." }` objects, or use `custom_<fieldName>` for single fields.

**sendRouteChange** `boolean` (default: false)

If true, assigned and day set to today, notifies assignee immediately of jobs being updated. The list
of jobs will be updated automatically on their device.

**autoassign** `boolean` (default: false)

Indicates that the created jobs should automatically be assigned to a member.
It will choose the nearest member that is available, taking the shift and day-route into account.

**isTemplate** `boolean` (default: false)

If set to `true`, creates jobs as templates rather than regular jobs. Job templates can be reused to create multiple jobs with the same configuration.

### Custom Fields in `jobs`

Inside each job object, custom fields can be sent in the following format:

* `customFields` array (recommended for multiple fields):

```json theme={null}
"customFields": [
  { "key": "PO_Number", "val": "PO-2026-1234" },
  { "key": "Department", "val": "Facilities" }
]
```

```bash Example Request (with customFields) theme={null}
curl -X POST https://api.hellotracks.com/api/createjobs \
--header 'API-Key: ...' -d \
'
{
    "data": {
        "jobs": [
            {
                "destinationName": "Create job with custom fields",
                "day": 20260224,
                "customFields": [
                    { "key": "PO_Number", "val": "PO-2026-1234" },
                    { "key": "Department", "val": "Facilities" }
                ]
            }
        ]
    }
}
'
```

### Response

```shell theme={null}
{
	status: 0,
	jobs : [
		job_1,
		job_2,
		...
	    job_n
	]
}
```

**status** `number` *required*

Guaranteed to be set. Set to `0` if successful.

**jobs** `array` *required*

The array of all jobs created by this request.

```bash Example Request theme={null}
curl -X POST https://api.hellotracks.com/api/createjobs --header 'API-Key: ...' -d '
{
    "data": {
        "jobs": [
            {
                "destinationLat": 37.7749,
                "destinationLng": -122.4194,
                "destinationName": "This is a new job in San Francisco created via API"
            }
        ]
    }
}
'
```

<Snippet file="jobs-response.mdx" />


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