---
updatedAt: 2026-04-20T19:02:53.000Z
agentTools:
  projectIndex: https://docs.onfleet.com/llms.txt
---

# Create team

## Create team

| Name                 | Type         | Description                                                                                                                                                                                                                                                                                  |
| :------------------- | :----------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                 | string       | A unique name for the team.                                                                                                                                                                                                                                                                  |
| workers              | string array | An array of worker IDs.                                                                                                                                                                                                                                                                      |
| managers             | string array | An array of managing administrator IDs.                                                                                                                                                                                                                                                      |
| hub                  | string       | Optional. The ID of the team's hub.                                                                                                                                                                                                                                                          |
| enableSelfAssignment | boolean      | Optional.  Defaults false if not included.  This toggles [Team Self-Assignment](https://support.onfleet.com/hc/en-us/articles/360042126671-Self-Assignment-BETA-#h_239791c4-4470-479f-9dd4-dac53a843ad8) that allows Drivers to Self Assign Tasks that are in the Team unassigned container. |

```shell Request
curl -X POST "https://onfleet.com/api/v2/teams" \
       -u "<your_onfleet_api_key>:" \
       -d '{"name":"Sunset","workers":["1LjhGUWdxFbvdsTAAXs0TFos","F8WPCqGmQYWpCkQ2c8zJTCpW"],"managers":["Mrq7aKqzPFKX22pmjdLx*ohM"],"hub":"tKxSfU7psqDQEBVn5e2VQ~*O"}'
```
```python
onfleet.teams.create(body={
  "name":"Sunset",
  "workers":["1LjhGUWdxFbvdsTAAXs0TFos","F8WPCqGmQYWpCkQ2c8zJTCpW"],
  "managers":["Mrq7aKqzPFKX22pmjdLx*ohM"],
  "hub":"tKxSfU7psqDQEBVn5e2VQ~*O"
})
```
```javascript
onfleet.teams.create({"name":"Sunset",
                      "workers":["1LjhGUWdxFbvdsTAAXs0TFos","F8WPCqGmQYWpCkQ2c8zJTCpW"],
                      "managers":["Mrq7aKqzPFKX22pmjdLx*ohM"],
                      "hub":"tKxSfU7psqDQEBVn5e2VQ~*O"
                     });
```
```php
$onfleet->teams->create(["name" => "Sunset",
                         "workers"=>["1LjhGUWdxFbvdsTAAXs0TFos","F8WPCqGmQYWpCkQ2c8zJTCpW"],
                         "managers"=>["Mrq7aKqzPFKX22pmjdLx*ohM"],
                         "hub" => "tKxSfU7psqDQEBVn5e2VQ~*O"
                        ])
```

```json Response
{
  "id": "FFqPs1KHayxorfA~~xIj0us4",
  "timeCreated": 1455156655000,
  "timeLastModified": 1455156655647,
  "name": "Sunset",
  "workers": [
    "1LjhGUWdxFbvdsTAAXs0TFos",
    "F8WPCqGmQYWpCkQ2c8zJTCpW"
  ],
  "managers": [
    "Mrq7aKqzPFKX22pmjdLx*ohM"
  ],
  "hub": "tKxSfU7psqDQEBVn5e2VQ~*O",
  "enableSelfAssignment": false
}
```
```json Error - Duplicate Team Name
{
  "code": "InvalidArgument",
  "message": {
    "error": 1901,
    "message": "One or more parameters required for this request must be unique but are not unique.",
    "cause": "Name is not unique within org",
    "request": "1adcce4a-e172-4868-a53f-2741a9157caf"
  }
}
```
```json Error - Invalid Content
{
  "code": "InvalidContent",
  "message": {
    "error": 1000,
    "message": "The values of one or more parameters are invalid.",
    "request": "0283a417-e7c0-47f7-90c7-86036e47afa6"
  }
}
```

As team names are unique within each organization, errors will be thrown if a duplicate name is used.