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

# Viewer API

> Returns the identity of the credential used to authenticate the request: an API key or a user session token (JWT). Use it to verify a credential during integration setup (a `200` response means the credential is valid; `401`/`403` means it is missing, unknown, or revoked) and to display which API key and organization are connected. A key an [agent bought](/agents/overview) also says how it was paid for and how to add credits. Requests to this endpoint are free: they never consume API credits.

<Note>
  Calling this endpoint is **free**. It never consumes API credits, so you
  can use it to verify a credential during integration setup or on a health
  check. API key responses include the key's current credit `usage`, matching
  the `x-api-key-quota` and `x-api-key-approximate-usage` headers returned by
  billable endpoints.
</Note>


## OpenAPI

````yaml GET /v2/viewer
openapi: 3.0.1
info:
  title: Brandfetch API
  description: >-
    Our APIs help you personalize your customer journey through unique branded
    experiences.
  license:
    name: MIT
  version: 1.0.0
  contact:
    name: Brandfetch Support
    url: https://brandfetch.com
    email: support@brandfetch.io
servers:
  - url: https://api.brandfetch.io
security: []
paths:
  /v2/viewer:
    get:
      tags:
        - viewer
      summary: Get the authenticated viewer
      description: >-
        Returns the identity of the credential used to authenticate the request:
        an API key or a user session token (JWT). Use it to verify a credential
        during integration setup (a `200` response means the credential is
        valid; `401`/`403` means it is missing, unknown, or revoked) and to
        display which API key and organization are connected. A key an [agent
        bought](/agents/overview) also says how it was paid for and how to add
        credits. Requests to this endpoint are free: they never consume API
        credits.
      operationId: getViewer
      responses:
        '200':
          description: >-
            The presented credential is valid. The `type` property indicates
            which kind of credential authenticated the request and determines
            the response shape.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ViewerApiKeyResponse'
                  - $ref: '#/components/schemas/ViewerUserResponse'
                discriminator:
                  propertyName: type
                  mapping:
                    api-key: '#/components/schemas/ViewerApiKeyResponse'
                    user: '#/components/schemas/ViewerUserResponse'
              examples:
                apiKey:
                  summary: Authenticated with an API key
                  value:
                    type: api-key
                    id: id5ZQvmz9A
                    urn: >-
                      urn:brandfetch:organization:cl5s9fps1275071ol9h7gs072m:api-key:id5ZQvmz9A
                    name: Production key
                    createdAt: '2026-05-12T09:14:07.000Z'
                    usage:
                      used: 1234
                      quota: 250000
                    organization:
                      id: cl5s9fps1275071ol9h7gs072m
                      urn: urn:brandfetch:organization:cl5s9fps1275071ol9h7gs072m
                      name: Acme Inc.
                agentKey:
                  summary: Authenticated with an API key an agent bought
                  value:
                    type: api-key
                    id: idA9kR2mXw
                    urn: >-
                      urn:brandfetch:organization:cm1q8x0b2000308l4f9ae2k7d:api-key:idA9kR2mXw
                    name: Agent Key
                    createdAt: '2026-09-24T18:02:51.000Z'
                    usage:
                      used: 37
                      quota: 2000
                    organization:
                      id: cm1q8x0b2000308l4f9ae2k7d
                      urn: urn:brandfetch:organization:cm1q8x0b2000308l4f9ae2k7d
                      name: Agent 0x0000…0a11
                    agent:
                      payer:
                        type: wallet
                        network: eip155:8453
                        address: '0x0000000000000000000000000000000000000a11'
                      topUp:
                        method: POST
                        url: https://api.brandfetch.io/v2/agents/access
                        note: >-
                          Pay again from the same wallet to add credits to this
                          key. Add rotateKey=true to replace the key while doing
                          so, which is also how to recover a lost key.
                user:
                  summary: Authenticated with a user session token
                  value:
                    type: user
                    id: cl2xkl6h90007w135197r5abc
                    urn: urn:brandfetch:user:cl2xkl6h90007w135197r5abc
                    name: Jane Doe
                    email: jane@acme.com
                    createdAt: '2025-11-02T16:41:12.000Z'
        '401':
          description: >-
            Unauthorized. The request carries no Authorization header. The body
            points an agent without a key at how to get access.
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - agentAccess
                properties:
                  message:
                    type: string
                    enum:
                      - Unauthorized
                  agentAccess:
                    type: object
                    description: >-
                      Where an agent without an API key can get access: buy a
                      key with an x402 or MPP payment, or pay for each request
                      individually.
                    required:
                      - description
                      - documentation
                      - offer
                    properties:
                      description:
                        type: string
                        description: The two ways in, in prose.
                      documentation:
                        type: string
                        format: uri
                        description: The agent access guide.
                      offer:
                        type: string
                        format: uri
                        description: >-
                          The agent access endpoint. `GET` it to read the offer:
                          the price, how to pay with each protocol, and the
                          per-request alternative.
              example:
                message: Unauthorized
                agentAccess:
                  description: >-
                    An agent without an API key can buy one with an x402 or MPP
                    payment, or pay for each Brand API, Brand Context API and
                    Transaction API request individually. The offer describes
                    both.
                  documentation: https://docs.brandfetch.com/agents/overview
                  offer: https://api.brandfetch.io/v2/agents/access
        '403':
          description: >-
            Forbidden. The credential was rejected, e.g. an empty or unknown
            credential, a revoked API key or an expired session token.
      security:
        - bearerAuth: []
