Everything you need
to run ads.
Documentation for advertisers launching campaigns and agencies connecting their apps, bots and platforms to AvailableAD through the publisher API.
Choose your guide
Jump to the guide that matches your account.
Getting started
Advertisers use AvailableAD to publish promotional campaigns that can be delivered to eligible viewers through participating agencies and publisher integrations.
- Register an advertiser account and complete email verification.
- Sign in to the advertiser dashboard.
- Add funds using the payment methods shown in your account.
- Create a campaign and provide the creative content and destination requested by the campaign editor.
- Configure the budget and delivery settings available in the editor.
- Preview your campaign, submit it through the dashboard workflow, then monitor its delivery.
Create and manage campaigns
Use the campaign area in the advertiser dashboard. The exact fields and available controls are displayed by your live campaign editor.
Budget, deposits & billing
- Add funds from the advertiser dashboard using the payment methods enabled for your account.
- Delivery depends on remaining campaign budget and available advertiser funds.
- Successful ad completion is recorded server-side and debits the advertiser ledger.
- Review your transactions and balance in the advertiser dashboard.
Payment providers, currencies, fees and minimum deposit values may depend on your live account configuration. Follow the values displayed at checkout.
Tracking & reports
AvailableAD records session activity and advertiser button clicks. A click is not the same as a completed view.
| Activity | Meaning |
|---|---|
| Ad started | Visitor opened the ad session page. |
| Button click | Visitor clicked the advertiser's action button or link. |
| Completed view | Server validated the watch requirements and recorded completion. |
| Errored session | Ad page reported an error for the session. |
| Spend | Amount charged through completed delivery. |
Campaign eligibility & limits
A campaign is delivered only when eligible. Availability can depend on campaign status, remaining campaign budget, advertiser funds, per-user campaign view limits and the agency's daily user cap.
- Campaigns without remaining budget cannot be delivered.
- A user who reached the campaign's per-user limit may not receive it again until the applicable reset.
- The agency daily completed-ad cap is separate from an advertiser campaign limit.
- If no campaign qualifies, an agency API request can return
404 no ad available.
Platform URLs
Use these public routes. The site root (/) opens the advertiser/agency login/dashboard and still requires authentication.
- Advertiser panel:
/app/advertiser - Agency panel:
/app/agency - API:
/api/v1/... - Ad session page:
/api/ad/SESSION_ID?t=SESSION_TOKEN
Agency setup
Agencies integrate AvailableAD with a Telegram bot, application or other backend. Your server requests an ad session for a user, then sends the returned ad URL to that same user.
- Register and verify an agency account.
- Open Agency → API key & webhook.
- Generate or copy your API key and store it on your server.
- Optionally configure an HTTPS webhook URL and webhook secret.
- Request an ad session from your backend.
- Send the returned
ad_urlto the Telegram user whose ID you submitted. - Receive completion/error webhooks or check session status through the API.
API authentication
All agency publisher endpoints under /api/v1/ require an active key in the X-API-Key HTTP header.
| Header | Required | Purpose |
|---|---|---|
X-API-Key | Yes | Your agency API key. |
Content-Type | JSON POST | application/json. |
Base URL
https://ads.flamesms.in
Missing or invalid keys, or keys belonging to an inactive agency, return 401 Unauthorized. Rotating the key invalidates the old key.
Request an ad session
Create an ad session for a Telegram user. The API returns a unique URL that should be opened by that same user.
/api/v1/ads/requestRequired: telegram_user_id — positive JSON integer. No optional request fields are currently used.
cURL request
curl -X POST "https://ads.flamesms.in/api/v1/ads/request" \
-H "X-API-Key: YOUR_AVAILABLEAD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"telegram_user_id": 123456789}'Success · 200 OK
{
"session_id": "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",
"ad_url": "https://ads.flamesms.in/api/ad/SESSION_ID?t=SESSION_TOKEN",
"expires_in": 600
}Save session_id if you need status checks. Send the full ad_url only to the intended user; it contains a private session token. Use the returned expires_in value.
Common responses
| HTTP | Detail | Meaning |
|---|---|---|
| 401 | invalid api key | Missing/invalid key or inactive agency. |
| 422 | telegram_user_id ... is required | Send a positive JSON integer, not a quoted string. |
| 429 | daily ad cap reached for this user | Agency daily user cap reached. |
| 404 | no ad available | No eligible campaign is available. |
| 500 | internal error | Unexpected server error. |
Check ad session status
/api/v1/ads/status/{session_id}Path parameter session_id is the ID returned by the request endpoint.
curl "https://ads.flamesms.in/api/v1/ads/status/SESSION_ID" \ -H "X-API-Key: YOUR_AVAILABLEAD_API_KEY"
Success response
{
"session_id": "SESSION_ID",
"status": "started"
}| Status | Meaning |
|---|---|
issued | Session created; ad page not yet started. |
started | Ad page opened and session started. |
completed | Ad requirements passed and completion recorded. |
errored | Ad page reported an error. |
Errors: 401 invalid api key, 404 unknown session, 500 internal error.
Get agency / publisher balance
/api/v1/publisher/balanceReturns ledger balance, pending payout amount and available balance.
curl "https://ads.flamesms.in/api/v1/publisher/balance" \ -H "X-API-Key: YOUR_AVAILABLEAD_API_KEY"
Success response
{
"balance_micros": 12500000,
"balance_usd": 12.5,
"pending_payout_micros": 2000000,
"available_micros": 10500000
}1 USD = 1,000,000 micros. available_micros is balance less pending payout requests, with a minimum of zero.
Webhook notifications
AvailableAD can notify your server when an ad session completes or reports an error. Configure an HTTPS URL and secret in Agency → API key & webhook.
| Header | Meaning |
|---|---|
Content-Type | application/json |
X-AvailableAD-Signature | Hex HMAC-SHA256 signature of exact raw request body. |
User-Agent | AvailableAD-Webhook/1.0 |
Verify signature in PHP
<?php
$rawBody = file_get_contents('php://input');
$received = $_SERVER['HTTP_X_AVAILABLEAD_SIGNATURE'] ?? '';
$secret = 'YOUR_AGENCY_WEBHOOK_SECRET';
$expected = hash_hmac('sha256', $rawBody, $secret);
if ($received === '' || !hash_equals($expected, $received)) {
http_response_code(401);
exit('Invalid signature');
}
$event = json_decode($rawBody, true);
if (!is_array($event)) {
http_response_code(400);
exit('Invalid JSON');
}
// Process verified event; make processing idempotent.
http_response_code(200);
echo 'OK';Verify the signature against the exact raw body before decoding JSON. Do not decode and re-encode the payload first.
Event: ad.completed
{
"event": "ad.completed",
"session_id": "SESSION_ID",
"telegram_user_id": 123456789,
"reward": true
}Event: ad.error
{
"event": "ad.error",
"session_id": "SESSION_ID",
"telegram_user_id": 123456789
}Return a 2xx response after accepting an event. Failed deliveries are retried with increasing delays up to one hour; the configured maximum is 8 attempts. Handle duplicate deliveries safely.
Errors & troubleshooting
| Issue | What to check |
|---|---|
401 invalid api key | Use the active key in exactly X-API-Key; check if it was rotated. |
422 user ID validation | Send a positive numeric JSON integer. |
404 no ad available | Check eligible campaign status, budget, advertiser balance and user limits. |
429 daily ad cap | The agency user has reached the configured daily cap. |
Session still started | User may not have completed the requirements; wait for webhook or check status again. |
| Webhook 401 / retries | Verify exact raw body signature, HTTPS reachability and 2xx response. |
Security best practices
- Make API calls from your backend only.
- Use HTTPS for API calls and webhook endpoints.
- Keep API keys, webhook secrets, ad URLs and session tokens private.
- Do not grant rewards just because an ad URL was opened. Wait for a verified
ad.completedwebhook or confirmcompletedstatus. - Do not manually call visitor completion endpoints to bypass watch validation.
- Make webhook processing idempotent to prevent duplicate rewards.
Recommended integration flow
YOUR BACKEND
| POST /api/v1/ads/request
| X-API-Key + telegram_user_id
v
AVAILABLEAD API
| session_id + ad_url + expires_in
v
YOUR BOT / APP
| Send ad_url to the same user
v
USER OPENS AD PAGE & COMPLETES REQUIREMENTS
v
AVAILABLEAD
| ad.completed or ad.error webhook
v
YOUR WEBHOOK SERVER
Optional:
GET /api/v1/ads/status/{session_id}
GET /api/v1/publisher/balance/api/v1/ads/click, /api/v1/ads/error and /api/v1/ads/complete are session-token endpoints used by the AvailableAD ad page. Most integrations should not call them manually. Open the returned ad URL and let the page handle these events.Frequently asked questions
Is there an advertiser campaign API?
The supplied application documentation identifies advertiser campaign creation, editing, deposits and transactions as authenticated dashboard workflows, not public JSON API endpoints. Do not use the agency publisher API to create campaigns.
Can I put my API key in a Telegram Mini App?
No. Keep it on your backend and have your backend call AvailableAD.
Does requesting an ad mean it is completed?
No. A request creates a session. Completion is recorded only after the server validates the ad requirements.
Where do I find my API key?
Open your agency dashboard and go to Agency → API key & webhook.