Authentication

Authentication

This page gives you an overview of everything related to authenticating your API requests.

Adding a new API Key

To use the lemon.markets API, you need to authenticate your requests with an API Key. To get an API Key, sign up on our Dashboard, verify your account and log in afterwards.
In the Dashboard, you have the option to create API Keys with a custom expiration date. To add a new API Key, click on "Create Key". You can create an API Key for the Paper and the Money environment (provided you have upgrade to Live Trading).

In the appearing Modal, you can then specify the name of you API Key and how long you want it to be valid. Ater you click on "Create Key", the API Key is added to your Dashboard. To use it, simply click on the "copy" symbol on the right side of the table.

API Key Creation Process

5 API Keys per environment

You can create 5 API Keys per environment (5 for Paper Money and 5 for Real Money). You have the option to delete API Keys to make space for new ones.

Using an API Key

To use an API Key and authenticate your request, copy the API Key from your Dashboard.
Place your API Key in the authorization header of your request in the format

"Authorization": "Bearer YOUR-API-KEY"

See an example below.

Authentication Header

In the example on the right, we are retrieving our account using the /account endpoint. The API Key is placed within the authorization header.

GETaccount/
1import requests
2import json
3
4request = requests.get("https://paper-trading.lemon.markets/v1/account/",
5          headers={"Authorization": "Bearer YOUR-API-KEY"})
6print(request.json())