Create Hub

This end point allows the user to quickly create hubs and assign them to the teams upon creation.

NameTypeDescription
namestringRequired. A name to identify the Hub.
addressobjectRequired. The hub’s street address information. The address data object fields are located under the Destination section.
teamarray of stringOptional. This is the team ID(s) that this Hub will be assigned to.
phonestringOptional. Phone number associated with the Hub.
curl -X POST "https://onfleet.com/api/v2/hubs" \
       -u "<your_onfleet_api_key>:" \
       -d '{"name": "VIP customer","address": {"apartment": "","state": "California","postalCode": "92806","number": "2695","street": "East Katella Avenue","city": "Anaheim","country": "United States","name": "VIP customer"},"teams": ["kq5MFBzYNWhp1rumJEfGUTqS"],"phone":"+19095551234"}'
onfleet.destinations.create(body={
  "name": "VIP customer",
  "address": {
    "apartment": "",
    "state": "California",
    "postalCode": "92806",
    "number": "2695",
    "street": "East Katella Avenue",
    "city": "Anaheim",
    "country": "United States",
    "name": "VIP customer"
  },
  "teams": ["kq5MFBzYNWhp1rumJEfGUTqS"],
  "phone":"+19095551234"
})
onfleet.hubs.create({"name": "VIP customer",
                     "address": {
                       "apartment": "",
                       "state": "California",
                       "postalCode": "92806",
                       "number": "2695",
                       "street": "East Katella Avenue",
                       "city": "Anaheim",
                       "country": "United States",
                       "name": "VIP customer"
                     },
                     "teams": ["kq5MFBzYNWhp1rumJEfGUTqS"],
										 "phone":"+19095551234"
                    });
$onfleet->hubs->create(["name"=>"VIP customer",
                        "address"=>["apartment" =>  "",
                                       "state" =>  "California",
                                       "postalCode" => "92806",
                                    "number" => "2695",
                                    "street" =>  "East Katella Avenue",
                                    "city" =>  "Anaheim",
                                    "country" =>  "United States",
                                    "name" =>  "VIP customer"
                                   ],
                        "teams" =>  ["kq5MFBzYNWhp1rumJEfGUTqS"],
    										"phone" => "+19095551234"
                       ])
{
    "id": "i4FoP*dTVrdnGqvIVvvA69aB",
    "name": "VIP customer",
    "location": [
        -117.8767457,
        33.8079071
    ],
    "address": {
        "number": "2695",
        "street": "East Katella Avenue",
        "city": "Anaheim",
        "county": "Orange County",
        "state": "California",
        "country": "United States",
        "postalCode": "92806",
        "apartment": "",
        "name": "VIP customer"
    },
    "teams": [
        "kq5MFBzYNWhp1rumJEfGUTqS"
    ],
    "phone":"+19095551234"
}