Docs

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 API keys for authenticating requests. Instead of using a bearer token, you need to include your X-CLIENT-ID and X-CLIENT-SECRET in the headers of each request.

🚨 Do not share your client_secret in publicly accessible areas such as GitHub, client-side code, and so forth.

Authenticating Your Requests

To authenticate a request, include your API keys in the request headers.

Example: Authenticating with /auth/who-is using cURL

curl --location 'https://api.stockpilot.dev/auth/who-is' \
--header 'Accept: application/json' \
--header 'X-CLIENT-ID: your_client_id' \
--header 'X-CLIENT-SECRET: your_client_secret'

In the example above, the headers X-CLIENT-ID and X-CLIENT-SECRET authenticate the request.

Example: Authenticating with Python (requests library)

import requests

# Your API credentials
client_id = "your_client_id"
client_secret = "your_client_secret"

# Headers for authentication
headers = {
    "X-CLIENT-ID": client_id,
    "X-CLIENT-SECRET": client_secret,
    "Accept": "application/json"
}

# Make a request to /auth/who-is to verify authentication
response = requests.get("https://api.stockpilot.dev/auth/who-is", headers=headers)

# Print the response
print(response.json())

In this example, the request sends X-CLIENT-ID and X-CLIENT-SECRET in the headers to authenticate with the Stockpilot API.