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

# Generate a product performance report PDF

> Returns date-range analytics and a base64-encoded PDF. Version 1 is a legacy summary. Set version=2 for the one-page report with four models, selected industry ranks and pinned competitors, citation coverage, winning and losing topics, and optional perception. Perception defaults on (includePerception=false hides it); recommendation rate defaults off (showRecommendationRate=true shows it). Toggles apply to version 2 only. Choose week (any date in a Monday–Sunday week), or from/to (inclusive UTC dates, maximum 366 days). Defaults to the last complete week. Requires access to the product's organization, not an admin role.



## OpenAPI

````yaml /api-reference/openapi.json get /api/v1/weekly-reports/generate
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
  - name: Account
paths:
  /api/v1/weekly-reports/generate:
    get:
      tags:
        - Visibility & Mentions
      summary: Generate a product performance report PDF
      description: >-
        Returns date-range analytics and a base64-encoded PDF. Version 1 is a
        legacy summary. Set version=2 for the one-page report with four models,
        selected industry ranks and pinned competitors, citation coverage,
        winning and losing topics, and optional perception. Perception defaults
        on (includePerception=false hides it); recommendation rate defaults off
        (showRecommendationRate=true shows it). Toggles apply to version 2 only.
        Choose week (any date in a Monday–Sunday week), or from/to (inclusive
        UTC dates, maximum 366 days). Defaults to the last complete week.
        Requires access to the product's organization, not an admin role.
      operationId: getWeeklyReportsGenerate
      parameters:
        - schema:
            type: string
            minLength: 1
          required: true
          name: productId
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: week
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: from
          in: query
        - schema:
            type: string
            pattern: ^\d{4}-\d{2}-\d{2}$
          required: false
          name: to
          in: query
        - schema:
            type: string
            enum:
              - '1'
              - '2'
          required: false
          name: version
          in: query
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
          required: false
          name: includePerception
          in: query
        - schema:
            type: string
            enum:
              - 'true'
              - 'false'
          required: false
          name: showRecommendationRate
          in: query
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      report:
                        type: object
                        properties:
                          product:
                            type: object
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                              slug:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - id
                              - name
                              - slug
                          period:
                            type: object
                            properties:
                              from:
                                type: string
                              to:
                                type: string
                              days:
                                type: number
                              kind:
                                type: string
                                enum:
                                  - week
                                  - custom
                              previousFrom:
                                type: string
                              previousTo:
                                type: string
                            required:
                              - from
                              - to
                              - days
                              - kind
                              - previousFrom
                              - previousTo
                          generatedAt:
                            type: string
                          sov:
                            type:
                              - number
                              - 'null'
                          previousSov:
                            type:
                              - number
                              - 'null'
                          changePercentagePoints:
                            type:
                              - number
                              - 'null'
                          inferenceVisits:
                            type:
                              - number
                              - 'null'
                          models:
                            type:
                              - array
                              - 'null'
                            items:
                              type: object
                              properties:
                                engine:
                                  type: string
                                name:
                                  type: string
                                sov:
                                  type: number
                              required:
                                - engine
                                - name
                                - sov
                          rankings:
                            type:
                              - array
                              - 'null'
                            items:
                              type: object
                              properties:
                                productId:
                                  type: string
                                name:
                                  type: string
                                sov:
                                  type: number
                                rank:
                                  type: number
                              required:
                                - productId
                                - name
                                - sov
                                - rank
                          topics:
                            type:
                              - array
                              - 'null'
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                title:
                                  type: string
                                sov:
                                  type:
                                    - number
                                    - 'null'
                                status:
                                  type:
                                    - string
                                    - 'null'
                                  enum:
                                    - winning
                                    - contested
                                    - opportunity
                                    - null
                              required:
                                - id
                                - title
                                - sov
                                - status
                          unavailable:
                            type: array
                            items:
                              type: string
                          v2:
                            type: object
                            properties:
                              includePerception:
                                type: boolean
                              showRecommendationRate:
                                type: boolean
                              pinnedCompetitors:
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: object
                                  properties:
                                    productId:
                                      type: string
                                    name:
                                      type: string
                                  required:
                                    - productId
                                    - name
                              totalPages:
                                type:
                                  - number
                                  - 'null'
                              citationRate:
                                type:
                                  - number
                                  - 'null'
                              recommendationRate:
                                type:
                                  - number
                                  - 'null'
                              previousRecommendationRate:
                                type:
                                  - number
                                  - 'null'
                              recommendationChangePercentagePoints:
                                type:
                                  - number
                                  - 'null'
                              perceptions:
                                type: object
                                properties:
                                  positive:
                                    type:
                                      - array
                                      - 'null'
                                    items:
                                      type: object
                                      properties:
                                        label:
                                          type: string
                                        count:
                                          type: number
                                        quote:
                                          type: string
                                      required:
                                        - label
                                        - count
                                        - quote
                                  negative:
                                    type:
                                      - array
                                      - 'null'
                                    items:
                                      type: object
                                      properties:
                                        label:
                                          type: string
                                        count:
                                          type: number
                                        quote:
                                          type: string
                                      required:
                                        - label
                                        - count
                                        - quote
                                required:
                                  - positive
                                  - negative
                              pagesCited:
                                type:
                                  - number
                                  - 'null'
                              citedPages:
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: object
                                  properties:
                                    hostname:
                                      type: string
                                    path:
                                      type: string
                                    title:
                                      type:
                                        - string
                                        - 'null'
                                    citations:
                                      type: number
                                  required:
                                    - hostname
                                    - path
                                    - citations
                              visitedPages:
                                type:
                                  - array
                                  - 'null'
                                items:
                                  type: object
                                  properties:
                                    hostname:
                                      type: string
                                    path:
                                      type: string
                                    title:
                                      type:
                                        - string
                                        - 'null'
                                    visits:
                                      type: number
                                  required:
                                    - hostname
                                    - path
                                    - visits
                            required:
                              - recommendationRate
                              - previousRecommendationRate
                              - recommendationChangePercentagePoints
                              - perceptions
                              - pagesCited
                              - citedPages
                              - visitedPages
                        required:
                          - product
                          - period
                          - generatedAt
                          - sov
                          - previousSov
                          - changePercentagePoints
                          - inferenceVisits
                          - models
                          - rankings
                          - topics
                          - unavailable
                      file:
                        type: object
                        properties:
                          filename:
                            type: string
                          contentType:
                            type: string
                            enum:
                              - application/pdf
                          base64:
                            type: string
                        required:
                          - filename
                          - contentType
                          - base64
                    required:
                      - report
                      - file
                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, Radar topics, prompt suggestions,
        and prompt analysis results

        - prompts:write: Create, update, archive prompts and generate, edit, or
        review prompt suggestions

        - 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, Radar topics, prompt suggestions, and prompt
          analysis results
        prompts:write: >-
          Create, update, archive prompts and generate, edit, or review prompt
          suggestions
        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, Radar topics, prompt suggestions,
        and prompt analysis results

        - prompts:write: Create, update, archive prompts and generate, edit, or
        review prompt suggestions

        - 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, Radar topics, prompt suggestions, and prompt
          analysis results
        prompts:write: >-
          Create, update, archive prompts and generate, edit, or review prompt
          suggestions
        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.

````

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