Create destination

Create destination

Body parameters

NameTypeDescription
addressobjectThe destination’s street address details.
locationarrayOptional. The [ longitude, latitude ] geographic coordinates. If missing, the API will geocode based on the address details provided. Note that geocoding may slightly modify the format of the address properties. address.unparsed cannot be provided if you are also including a location.
notesstringOptional. Notes about the destination.
optionsobjectOptional. Includes the language options.

An address has the following properties:

NameTypeDescription
namestringOptional. A name associated with this address, for example, "Transamerica Pyramid".
numberstringThe number component of this address, it may also contain letters.
streetstringThe name of the street.
apartmentstringOptional. The suite or apartment number, or any additional relevant information.
citystringThe name of the municipality.
statestringOptional. The name of the state, province or jurisdiction.
postalCodestringOptional. The postal or zip code.
countrystringThe name of the country.
unparsedstringOptional. A complete address specified in a single, unparsed string where the various elements are separated by commas. If present, all other address properties will be ignored (with the exception of name and apartment). In some countries, you may skip most address details (like city or state) if you provide a valid postalCode: for example, 543 Howard St, 94105, USA will be geocoded correctly.

An options has the following properties:

NameTypeDescription
languagestringOptional. The language options follows the ISO Standard of 2-letters country code.

Create destination with complete address details, parsed, see examples of creating destinations with parsed addresses in the side bar:

curl -X POST "https://onfleet.com/api/v2/destinations" \
       -u "cd3b3de84cc1ee040bf06512d233719c:" \
       -d '{"address":{"number":"543","street":"Howard St","apartment":"5th Floor","city":"San Francisco","state":"CA","country":"USA"},"notes":"Don\'t forget to check out the epic rooftop."}'
onfleet.destinations.create(body={
  "address":{
    "number":"543",
    "street":"Howard St",
    "apartment":"5th Floor",
    "city":"San Francisco",
    "state":"CA",
    "country":"USA"},
  "notes":"Don\'t forget to check out the epic rooftop."
})
onfleet.destinations.create({
  "address":{
    "number":"543",
    "street":"Howard St",
    "apartment":"5th Floor",
    "city":"San Francisco",
    "state":"CA","country":"USA"},
  "notes":"Don\'t forget to check out the epic rooftop."
});
$onfleet->destinations->create([
  "address" => [
    "number" => "543",
    "street" => "Howard St",
    "apartment" => "5th Floor",
    "city" => "San Francisco",
    "state" => "CA","country" => "USA"
  ],
  "notes" => "Don\'t forget to check out the epic rooftop."
])
{
  "id": "JLn6ZoYGZWn2wB2HaR9glsqB",
  "timeCreated": 1455156663000,
  "timeLastModified": 1455156663896,
  "location": [
    -122.3965731,
    37.7875728
  ],
  "address": {
    "apartment": "5th Floor",
    "state": "California",
    "postalCode": "94105",
    "country": "United States",
    "city": "San Francisco",
    "street": "Howard Street",
    "number": "543"
  },
  "notes": "Don't forget to check out the epic rooftop.",
  "metadata": []
}

Create destination using an unparsed address, see examples of unparsed addresses in the side bar:

curl -X POST "https://onfleet.com/api/v2/destinations" \
       -u "cd3b3de84cc1ee040bf06512d233719c:" \
       -d '{"address":{"unparsed":"666 Post St, SF, CA, USA"}}'
onfleet.destinations.create(body={"address":{"unparsed":"666 Post St, SF, CA, USA"}})
onfleet.destinations.create({"address":{"unparsed":"666 Post St, SF, CA, USA"}});
{
  "id": "barP8D82zGyzd~7~74dSCDV1",
  "timeCreated": 1455156664000,
  "timeLastModified": 1455156664297,
  "location": [
    -122.4128901,
    37.787933
  ],
  "address": {
    "apartment": "",
    "state": "California",
    "postalCode": "94109",
    "country": "United States",
    "city": "San Francisco",
    "street": "Post Street",
    "number": "666"
  },
  "notes": "",
  "metadata": []
}

Create destination with location coordinates must include parsed address.city and address.country components at the minimum. See examples of locations addresses in the side bar:

curl -X POST "https://onfleet.com/api/v2/destinations" \
       -u "cd3b3de84cc1ee040bf06512d233719c:" \
       -d '{"location": [-122.3966546,37.7875914],"address": {"apartment": "5th Floor","state": "California","postalCode": "94105","number": "543","street": "Howard Street","city": "San Francisco","country": "United States"}}'
{
    "id": "d*LRNTCgQSmBzj~pxW1eBsLq",
    "timeCreated": 1621459229000,
    "timeLastModified": 1621459229693,
    "location": [
        -122.3966546,
        37.7875914
    ],
    "address": {
        "apartment": "5th Floor",
        "state": "California",
        "postalCode": "94105",
        "number": "543",
        "street": "Howard Street",
        "city": "San Francisco",
        "country": "United States"
    },
    "notes": "",
    "metadata": [],
    "googlePlaceId": null,
    "warnings": []
}