AI92 لائیو ہے - ہمارا عالمی سافٹ لانچ جاری ہے: پورا پلیٹ فارم پہلے 30 دنوں کے لیے دنیا بھر میں کھلا ہے۔
دستاویزات کا مینو

یہ ڈویلپر دستاویزات فی الحال صرف انگریزی میں ہیں۔ کوڈ اور API کا رویہ ہر علاقے میں یکساں ہے۔

Build Campaign API

AI-driven campaign strategy: generate a strategy, optimize an existing campaign, configure A/B tests, and optimize budgets across channels. Routes are served under /v1/campaigns and backed by module-a (with module-G).

Authentication

Authorization: Bearer ai92_live_<key>     # production
Authorization: Bearer ai92_test_<key>     # sandbox

Mutating requests support Idempotency-Key and are brand-gated.

Credit costs at a glance

EndpointCost
POST /v1/campaigns/build25 cr
POST /v1/campaigns/optimize10 cr
POST /v1/campaigns/ab-test5 cr
POST /v1/campaigns/budget-optimize15 cr

POST /v1/campaigns/build

Cost: 25 credits

AI campaign strategy generation for a brand and objective.

Auth: Bearer

FieldTypeRequiredDescription
brand_idstringYesThe brand.
campaign_objectivestringYesThe campaign objective (e.g. lead_gen, awareness).
budget_usdnumber / nullNoTotal budget in USD.

Request

bash
curl https://api.ai92.ai/v1/campaigns/build \
  -H "Authorization: Bearer ai92_test_51a9c0de…" \
  -H "Content-Type: application/json" \
  -d '{"brand_id": "acme", "campaign_objective": "lead_gen", "budget_usd": 5000}'

Response 200 OK

json
{
  "brand_id": "acme",
  "strategy_id": "strat_88",
  "objective": "lead_gen",
  "recommended_channels": ["email", "search", "linkedin"],
  "messaging_angles": ["ROI", "ease of migration"]
}

Errors

StatusCodeWhen
402INSUFFICIENT_CREDITSBalance below 25 credits.

POST /v1/campaigns/optimize

Cost: 10 credits

Run an optimization pass on an existing campaign.

Auth: Bearer

FieldTypeRequiredDescription
campaign_idstringYesThe campaign to optimize.

Request

bash
curl https://api.ai92.ai/v1/campaigns/optimize \
  -H "Authorization: Bearer ai92_test_51a9c0de…" \
  -H "Content-Type: application/json" \
  -d '{"campaign_id": "camp_77a2"}'

Response 200 OK

json
{
  "campaign_id": "camp_77a2",
  "recommendations": [
    { "type": "subject_line", "current": "Spring lineup", "suggested": "See the Spring lineup" }
  ],
  "projected_lift": 0.12
}

Errors

StatusCodeWhen
402INSUFFICIENT_CREDITSBalance below 10 credits.

POST /v1/campaigns/ab-test

Cost: 5 credits

Configure N variants for an existing campaign with statistical significance calculations baked in.

Auth: Bearer

FieldTypeRequiredDescription
campaign_idstringYesThe campaign to test.
variant_countintegerNoNumber of variants. Default 2. Range 28.
primary_metricstringNoOptimization metric. Default conversion_rate.

Request

bash
curl https://api.ai92.ai/v1/campaigns/ab-test \
  -H "Authorization: Bearer ai92_test_51a9c0de…" \
  -H "Content-Type: application/json" \
  -d '{"campaign_id": "camp_77a2", "variant_count": 3, "primary_metric": "conversion_rate"}'

Response 200 OK

json
{
  "campaign_id": "camp_77a2",
  "variants": ["A", "B", "C"],
  "primary_metric": "conversion_rate",
  "min_sample_per_variant": 1840
}

Errors

StatusCodeWhen
402INSUFFICIENT_CREDITSBalance below 5 credits.

POST /v1/campaigns/budget-optimize

Cost: 15 credits

AI-driven allocation of a total budget across the requested channels.

Auth: Bearer

FieldTypeRequiredDescription
brand_idstringYesThe brand.
total_budget_usdnumberYesTotal budget (> 0).
channelsstring[]YesChannels to allocate across. Length 18.

Request

bash
curl https://api.ai92.ai/v1/campaigns/budget-optimize \
  -H "Authorization: Bearer ai92_test_51a9c0de…" \
  -H "Content-Type: application/json" \
  -d '{"brand_id": "acme", "total_budget_usd": 10000, "channels": ["email", "search", "social"]}'

Response 200 OK

json
{
  "brand_id": "acme",
  "total_budget_usd": 10000,
  "allocation": { "email": 2500, "search": 5000, "social": 2500 },
  "projected_roas": 3.6
}

Errors

StatusCodeWhen
402INSUFFICIENT_CREDITSBalance below 15 credits.