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

# Retrieve product knowledge across documents and code

> Retrieves product-scoped knowledge through public source types. The request uses include values such as documents, generated, and code; raw corpus ids and storage backends are not part of the public contract.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/products/{productId}/knowledge/retrieve
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
paths:
  /api/v1/products/{productId}/knowledge/retrieve:
    post:
      tags:
        - Knowledge
      summary: Retrieve product knowledge across documents and code
      description: >-
        Retrieves product-scoped knowledge through public source types. The
        request uses include values such as documents, generated, and code; raw
        corpus ids and storage backends are not part of the public contract.
      operationId: postProductsProductIdKnowledgeRetrieve
      parameters:
        - schema:
            type: string
            minLength: 1
          required: true
          name: productId
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                query:
                  type: string
                  minLength: 1
                  maxLength: 2000
                include:
                  type: array
                  items:
                    type: string
                    enum:
                      - documents
                      - generated
                      - code
                  minItems: 1
                  maxItems: 3
                limit:
                  type: integer
                  minimum: 1
                  maximum: 50
                  default: 12
              required:
                - query
              additionalProperties: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    properties:
                      items:
                        type: array
                        items:
                          oneOf:
                            - type: object
                              properties:
                                title:
                                  type: string
                                snippet:
                                  type: string
                                score:
                                  type: number
                                  minimum: 0
                                  maximum: 1
                                kind:
                                  type: string
                                  enum:
                                    - document
                                source:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - document
                                    documentId:
                                      type: string
                                    sourceUrl:
                                      type: string
                                    documentType:
                                      type: string
                                    chunkId:
                                      type: string
                                  required:
                                    - type
                                  additionalProperties: false
                              required:
                                - title
                                - snippet
                                - score
                                - kind
                                - source
                              additionalProperties: false
                            - type: object
                              properties:
                                title:
                                  type: string
                                snippet:
                                  type: string
                                score:
                                  type: number
                                  minimum: 0
                                  maximum: 1
                                kind:
                                  type: string
                                  enum:
                                    - generated
                                source:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - generated
                                    itemId:
                                      type: string
                                    itemRevisionId:
                                      type: string
                                    sourceUrl:
                                      type: string
                                    generatedKind:
                                      type: string
                                    status:
                                      type: string
                                    chunkId:
                                      type: string
                                  required:
                                    - type
                                  additionalProperties: false
                              required:
                                - title
                                - snippet
                                - score
                                - kind
                                - source
                              additionalProperties: false
                            - type: object
                              properties:
                                title:
                                  type: string
                                snippet:
                                  type: string
                                score:
                                  type: number
                                  minimum: 0
                                  maximum: 1
                                kind:
                                  type: string
                                  enum:
                                    - code
                                source:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - code
                                    repositoryId:
                                      type: string
                                    repositoryFullName:
                                      type: string
                                    path:
                                      type: string
                                    startLine:
                                      type: integer
                                      exclusiveMinimum: 0
                                    endLine:
                                      type: integer
                                      exclusiveMinimum: 0
                                    language:
                                      type: string
                                    chunkId:
                                      type: string
                                  required:
                                    - type
                                    - repositoryId
                                    - path
                                    - startLine
                                    - endLine
                                  additionalProperties: false
                              required:
                                - title
                                - snippet
                                - score
                                - kind
                                - source
                              additionalProperties: false
                      warnings:
                        type: array
                        items:
                          type: object
                          properties:
                            code:
                              type: string
                              enum:
                                - generated_knowledge_unavailable
                                - code_repository_not_found
                                - code_repository_not_enrolled
                                - code_repository_not_indexed
                                - code_repository_access_revoked
                                - code_repository_index_failed
                                - code_repository_retrieval_degraded
                            message:
                              type: string
                            sourceType:
                              type: string
                              enum:
                                - documents
                                - generated
                                - code
                            repositoryId:
                              type: string
                          required:
                            - code
                            - message
                          additionalProperties: false
                    required:
                      - items
                      - warnings
                    additionalProperties: false
                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)

        - 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)
        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)

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

````