Authentication
Before you can start making requests to our API, you will need to register and obtain your client_id and client_secret and learn how to authenticate your requests.
Our Authentication
Our API uses JWT (JSON Web Tokens) for authenticating requests. To obtain a bearer token, you will need to make a POST request to our /token
endpoint with your client_id
and client_secret
.
Do not share your client_secret
in publicly accessible areas such as GitHub, client-side code, and so forth.
Authenticating your requests
Once you have obtained your bearer token, you will need to start authenticating your requests. In order to do so, you need to include the bearer token in the Authorization
header of your requests.
Here’s an example using curl to authenticate a request to our API:
codecurl --location 'https://api.stockpilot.dev/v1/inventory' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <bearer-token>'
In the example above, the Authorization
header value is constructed as Bearer <bearer-token>
, where <bearer-token>
is the token you obtained from the /token
endpoint.
Below is an example with the Python requests library:
import requests
bearer_token = "Your obtained bearer token"
headers = {
"Authorization": f"Bearer {bearer_token}"
}
r = requests.get('https://api.stockpilot.dev/v1/inventory', headers=headers)