components:
  schemas:
    ViewerApiKeyResponse:
      type: object
      title: API key
      description: The authenticated API key.
      required:
        - type
        - id
        - urn
        - name
        - createdAt
        - usage
        - organization
      properties:
        type:
          type: string
          enum:
            - api-key
          description: The kind of credential that authenticated the request.
        id:
          type: string
          description: Id of the API key.
        urn:
          type: string
          description: >-
            URN of the API key, e.g.
            `urn:brandfetch:organization:{organization.id}:api-key:{id}`.
        name:
          type: string
          nullable: true
          description: Display name of the API key, as set in the dashboard.
        createdAt:
          type: string
          format: date-time
          nullable: true
          description: When the API key was created.
        usage:
          type: object
          description: >-
            API credit consumption for the current billing period, mirroring the
            `x-api-key-quota` and `x-api-key-approximate-usage` response headers
            of billable endpoints. Because this endpoint is free, `used` is the
            exact count, not approximated one ahead like the header.
          required:
            - used
            - quota
          properties:
            used:
              type: integer
              description: API credits consumed so far in the current billing period.
            quota:
              type: integer
              description: API credit allowance for the current billing period.
        organization:
          type: object
          description: The organization the API key belongs to.
          required:
            - id
            - urn
            - name
          properties:
            id:
              type: string
              description: Id of the organization.
            urn:
              type: string
              description: >-
                URN of the organization, e.g.
                `urn:brandfetch:organization:{id}`.
            name:
              type: string
              nullable: true
              description: Display name of the organization.
        agent:
          type: object
          description: >-
            Present only on a key an agent bought through `POST
            /v2/agents/access`: how it was paid for, and how to add credits.
          required:
            - payer
            - topUp
          properties:
            payer:
              description: >-
                What paid for the key: an x402 or Tempo wallet, which can pay
                again to add credits to this key, or a card, which buys a new
                key with every payment.
              oneOf:
                - type: object
                  title: Wallet
                  required:
                    - type
                    - network
                    - address
                  properties:
                    type:
                      type: string
                      enum:
                        - wallet
                    network:
                      type: string
                      description: >-
                        CAIP-2 network the wallet paid on, e.g. `eip155:8453`
                        for x402 on Base.
                    address:
                      type: string
                      description: The wallet's address, in lowercase.
                - type: object
                  title: Card
                  required:
                    - type
                  properties:
                    type:
                      type: string
                      enum:
                        - card
              discriminator:
                propertyName: type
            topUp:
              type: object
              description: How to add credits.
              required:
                - method
                - url
                - note
              properties:
                method:
                  type: string
                  enum:
                    - POST
                url:
                  type: string
                  format: uri
                  description: The agent access endpoint.
                note:
                  type: string
                  description: What paying again does for this key.
    ViewerUserResponse:
      type: object
      title: User
      description: The authenticated user (dashboard session token).
      required:
        - type
        - id
        - urn
        - name
        - email
        - createdAt
      properties:
        type:
          type: string
          enum:
            - user
          description: The kind of credential that authenticated the request.
        id:
          type: string
          description: Id of the user.
        urn:
          type: string
          description: URN of the user, e.g. `urn:brandfetch:user:{id}`.
        name:
          type: string
          nullable: true
          description: Full name of the user.
        email:
          type: string
          nullable: true
          description: Email address of the user.
        createdAt:
          type: string
          format: date-time
          nullable: true
          description: When the user account was created.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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