> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spyglass.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Get a brand's creative insights

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

`maxDaysBack` narrows the weekly bucket series only. `totals` (and
therefore the charge) covers the brand's full clustering run.

Limited to 30 requests per minute for this endpoint.
Costs 1,000 microdollars ($0.0010) per cluster returned, charged against your plan's monthly credits. The count field is what you were charged for.



## OpenAPI

````yaml https://app.spyglass.so/api/v1/openapi.json get /brands/{id}/insights
openapi: 3.1.0
info:
  title: Spyglass API
  version: 1.0.0
  description: |-
    Query Spyglass ad intelligence over HTTP.

    ## Authentication
    Send your key as a bearer token: `Authorization: Bearer sg_live_...`.
    Create and revoke keys in Settings → API. A key is scoped to the
    team it was created for, and stops working if you leave that team.

    ## Billing
    Calls draw on the same monthly credits as the rest of Spyglass. Every
    endpoint charges per row returned. Bound what a call costs with
    `limit` on /brands/{id}/media, /insights and /landing-pages, and with
    `count` on /brands/search. Requests that fail validation, auth, or the
    credit check are never charged.

    Calls that run a language model — /brands/{id}/media in either mode,
    and /brands/search with `mode: "smart"` — are charged a minimum of one
    row even when nothing matches, because the model ran either way.

    ## Rate limits
    Three limits apply: 60 requests per minute per IP address, 120 per
    minute per API key, and a per-endpoint limit listed on each operation.
    Whichever is lowest applies. Exceeding any of them returns 429 with a
    Retry-After header.
servers:
  - url: https://app.spyglass.so/api/v1
security:
  - bearerAuth: []
paths:
  /brands/{id}/insights:
    get:
      summary: Get a brand's creative insights
      description: >-
        Return clustered creative themes for a brand. `MEDIA_MIX` returns a

        breakdown by media type; the other types return weekly buckets plus

        ranked totals, highest first.


        `maxDaysBack` narrows the weekly bucket series only. `totals` (and

        therefore the charge) covers the brand's full clustering run.


        Limited to 30 requests per minute for this endpoint.

        Costs 1,000 microdollars ($0.0010) per cluster returned, charged against
        your plan's monthly credits. The count field is what you were charged
        for.
      operationId: getBrandMediaInsights
      parameters:
        - name: id
          in: path
          required: true
          description: Brand id returned by POST /brands/search.
          schema:
            type: string
        - name: type
          in: query
          required: true
          schema:
            type: string
            enum:
              - USP
              - HOOK
              - TARGET_PERSONA
              - MEDIA_MIX
          example: HOOK
        - name: maxDaysBack
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 90
        - name: limit
          in: query
          required: false
          schema:
            default: 100
            type: integer
            minimum: 1
            maximum: 500
          example: 50
      responses:
        '200':
          description: Creative insights for the brand.
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      type:
                        type: string
                        const: MEDIA_MIX
                      count:
                        type: integer
                      rows:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                            count:
                              type: integer
                          required:
                            - type
                            - count
                    required:
                      - type
                      - count
                      - rows
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - USP
                          - HOOK
                          - TARGET_PERSONA
                      count:
                        type: integer
                      buckets:
                        type: array
                        items:
                          type: object
                          properties:
                            year:
                              type: number
                            week:
                              type: number
                            clusters:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                  label:
                                    type: string
                                  rawDelta:
                                    type: number
                                  percentDelta:
                                    anyOf:
                                      - type: number
                                      - type: 'null'
                                required:
                                  - id
                                  - label
                                  - rawDelta
                                  - percentDelta
                          required:
                            - year
                            - week
                            - clusters
                      totals:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            label:
                              type: string
                            tags:
                              anyOf:
                                - type: array
                                  items:
                                    type: string
                                - type: 'null'
                            total:
                              type: number
                          required:
                            - id
                            - label
                            - tags
                            - total
                    required:
                      - type
                      - count
                      - buckets
                      - totals
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '402':
          $ref: '#/components/responses/OutOfCredits'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/BrandNotFound'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  responses:
    InvalidRequest:
      description: >-
        The request body or query string failed validation. `details` lists the
        offending fields.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InvalidApiKey:
      description: The API key is missing, malformed, unknown, or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    OutOfCredits:
      description: The team's monthly credits are exhausted.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: The team's subscription is inactive, or your membership of it has ended.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BrandNotFound:
      description: No brand matches that id.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    MethodNotAllowed:
      description: >-
        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.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        Too many requests. Carries a Retry-After header. Limits are 60/minute
        per IP, 120/minute per key, plus the per-endpoint limit stated on the
        operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Something went wrong on our side.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - invalid_request
                - invalid_api_key
                - payload_too_large
                - out_of_credits
                - membership_ended
                - subscription_inactive
                - brand_not_found
                - method_not_allowed
                - rate_limited
                - internal_error
            message:
              type: string
            details:
              type: array
              items:
                type: object
                required:
                  - path
                  - message
                properties:
                  path:
                    type: string
                  message:
                    type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: An API key from Settings → API, prefixed sg_live_.

````