# Side-by-side metrics for up to ten accounts

`POST https://api.handlesapi.com/v1/insights/x/compare`

The POST /v1/insights/x/compare endpoint of Handles API (Insights): Side-by-side metrics for up to ten accounts. One call costs 1 credit (a catalog read) and needs the `insights:read` scope. A success returns JSON as `{ data, meta }`.

Competitive analysis in one call: the same engagement block and cohort placement for every handle in the body, plus a ranking by engagement rate so follower count does not decide the answer. Handles we have not measured come back with null metrics and their coverage marker rather than being dropped.

- At most 10 handles per call.
- Ranking excludes handles with no tweet coverage; they are still present in accounts with coverage.tweets=false.
- Rates are only comparable between accounts of similar size. peer_percentile is the size-adjusted number and is the fairer column to sort a competitive set on.

## Request

```bash
curl -X POST "https://api.handlesapi.com/v1/insights/x/compare" \
  -H "Authorization: Bearer $HANDLES_API_KEY"
```

`HANDLES_API_KEY` is a key from your dashboard; send it as `Authorization: Bearer` or `x-api-key`.

## Request body

JSON, sent with `Content-Type: application/json`.

- `handles` (array of string, required): Array of X handles without the @, 1-10 of them, for example ["elonmusk","BillGates","NASA"]. Duplicates are collapsed case-insensitively before they take a slot.
- `metric` (enum, optional): Echoed onto the response for clients that batch several metrics.

## Response

```json
{
  "data": {
    "requested": 3,
    "resolved": 3,
    "ranking": [
      {
        "handle": "elonmusk",
        "engagement_rate": 0.0471,
        "peer_percentile": 99.7,
        "followers": 241382119
      },
      {
        "handle": "BillGates",
        "engagement_rate": 0.0142,
        "peer_percentile": 71,
        "followers": 65130442
      },
      {
        "handle": "NASA",
        "engagement_rate": 0.0117,
        "peer_percentile": 62,
        "followers": 96204881
      }
    ],
    "accounts": [
      {
        "handle": "elonmusk",
        "found": true,
        "coverage": {
          "tweets": true,
          "reliable": true
        }
      }
    ]
  },
  "meta": {
    "request_id": "req_9f2c41a8b3d5",
    "generated_at": "2026-08-23T09:14:02.317Z",
    "took_ms": 42
  }
}
```

## Errors

- 401 unauthorized: No key was sent, or the key is unknown or revoked.
- 402 quota_exceeded: Your plan's credits for this period are used up and overage is off (or its cap is reached). Waiting does not help: upgrade, or turn on overage in the dashboard.
- 422 invalid_request: A parameter is malformed, out of range or mutually exclusive with another. details names the offending fields.
- 429 rate_limited, live_limit_reached: Too many requests. rate_limited clears when the minute window resets (see Retry-After); live_limit_reached (Free plan) clears at 00:00 UTC.
- 500 internal_error: Something failed on our side. The call was not charged; quote the request_id to support.
- 503 upstream_timeout, upstream_error, platform_unavailable, service_unavailable: The call could not be served right now and was not charged. upstream_timeout / upstream_error: a data source was slow or failed, retry with backoff. platform_unavailable: live reads for that platform are paused. service_unavailable: retry shortly.

Failures use the error envelope `{ error: { code, message, request_id } }`: https://handlesapi.com/docs/errors

Source: https://handlesapi.com/docs/reference/insights-x-compare
