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

# Index a brand by website URL

> Look up a brand by website URL, or start indexing it if we do not
have it yet. Pass a single `websiteUrl`. Instagram and TikTok
profile URLs are accepted and resolved as creators.

This endpoint does not consume credits. An existing brand returns
`status: "already_exists"`. A new brand is created and sync is
queued, returning `status: "indexing"` and the new `brandId`.

Limited to 50 requests per minute for this endpoint.
This call is free.



## OpenAPI

````yaml https://app.spyglass.so/api/v1/openapi.json post /brands/index
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. Most
    endpoints charge per row returned. Bound what a call costs with
    `limit` on /brands/{id}/media, /insights and /landing-pages, and with
    `count` on /brands/search. POST /brands/index and GET
    /brands/{id}/index-status are free and are not blocked when the team
    is out of credits. 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: []
tags:
  - name: Lookup
    description: Find a brand you already know about.
  - name: Indexing
    description: Add a brand we do not have yet, then poll until ready.
  - name: Ads
    description: Creatives, insights, and landing pages for a brand.
paths:
  /brands/index:
    post:
      tags:
        - Indexing
      summary: Index a brand by website URL
      description: |-
        Look up a brand by website URL, or start indexing it if we do not
        have it yet. Pass a single `websiteUrl`. Instagram and TikTok
        profile URLs are accepted and resolved as creators.

        This endpoint does not consume credits. An existing brand returns
        `status: "already_exists"`. A new brand is created and sync is
        queued, returning `status: "indexing"` and the new `brandId`.

        Limited to 50 requests per minute for this endpoint.
        This call is free.
      operationId: indexBrand
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                websiteUrl:
                  type: string
                  minLength: 1
                  maxLength: 2048
              required:
                - websiteUrl
            example:
              websiteUrl: https://www.nike.com
      responses:
        '200':
          description: The brand id and whether indexing was started.
          content:
            application/json:
              schema:
                type: object
                properties:
                  brandId:
                    type: string
                  status:
                    type: string
                    enum:
                      - already_exists
                      - indexing
                required:
                  - brandId
                  - status
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '403':
          $ref: '#/components/responses/Forbidden'
        '405':
          $ref: '#/components/responses/MethodNotAllowed'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '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'
    Forbidden:
      description: The team's subscription is inactive, or your membership of it has ended.
      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'
    PayloadTooLarge:
      description: The request body exceeds the 100 KB limit.
      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
                - 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_.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.