AvailableADDOCUMENTATION
AvailableAD / Help center

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.

Advertiser guideAgency guideREST APIWebhooks
Two ways to use AvailableAD. Advertisers fund and manage campaigns from the dashboard. Agencies request ad sessions for their users using a private API key. Advertiser dashboard actions are not public JSON API endpoints.

Choose your guide

Jump to the guide that matches your account.

01 / Advertisers

Getting started

Advertisers use AvailableAD to publish promotional campaigns that can be delivered to eligible viewers through participating agencies and publisher integrations.

  1. Register an advertiser account and complete email verification.
  2. Sign in to the advertiser dashboard.
  3. Add funds using the payment methods shown in your account.
  4. Create a campaign and provide the creative content and destination requested by the campaign editor.
  5. Configure the budget and delivery settings available in the editor.
  6. Preview your campaign, submit it through the dashboard workflow, then monitor its delivery.
Before launch: Check your destination URL, campaign message, preview and available balance.

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.

Campaign creativePrepare your advertiser identity, campaign message, logo or image, and call-to-action destination as requested by the editor.
Budget & deliverySet the campaign budget and delivery controls made available to your account.
PreviewReview how the ad will appear before submitting it.
Campaign statusUse dashboard status and reporting views to monitor availability and delivery.
API note: Campaign creation, editing, deposits and advertiser account actions are browser-session dashboard workflows protected by CSRF. They are not public JSON API endpoints.

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.

ActivityMeaning
Ad startedVisitor opened the ad session page.
Button clickVisitor clicked the advertiser's action button or link.
Completed viewServer validated the watch requirements and recorded completion.
Errored sessionAd page reported an error for the session.
SpendAmount 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.
01 / URL structure

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
02 / Agencies & developers

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.

  1. Register and verify an agency account.
  2. Open Agency → API key & webhook.
  3. Generate or copy your API key and store it on your server.
  4. Optionally configure an HTTPS webhook URL and webhook secret.
  5. Request an ad session from your backend.
  6. Send the returned ad_url to the Telegram user whose ID you submitted.
  7. Receive completion/error webhooks or check session status through the API.
Keep your API key private. Never place it in browser JavaScript, a public Telegram Mini App, mobile app source or a public repository.

API authentication

All agency publisher endpoints under /api/v1/ require an active key in the X-API-Key HTTP header.

HeaderRequiredPurpose
X-API-KeyYesYour agency API key.
Content-TypeJSON POSTapplication/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.

POST/api/v1/ads/request
API key required JSON body

Required: 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

HTTPDetailMeaning
401invalid api keyMissing/invalid key or inactive agency.
422telegram_user_id ... is requiredSend a positive JSON integer, not a quoted string.
429daily ad cap reached for this userAgency daily user cap reached.
404no ad availableNo eligible campaign is available.
500internal errorUnexpected server error.

Check ad session status

GET/api/v1/ads/status/{session_id}
API key required

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"
}
StatusMeaning
issuedSession created; ad page not yet started.
startedAd page opened and session started.
completedAd requirements passed and completion recorded.
erroredAd page reported an error.

Errors: 401 invalid api key, 404 unknown session, 500 internal error.

Get agency / publisher balance

GET/api/v1/publisher/balance
API key required

Returns 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.

HeaderMeaning
Content-Typeapplication/json
X-AvailableAD-SignatureHex HMAC-SHA256 signature of exact raw request body.
User-AgentAvailableAD-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

IssueWhat to check
401 invalid api keyUse the active key in exactly X-API-Key; check if it was rotated.
422 user ID validationSend a positive numeric JSON integer.
404 no ad availableCheck eligible campaign status, budget, advertiser balance and user limits.
429 daily ad capThe agency user has reached the configured daily cap.
Session still startedUser may not have completed the requirements; wait for webhook or check status again.
Webhook 401 / retriesVerify 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.completed webhook or confirm completed status.
  • 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
Visitor endpoints: /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.