Data Types and Response Formats

Data Types and Response Formats

The API has been designed with standards at its core. The following promises are kept throughout all endpoints:

  • With very few exceptions, numbers are numbers, and not strings. The API adheres strictly to the most natural representation of the underlying data, and null is always returned for optional properties which have not yet been assigned a value.
  • Distances fields are displayed in meters measurement unless otherwise noted in the page.
  • Geographic coordinates are formatted as [ longitude, latitude ], as per the GeoJSON standard.
  • Timestamps are consumed and produced in Unix epoch time format, with millisecond precision, unless otherwise noted. At this time only Driver Time Estimate endpoint is using seconds precision. You can get a sample timestamp in this format on a *nix machine by running the following command.
$ echo $(($(date +'%s * 1000 + %-N / 1000000')))
1455054888000
  • Most endpoints return the requested target resource, however, there are some exceptions, such as deleting a resource, which will simply respond with a 200 and no body. To the extent possible, the API is both resource-driven and oriented.
  • The API uses 24-character long encoded IDs which may contain URL-safe, non-alphanumeric characters, as in this sample Onfleet resource ID cBrUjKvQQgdRp~s1qvQNLpK*.
  • Phone numbers will always be returned in E.164 format, however, they may be provided in E.164 or a localized format that is valid based on your organization's country configuration. If you wish to provide numbers from countries other than your organization's, you must use E.164 only. We strongly recommend the use of libraries like libphonenumber for managing phone number validation and formatting.
  • All outbound traffic from Onfleet will use these IP addresses:
    • 54.84.188.171
    • 35.171.245.6
    • 52.202.131.11
    • 54.83.192.154
    • 3.219.23.167
    • 44.223.120.236
    • 75.101.166.117
  • Whitelist these addresses for added security precautions.