Access to Tesla fleet API is via the OAuth 2.0 authorization type. For ERPAG to be able to communicate with Tesla’s API, it is necessary to set up such access.

erpag api authorization

You will set this up in the Automatization/Customization menu, under option API Authorizations.

add new oauth 2.0

When you add a new type of authorization, the newly opened screen seems quite complicated. Luckily, we added a Wizard in ERPAG which fills in all required data based on two parameters.

wizard template

Enter “Client ID” and “Client secret”.

Client ID and Client secret

You will get these data from the portal API service. In Tesla’s case, it’s

Tesla developer

This Tesla link is general guidelines on how to give developer access to their API:

It is explained in detail there, to simplify, we will explain the process in detail.

The first thing you should have is a Tesla account (it needs to be two-factor verification). Next is the request for API access.

Tesla developer

It’s a wizard-type data entry, where you enter data on each step.

tesla developer oauth

Now it’s required to add a fixed URL, for safety reasons. This way you allow ERPAG the first-level access to Tesla Fleet API.

The data that you will enter are:

Allowed Origin URL

and Allowed Redirect URL (this is the URL to which they will send access token after API authorization)

The next step is “API Scopes”. Which means which data we can access through the API service.

api scope

After sending the request, it is necessary to wait some time for the request approval.

Note: From our experience, we can say that depending on the required scope, approval can take from a few minutes to 24 hours.

Once it’s approved, additionally you will see the “Active” status on the dashboard, i.e. “tiles” of our applications.

On details, we will see Client ID and Client Secret.

erpag test api credentials

Working in ERPAG

Now we can copy/paste in ERPAG wizard Tesla type.

Now ERPAG wizard completed all necessary data.

In case of a scope deviation, it is necessary to also check the scope that ERPAG sends to the Tesla API when requesting access.


After entering, it is necessary to make a connection to the API. ie Get an Access Token.

get a new access token oauth 2.0

By activating this option, the browser will load the Tesla page where you enter the Tesla login credentials.

If the authorization is successful, the status will be “Authorized”.


In fact, there is another test option. It’s a simple query request to API service.

query request oauth 2.0

In our example, we will enter the following URL:

Note: The URL for the Tesla fleet API is divided by region. If the above link doesn’t work, you have to select the appropriate one for your region. You can find more information on the Tesla developer site:

By receiving a JSON in the response, it’s a confirmation that we are successfully connected to the API service.

JSON response

Using in ERPAG

You can use the set API authorization in ERPAG Smart API through blocks in Blockly scripts (eg BOT script).

bot script

We simply select the name of our authorization in the API blocks.

Start NOW

Read More

Related Posts

How Great Inventory Software Can Help Fight Inflation

In today's rapidly fluctuating economy, businesses face the daunting challenge of fighting inflation. Rising costs can erode profits and disrupt operations, making it essential to adopt strategies that mitigate these impacts. One powerful tool in this battle is...

read more
​ERPAG API – Xero OAuth 2.0 authorization

​ERPAG API – Xero OAuth 2.0 authorization

In this instruction blog, we will describe how to create OAuth 2.0 API keys on your Xero account. These API keys are necessary in order to make API calls from ERPAG via Blockly scripts. The instructions show how the process itself currently looks. If in the meantime...

read more