# Find when an X account should post

`POST https://api.handlesapi.com/v1/tools/best-posting-time`

The POST /v1/tools/best-posting-time endpoint of Handles API (Tools): Find when an X account should post. One call costs 2 credits (a live read of the platform) and needs the `tools:use` scope. A success returns JSON as `{ data, meta }`.

Builds a 7x24 engagement heatmap from an account's post history, estimates its posting timezone, and returns the best and worst slots, per-day and per-hour summaries, the posting pattern (cadence, consistency, weekday versus weekend), and a 0-100 timing score.

This is a sensitive scope. Keys are not granted it by default, and calls are audited.

Metered as a live call: it counts against the separate live-per-minute bucket as well as your normal rate limit, because it reaches an upstream source.

- This tool pages the post history and can spend up to five upstream calls, more than any other X tool here.
- The timezone is inferred from posting behaviour, not from the account. `heatmap` hours are in that inferred timezone.
- heatmap contains only slots the account has actually posted in, not a padded 168-cell grid.

## Request

```bash
curl -X POST "https://api.handlesapi.com/v1/tools/best-posting-time" \
  -H "Authorization: Bearer $HANDLES_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "handle": "elonmusk"
}'
```

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

- `handle` (string, required): X handle. Accepts a bare name, @name, or a profile URL. Also accepted as username.

```json
{
  "handle": "elonmusk"
}
```

## Response

```json
{
  "data": {
    "profile": {
      "handle": "swyx",
      "twitter_id": "33521530",
      "name": "swyx",
      "avatar_url": "https://pbs.twimg.com/profile_images/1610205747724443648/0DVR0Xnw.jpg",
      "verified": true,
      "followers": 118420,
      "following": 2412,
      "total_posts": 41208,
      "created_at": "2009-04-19T15:02:33.000Z",
      "account_age_days": 6335
    },
    "posts_analyzed": 180,
    "date_range": {
      "from": "2026-05-02T11:20:00.000Z",
      "to": "2026-08-22T18:44:00.000Z"
    },
    "timezone": {
      "estimated": "UTC-8 (US Pacific)",
      "utc_offset": -8
    },
    "heatmap": [
      {
        "day": 2,
        "hour": 9,
        "posts": 14,
        "avg_engagement": 412,
        "avg_likes": 318,
        "avg_retweets": 44,
        "avg_replies": 50,
        "avg_views": 28400,
        "total_engagement": 5768
      }
    ],
    "best_times": [
      {
        "day": 2,
        "day_name": "Tuesday",
        "hour": 9,
        "hour_label": "9:00 AM",
        "avg_engagement": 412,
        "avg_views": 28400,
        "posts": 14
      }
    ],
    "worst_times": [
      {
        "day": 6,
        "day_name": "Saturday",
        "hour": 23,
        "hour_label": "11:00 PM",
        "avg_engagement": 38,
        "avg_views": 2900,
        "posts": 4
      }
    ],
    "best_day": {
      "day": 2,
      "day_name": "Tuesday",
      "posts": 31,
      "avg_engagement": 366,
      "avg_views": 24800,
      "total_engagement": 11346
    },
    "worst_day": {
      "day": 0,
      "day_name": "Sunday",
      "posts": 12,
      "avg_engagement": 92,
      "avg_views": 7100,
      "total_engagement": 1104
    },
    "best_hour": {
      "hour": 9,
      "posts": 27,
      "avg_engagement": 388,
      "avg_views": 26100,
      "total_engagement": 10476
    },
    "worst_hour": {
      "hour": 23,
      "posts": 6,
      "avg_engagement": 41,
      "avg_views": 3100,
      "total_engagement": 246
    },
    "day_summaries": [],
    "hour_summaries": [],
    "pattern": {
      "posts_per_day": 1.6,
      "posts_per_week": 11.2,
      "most_active_day": "Tuesday",
      "most_active_hour": "9:00 AM",
      "consistency": "consistent",
      "avg_hours_between_posts": 14.8,
      "weekday_vs_weekend": {
        "weekday_avg_engagement": 318,
        "weekend_avg_engagement": 121,
        "weekday_posts": 142,
        "weekend_posts": 38,
        "winner": "weekday",
        "difference": 162.8
      }
    },
    "engagement": {
      "engagement_rate": 0.31,
      "avg_likes": 284,
      "avg_retweets": 38,
      "avg_replies": 44,
      "avg_views": 21400
    },
    "timing_score": 74,
    "timing_grade": "good",
    "summary": {
      "recommendations": [
        "Tuesday 9:00 AM is this account's strongest slot by a wide margin.",
        "Weekend posts earn 62% less engagement. Move them into the week."
      ]
    }
  },
  "meta": {
    "request_id": "req_9f2c41a8b3d5",
    "generated_at": "2026-08-23T09:14:02.317Z",
    "took_ms": 42,
    "cache_age_s": 0
  }
}
```

## 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/tools-best-posting-time
