-> Sign Up - Getting Started

If you are already a Smartlane user, you can start right away with the following section. Otherwise, our sales team is looking forward to your request: [email protected]

You will receive a registration email asking for your company name and company address.
You can use your email address and your password from the registration email for the authentication to the API.

📘

Data privacy and security

All API calls are secured by SSL via HTTPS, so you don't have to worry about anybody intercepting your data via the Internet. All supplied data are stored securely on professionally operated servers in Germany and they are only accessible by the API itself - they cannot be accessed by anyone outside the application. The API itself is secured by a user name and password, which are supplied only to you during the registration process. Of course, passwords are always stored as encrypted hashes and thus are never readable by anybody.

Authentication

In addition to exclusive access via https, all API calls (exceptions aside) are secured by JWT tokens. That means you always need to provide an authorization header with a security token.

The token is generated via a POST request to the API endpoint /auth, with your registered email address and password information in the body:

curl --request POST \
     --url 'https://<your company name>.prd.smartlane.io/auth' \
     --header 'Content-Type: application/json' \
     --data '{"email": "[email protected]", 
              "password": "your_choosen_password"}'
import requests

url = "https://<your company name>.prd.smartlane.io/auth"
login = {'email': 'your_email', 'password': 'your_choosen_password'}
token = response.json().get(u'access_token')
auth_header = {'Authorization': "JWT " + token}
auth_header['accept'] = "application/json"

response = requests.post(url, json=login)

If done successfully, this responds with a JSON body containing the access_token.

{'access_token': 'your.Long_Randomfghxlcnebem.Secure_AccessToken'}

which can - and must - be used for all further API calls in the request header in the following form as a JSON object:

{'Authorization': 'JWT your.Long_Randomfghxlcnebem.Secure_AccessToken'}

Please make sure that you don't miss the mandatory JWT prefix!

📘

API Endpoint URLs

All URLs of the API requests are composed of the the base url
https://<your company name>.prd.smartlane.io plus /api and the /<name> of the API endpoint. The only exception is the call to /auth, where /api is absent.

Basic API Requests

Now that we've got our JWT access token, we can actually try making the first call to our API. As an example, it may serve a request to the Company endpoint,
which contains the data you provided with your registration.

curl --request GET \
     "https://<your company name>.prd.smartlane.io/api/company" \
     --header "Authorization: JWT your.Long_Randomfghxlcnebem.Secure_AccessToken"
import requests

api_url = "https://<your company name>.prd.smartlane.io/api/company"

auth_header = {'Authorization': 'JWT ' + token}

response = requests.get(api_url, headers=auth_header)

If everything goes right, the response is a HTTP status code 200 containing a body similar to

{'num_results': 1,
 'objects': [{'companyname': 'Your_company_name',
              'id': 1,
              'location_id': 1,
              'pricing_package': 500,
              'test_phase': True}],
 'page': 1,
 'total_pages': 1}

Yay, now you know what your companyname is! Great success, but there are also some other bits of information, like the location_id, so check out the first chapter on Depot and Retrieve adresses to figure out whats up with that, or jump directly to Optimizing Routes if you don't care about all those details and start optimizing your first tour right away.

📘

It's all JSON

All request bodies and headers, as well as the produced responses, are exclusively of the type application/json.

🚧

Request limit

There is a general limit of 200 API requests per second. If more requests are called, the response will be 429 Too Many Requests.