> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.spyglass.so/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.spyglass.so/_mcp/server.

# Get an account's creative insights

GET https://api.spyglass.so/v2/account/{id}/insights

Return clustered creative themes for an account. `MEDIA_MIX` returns a
breakdown by media type; the other types return weekly buckets plus
ranked totals, highest first.

`maxDaysBack` filters both the weekly bucket series and ranked
`totals` to creatives that started within the requested window.

Limited to 120 requests per minute per user.
Costs $0.0005 per cluster returned, charged against your plan's monthly credits. The count field is what you were charged for.

Reference: https://docs.spyglass.so/api-reference/spyglass-api/social-media-account/get-account-insights

## Authentication

- `Authorization` header (bearer token, required) — An API key from Settings → API, prefixed sg_live_.

## Request

### Path parameters

- `id` (string, required) — Brand or creator id returned by POST /brands or POST /creators.

### Query parameters

- `type` (enum, required)
  - Allowed values: `HOOK`, `TARGET_PERSONA`, `AD_ANGLE`, `MEDIA_MIX`
- `maxDaysBack` (integer, optional)
- `limit` (integer, optional, default: 100)

## Response

### 200

Creative insights for the account.

- `account_insights_Response_200`

## Errors

### 400 Bad Request Error

The request body or query string failed validation. `details` lists the offending fields.

- `error` (ErrorError, required)

### 401 Unauthorized Error

The API key is missing, malformed, unknown, or revoked.

- `error` (ErrorError, required)

### 402 Payment Required Error

The team's monthly credits are exhausted.

- `error` (ErrorError, required)

### 403 Forbidden Error

The team's subscription is inactive, or your membership of it has ended.

- `error` (ErrorError, required)

### 404 Not Found Error

No brand matches that id.

- `error` (ErrorError, required)

### 405 Method Not Allowed Error

The HTTP method is not supported on this path. The Allow header lists what is. HEAD is refused on metered GET endpoints because it would be billed without returning data.

- `error` (ErrorError, required)

### 429 Too Many Requests Error

Too many requests for this user on this endpoint. Carries a Retry-After header. The per-minute limit is stated on the operation.

- `error` (ErrorError, required)

### 500 Internal Server Error

Something went wrong on our side.

- `error` (ErrorError, required)

## Types

### AccountInsightsResponse2000

- `type` ("MEDIA_MIX", required)
- `count` (integer, required)
- `rows` (list of AccountIdInsightsGetResponsesContentApplicationJsonSchemaOneOf0RowsItems, required)

### AccountInsightsResponse2001

- `type` (enum, required)
  - Allowed values: `HOOK`, `TARGET_PERSONA`, `AD_ANGLE`
- `count` (integer, required)
- `totals` (list of AccountIdInsightsGetResponsesContentApplicationJsonSchemaOneOf1TotalsItems, required)

### ErrorError

- `code` (enum, required)
  - Allowed values: `invalid_request`, `invalid_api_key`, `payload_too_large`, `out_of_credits`, `membership_ended`, `subscription_inactive`, `brand_not_found`, `not_found`, `method_not_allowed`, `rate_limited`, `internal_error`
- `message` (string, required)
- `details` (list of ErrorErrorDetailsItems, optional)

### AccountIdInsightsGetResponsesContentApplicationJsonSchemaOneOf0RowsItems

- `type` (string, required)
- `count` (integer, required)

### AccountIdInsightsGetResponsesContentApplicationJsonSchemaOneOf1TotalsItems

- `id` (string, required)
- `label` (string, required)
- `tags` (list of string, required, nullable)
- `total` (double, required)

### ErrorErrorDetailsItems

- `path` (string, required)
- `message` (string, required)

## Examples

**Response**

```json
{
  "count": 1,
  "rows": [
    {
      "count": 1,
      "type": "string"
    }
  ],
  "type": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.spyglass.so/v2/account/:id/insights"

querystring = {"limit":"50","type":"HOOK"}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.spyglass.so/v2/account/:id/insights?limit=50&type=HOOK';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.spyglass.so/v2/account/:id/insights?limit=50&type=HOOK"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.spyglass.so/v2/account/:id/insights?limit=50&type=HOOK")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.spyglass.so/v2/account/:id/insights?limit=50&type=HOOK")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.spyglass.so/v2/account/:id/insights?limit=50&type=HOOK', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.spyglass.so/v2/account/:id/insights?limit=50&type=HOOK");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.spyglass.so/v2/account/:id/insights?limit=50&type=HOOK")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```