Quick start
Make a key and your first call in two minutes.
1. Make a key
Open Loopearn Business, go to Settings › API keys and choose Create key. Only the business owner can do this.
Pick Read only for now. There's no test mode, so every key works on your real campaigns, and a Read only key can't change anything. Copy the key straight away, because it's only shown once.
2. Make your first call
Send the key in the x-api-key header:
curl "https://api.loopearn.com/api/campaigns?perPage=2" \
-H "x-api-key: YOUR_KEY"The same call in JavaScript:
const res = await fetch("https://api.loopearn.com/api/campaigns?perPage=2", {
headers: { "x-api-key": process.env.LOOPEARN_API_KEY },
});
const { data, totalRows } = await res.json();And in Python:
import os, requests
res = requests.get(
"https://api.loopearn.com/api/campaigns",
params={"perPage": 2},
headers={"x-api-key": os.environ["LOOPEARN_API_KEY"]},
)
print(res.json()["totalRows"])3. Read the answer
Every list answers with the rows, how many pages there are and how many rows in total:
{
"data": [{ "id": "...", "name": "...", "status": "live" }],
"pageCount": 3,
"totalRows": 5
}Rows are shortened here. The API reference shows every field.
Call from your server, not from a web page. Browsers can't send the x-api-key header to the API, and a key in a web page can be read by anyone.
Need help? Email support@loopearn.com