---
title: "Rank Meta audience segments and suggest where budget should go"
method: POST
path: "/api/v1/tools/meta_analyze_audiences/execute"
tags: ["Meta Ads"]
---

# Rank Meta audience segments and suggest where budget should go

`POST /api/v1/tools/meta_analyze_audiences/execute`

## Request

- Base URL: `https://adako.ai`
- URL: `https://adako.ai/api/v1/tools/meta_analyze_audiences/execute`
- Auth: HTTP bearer

Ranks the segments of one audience dimension against the account average on the metric that matches the objective: ROAS where revenue exists, otherwise cost per result. Says which segments are worth more budget, which are dragging, and which are simply too small to judge.
Use when: the user wants a decision, not a table — "who should we target", "what should we cut".
Do not use it as authority to exclude a demographic without the user's agreement: special ad categories forbid some exclusions outright, and a narrow exclusion often raises costs everywhere else.
Do not act on a segment with almost no spend; those keep a neutral verdict on purpose.
Returns the ranking with each segment's share of spend, how far it is from the average, and a one-line recommendation. It writes nothing: applying a change is meta_update_ad_set.
Rows Meta labels "unknown" are excluded from the ranking and reported separately.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `arguments` object, required
    - `ad_account_id` string: Meta ad account id such as act_1234567890. Omit it to use the primary account; if several accounts are active and none is primary the call fails and lists the valid ids.
    - `campaign_id` string: Report on one campaign. Omit both ids to report the whole account.
    - `ad_set_id` string: Report on one ad set.
    - `breakdown` 'age' | 'gender' | 'age_gender' | 'country' | 'region' | 'publisher_platform' | 'device_platform' | 'platform_position', required: Which dimension to rank.
    - `metric` 'auto' | 'cost_per_result' | 'roas' | 'ctr' | 'cpm': What to rank on. "auto" picks ROAS when revenue exists, otherwise cost per result.
    - `date_range` 'today' | 'yesterday' | 'last_7_days' | 'last_14_days' | 'last_30_days' | 'this_month' | 'last_month': Preset window. The "last N days" ones end yesterday, so no partial day is mixed in. Either this or start_date + end_date, never both.
    - `start_date` string: First day, YYYY-MM-DD. Needs end_date.
    - `end_date` string: Last day, YYYY-MM-DD, inclusive. Needs start_date.
    - `raw_data` boolean: Return compact JSON only (no markdown). Use when you will compute on the result.

## Response `200`

The tool ran. A write returns proposal_id and approve_url while the change waits for approval.

- SuccessEnvelope
  - `success` unknown, required
  - `tool` string, required
  - `data` object, required: Machine-readable result.
  - `markdown` string, required: The same result written for a person or a model.
  - `quota` Quota: Task usage for the current billing period.
    - `plan` string
    - `used` integer
    - `limit` integer
    - `period_end` string
    - `upgrade_url` string
  - `proposal_id` string: Present for writes. Nothing changes on the ad platform until it is approved.
  - `approve_url` string: Where a person approves the proposal.
  - `request_id` string, required

## Other responses

- `400`: Invalid arguments, or the ad account could not be resolved.
- `401`: Missing, invalid, revoked or expired API key.
- `402`: Monthly task quota used up, or the plan does not include this tool.
- `403`: The connected ad account lacks the access level this tool needs.
- `404`: Unknown tool name.
- `409`: Not connected, reconnect needed, confirmation required, a proposal already pending or no longer pending, an identical create that failed earlier today (proposal_failed_before), a create that duplicates an approved one (duplicate_create), the ad-account limit of the plan reached (account_limit), or an Idempotency-Key reused with different arguments.
- `429`: Rate limited by Adako or by the ad platform. See Retry-After.
- `500`: Unexpected error inside Adako.
- `502`: The ad platform returned an error.

---

[API](https://skmtc.dev/adako/apis/adako-rest-api.md) · [All operations](https://skmtc.dev/adako/apis/adako-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/adako/apis/adako-rest-api/revisions/59ee60d48a56?raw)
