Authentication
The Botsi API uses apiKey Authentication to secure HTTP requests. You must include your secret key in the Authorization header of every request to identify your application and authorize the call.
The Authorization Header
All requests must include the following headers:
Authorization: {{secret_key}}
Content-Type: application/json
The secret_key can be obtained from the App configuration page in the Botsi dashboard.
Implementation Example
The following example demonstrates how to authenticate a request to the Send Profile Event endpoint using cURL.
Request
curl -X POST "https://app.botsi.com/api/v1/web-api/events" \
-H "Authorization: {{secret_key}}" \
-H "Content-Type: application/json" \
-d '[
{
"eventType": "paywall_shown",
"paywallId": 1,
"placementId": "ai-placement-id",
"isExperiment": true,
"aiPricingModelId": 32,
"profileId": "123-abc",
}
]'
Key Requirements
-
Secure the Key: Your
secret_keycan be found on the App configuration page on the Botsi dashboard. Treat it like a password. -
Content-Type: Ensure you set
-H "Content-Type: application/json", as the Botsi API only accepts JSON payloads. -
HTTPS: Always use
https://to ensure your secret key is encrypted during transit.
Troubleshooting Authentication
If you receive a 401 Unauthorized response, check if the secret_key exactly matches the value in your Botsi App Configuration.
Which key is which
A full Botsi integration can involve up to four credentials. Each one does a different job, and only the first is used on this page:
| Credential | Where you find it | What it does |
|---|---|---|
| Botsi secret key | Botsi dashboard, App configuration page | Authorizes your server's calls to the Web API: profiles, paywalls, events. Keep it server-side. |
| Botsi public key | Botsi dashboard, App configuration page | Authorizes the mobile SDK inside your app. Only needed if you use the SDK. |
| Stripe API key (secret or restricted) | Generated in Stripe, saved in App Settings > Stripe as Stripe Secret API key | Lets Botsi read the subscription, customer, and invoice behind each payment event. Part of the Stripe connection. |
| Stripe webhook signing secret | From your Stripe webhook endpoint, saved in App Settings > Stripe | Verifies that purchase events sent to Botsi really came from your Stripe account. Also part of the Stripe connection. |
Rule of thumb: the Botsi keys move decisions out of Botsi, and the Stripe credentials bring purchase results back in.