# Best times to post on an Instagram account

`GET https://app.whatsetter.com/api/v1/instagram/insights/best-times`

On which days and at what hours the account's posts of the last 90
days do better than the average of their kind (each post against
its kind, a viral post counted as 3× at most), and the next three
moments to post (`next_slots`, one per day, in the next 7 days, at
least 30 minutes ahead). With too few posts (`basis: usual`,
`reason: few`), nothing above the average (`flat`) or no insights
permission (`none`), `next_slots` are usual hours (12:30, 19:00).
Requires scope `instagram:read`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `account_id` | query | string | no | Required when the workspace has several Instagram accounts. |
| `tz` | query | string | no | IANA time zone the days and hours are read in (default the account's agent's). |

## Example request

```bash
curl --request GET \
  --url 'https://app.whatsetter.com/api/v1/instagram/insights/best-times' \
  --header 'Authorization: Bearer ws_live_…'
```

## Responses

### 200: The best times

```json
{
  "data": {
    "account": {
      "id": "",
      "username": ""
    },
    "tz": "",
    "basis": "account",
    "reason": "few",
    "posts_read": 0,
    "posts_needed": 0,
    "best_day": {
      "weekday": "monday",
      "vs_average": 0
    },
    "best_hours": {
      "from_hour": 0,
      "to_hour": 0,
      "vs_average": 0
    },
    "by_weekday": [
      {
        "weekday": "",
        "posts": 0,
        "vs_average": 0
      }
    ],
    "by_hours": [
      {
        "from_hour": 0,
        "to_hour": 0,
        "posts": 0,
        "vs_average": 0
      }
    ],
    "next_slots": [
      {
        "at": "",
        "local": "",
        "score": 0
      }
    ]
  }
}
```

### 401: Missing, unknown or revoked API key

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 403: The key lacks the required scope (`insufficient_scope`), the plan does not have this part of the API (`not_in_plan`), or Instagram is not enabled on the workspace (`instagram_not_enabled`, Instagram routes)

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 404: Resource not found in this workspace

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 422: Invalid parameter or body (also an invalid or expired `cursor`)

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 429: Instagram limits the reads for this account right now (`instagram_rate_limited`).

### 502: Instagram does not answer right now (`instagram_unavailable`).


Source: https://docs.whatsetter.com/api-reference/operations/getinstagrambesttimes/
