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

# Get cited-source analytics and citation events



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/sources/analytics
openapi: 3.1.0
info:
  title: The Prompting Company API
  version: 0.1.0
  description: >-
    Machine-readable contract for The Prompting Company organization-scoped API
    routes.
  contact:
    name: The Prompting Company
    url: https://promptingcompany.com/support
    email: support@promptingcompany.com
  license:
    name: Proprietary
    url: https://promptingcompany.com/terms
  termsOfService: https://promptingcompany.com/terms
servers:
  - url: https://app.promptingco.com
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
tags:
  - name: Visibility & Mentions
  - name: Knowledge
  - name: Content
  - name: Simulations
  - name: Apps & Publishing
  - name: Products
  - name: Service Status
paths:
  /api/v1/sources/analytics:
    get:
      tags:
        - Traffic & Sources
      summary: Get cited-source analytics and citation events
      operationId: getSourcesAnalytics
      parameters:
        - schema:
            type: array
            items:
              type: string
              minLength: 1
            description: >-
              Product ID scope. Repeat to include multiple products. Prefer this
              over simulationBrandIds.
          required: false
          description: >-
            Product ID scope. Repeat to include multiple products. Prefer this
            over simulationBrandIds.
          name: productId
          in: query
        - schema:
            type: array
            items:
              type: string
              minLength: 1
            deprecated: true
            description: >-
              Deprecated. Use productId. Existing cited-source callers may pass
              this repeated product ID parameter.
          required: false
          description: >-
            Deprecated. Use productId. Existing cited-source callers may pass
            this repeated product ID parameter.
          deprecated: true
          name: simulationBrandIds
          in: query
        - schema:
            type: integer
            minimum: 1
            default: 1
          required: false
          name: page
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 10
          required: false
          name: pageSize
          in: query
        - schema:
            type: integer
            minimum: 1
            default: 1
          required: false
          name: eventPage
          in: query
        - schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
          required: false
          name: eventPageSize
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: category
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: contentType
          in: query
        - schema:
            type: string
            enum:
              - self
              - competitor
              - other
            description: >-
              Filter by per-brand ownership of the source. Independent of
              category (content type). Requires the per-brand ownership sync in
              Tinybird (DEV-2310).
          required: false
          description: >-
            Filter by per-brand ownership of the source. Independent of category
            (content type). Requires the per-brand ownership sync in Tinybird
            (DEV-2310).
          name: ownership
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: model
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: searchTerm
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: viewId
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: topicId
          in: query
        - schema:
            type: string
            minLength: 1
          required: false
          name: regionId
          in: query
        - schema:
            type: boolean
            description: When regionId is set, include citation rows whose region is unset.
          required: false
          description: When regionId is set, include citation rows whose region is unset.
          name: includeNullRegions
          in: query
        - schema:
            type: boolean
            default: false
            description: >-
              Include row-level citation events. Defaults to false for
              performance. Only needed for detailed event analysis.
          required: false
          description: >-
            Include row-level citation events. Defaults to false for
            performance. Only needed for detailed event analysis.
          name: includeEvents
          in: query
        - schema:
            type: array
            items:
              type: string
              format: uri
          required: false
          name: urls
          in: query
        - schema:
            type: string
            enum:
              - mentioned
              - not_mentioned
            description: >-
              Filter to sources where the product was mentioned or not
              mentioned. Sources without mention analysis are excluded from
              both.
          required: false
          description: >-
            Filter to sources where the product was mentioned or not mentioned.
            Sources without mention analysis are excluded from both.
          name: productMentioned
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: startDate
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: endDate
          in: query
        - schema:
            type: string
            enum:
              - citation_count
              - unique_conversations
          required: false
          name: sortBy
          in: query
        - schema:
            type: string
            enum:
              - asc
              - desc
          required: false
          name: sortOrder
          in: query
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                            hostname:
                              type: string
                            path:
                              type: string
                            search:
                              type: string
                            citation_count:
                              type: integer
                            unique_conversations:
                              type: integer
                            category:
                              type:
                                - string
                                - 'null'
                            content_type:
                              type:
                                - string
                                - 'null'
                            ownership:
                              type:
                                - string
                                - 'null'
                            brand_name:
                              type: string
                            brand_slug:
                              type:
                                - string
                                - 'null'
                            simulation_brand_id:
                              type: string
                            answer_engines:
                              type: array
                              items:
                                type: string
                            product_mentioned:
                              type:
                                - boolean
                                - 'null'
                            title:
                              type:
                                - string
                                - 'null'
                            author_id:
                              type: string
                            authorId:
                              type: string
                            author_name:
                              type: string
                            authorName:
                              type: string
                            creator_id:
                              type:
                                - string
                                - 'null'
                            creatorId:
                              type:
                                - string
                                - 'null'
                            creator_name:
                              type:
                                - string
                                - 'null'
                            creatorName:
                              type:
                                - string
                                - 'null'
                            date:
                              type: string
                            created_at:
                              type: string
                            createdAt:
                              type: string
                          required:
                            - hostname
                            - citation_count
                      total:
                        type: integer
                      totalCitations:
                        type: integer
                      page:
                        type: integer
                      pageSize:
                        type: integer
                      events:
                        type: array
                        items:
                          type: object
                          properties:
                            date:
                              type: string
                            product_id:
                              type: string
                            product_name:
                              type: string
                            product_slug:
                              type: string
                            prompt_id:
                              type: string
                            prompt_text:
                              type: string
                            topic_id:
                              type: string
                            topic_name:
                              type: string
                            model:
                              type: string
                            citation_url:
                              type: string
                            citation_domain:
                              type: string
                            source_category:
                              type: string
                            content_type:
                              type: string
                            mentioned_product_id:
                              type:
                                - string
                                - 'null'
                            mentioned_product_name:
                              type: string
                            url_citation_count:
                              type: number
                            conversation_query_run_id:
                              type: string
                            view_ids:
                              type: array
                              items:
                                type: string
                            view_names:
                              type: array
                              items:
                                type: string
                            overall_sentiment:
                              type:
                                - string
                                - 'null'
                              enum:
                                - positive
                                - neutral
                                - negative
                                - null
                          required:
                            - date
                            - product_id
                            - product_name
                            - product_slug
                            - prompt_id
                            - prompt_text
                            - topic_id
                            - topic_name
                            - model
                            - citation_url
                            - citation_domain
                            - source_category
                            - content_type
                            - mentioned_product_name
                            - url_citation_count
                            - conversation_query_run_id
                            - view_ids
                            - view_names
                      eventPagination:
                        type: object
                        properties:
                          page:
                            type: integer
                          pageSize:
                            type: integer
                          total:
                            type: integer
                          totalPages:
                            type: integer
                        required:
                          - page
                          - pageSize
                          - total
                          - totalPages
                    required:
                      - data
                      - total
                      - totalCitations
                      - page
                      - pageSize
                      - events
                      - eventPagination
                required:
                  - ok
                  - data
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - false
                  code:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - ok
                  - code
                  - message
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - false
                  code:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - ok
                  - code
                  - message
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - false
                  code:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - ok
                  - code
                  - message
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - false
                  code:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - ok
                  - code
                  - message
        '422':
          description: Validation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - false
                  code:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - ok
                  - code
                  - message
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - false
                  code:
                    type: string
                  message:
                    type: string
                  details: {}
                required:
                  - ok
                  - code
                  - message
      security:
        - apiKeyAuth: []
        - bearerAuth: []
        - cookieAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Organization-scoped API key. Available scopes:

        - content:read: Read site pages, markdown content, and llms.txt files

        - content:write: Create, update, and delete site pages and content

        - prompts:read: Read prompts, topics, and prompt analysis results

        - prompts:write: Create, update, archive prompts

        - simulations:read: Read agent-simulation tasks, runs, environments, and
        analytics

        - simulations:write: Create and trigger simulation runs

        - logs:read: Read AI-traffic logs and request-level audit events

        - analytics:read: Read analytics aggregates (rankings, mentions,
        sources, SOV)

        - analytics:write: Write events to analytics

        - products:read: Read product metadata and competitor data

        - products:write: Update product settings and competitor lists
      x-scopes:
        content:read: Read site pages, markdown content, and llms.txt files
        content:write: Create, update, and delete site pages and content
        prompts:read: Read prompts, topics, and prompt analysis results
        prompts:write: Create, update, archive prompts
        simulations:read: Read agent-simulation tasks, runs, environments, and analytics
        simulations:write: Create and trigger simulation runs
        logs:read: Read AI-traffic logs and request-level audit events
        analytics:read: Read analytics aggregates (rankings, mentions, sources, SOV)
        analytics:write: Write events to analytics
        products:read: Read product metadata and competitor data
        products:write: Update product settings and competitor lists
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer session or OAuth access token. Available OAuth scopes:

        - content:read: Read site pages, markdown content, and llms.txt files

        - content:write: Create, update, and delete site pages and content

        - prompts:read: Read prompts, topics, and prompt analysis results

        - prompts:write: Create, update, archive prompts

        - simulations:read: Read agent-simulation tasks, runs, environments, and
        analytics

        - simulations:write: Create and trigger simulation runs

        - logs:read: Read AI-traffic logs and request-level audit events

        - analytics:read: Read analytics aggregates (rankings, mentions,
        sources, SOV)

        - analytics:write: Write events to analytics

        - products:read: Read product metadata and competitor data

        - products:write: Update product settings and competitor lists
      x-scopes:
        content:read: Read site pages, markdown content, and llms.txt files
        content:write: Create, update, and delete site pages and content
        prompts:read: Read prompts, topics, and prompt analysis results
        prompts:write: Create, update, archive prompts
        simulations:read: Read agent-simulation tasks, runs, environments, and analytics
        simulations:write: Create and trigger simulation runs
        logs:read: Read AI-traffic logs and request-level audit events
        analytics:read: Read analytics aggregates (rankings, mentions, sources, SOV)
        analytics:write: Write events to analytics
        products:read: Read product metadata and competitor data
        products:write: Update product settings and competitor lists
    cookieAuth:
      type: apiKey
      in: cookie
      name: better-auth.session_token
      description: First-party browser session cookie.

````