Business

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
GET
GET
POST
GET
PATCH
DELETE
POST
GET

List all business knowledge documents window

Read-only access to parsed knowledge documents. Exposes hybrid search (search) and a drill-down window (window) so an agent (PHAI or MCP) can find and explore business knowledge chunks.

Required API key scopes

business_knowledge:read

Path parameters

  • id
    string

Query parameters

  • around_ordinal
    integer
  • radius
    integer

Example request

GET /api/projects/:project_id/business_knowledge/documents/:id/window
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/business_knowledge/documents/:id/window/

Example response

Status 200
RESPONSE
{
"chunk_id": "55e808e1-8ddc-49f1-92c9-6bbdcdff1c83",
"ordinal": 0,
"content": "string",
"heading_path": "string",
"source_name": "string",
"document_title": "string"
}


List all business knowledge sources

Required API key scopes

business_knowledge:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/business_knowledge/sources
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/business_knowledge/sources/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"source_type": "text",
"status": "pending",
"error_message": "string",
"document_count": 0,
"chunk_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"source_url": "http://example.com",
"last_refresh_at": "2019-08-24T14:15:22Z",
"last_refresh_status": "success",
"last_refresh_error": "string",
"refresh_interval": "manual",
"next_refresh_at": "string",
"has_unsafe_documents": true,
"embedding_status": "pending",
"crawl_mode": "single",
"crawl_config": null,
"original_filename": "string",
"file_content_type": "string",
"file_size_bytes": 0,
"always_include": true
}
]
}

Create business knowledge sources

Required API key scopes

business_knowledge:write

Request parameters

  • name
    string
  • text
    string
  • always_include
    boolean
    Default: false

Response


Example request

POST /api/projects/:project_id/business_knowledge/sources
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/business_knowledge/sources/\
-d name="string",\
-d text="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"source_type": "text",
"status": "pending",
"error_message": "string",
"document_count": 0,
"chunk_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"source_url": "http://example.com",
"last_refresh_at": "2019-08-24T14:15:22Z",
"last_refresh_status": "success",
"last_refresh_error": "string",
"refresh_interval": "manual",
"next_refresh_at": "string",
"has_unsafe_documents": true,
"embedding_status": "pending",
"crawl_mode": "single",
"crawl_config": null,
"original_filename": "string",
"file_content_type": "string",
"file_size_bytes": 0,
"always_include": true
}

Retrieve business knowledge sources

Required API key scopes

business_knowledge:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/business_knowledge/sources/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/business_knowledge/sources/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"source_type": "text",
"status": "pending",
"error_message": "string",
"document_count": 0,
"chunk_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"source_url": "http://example.com",
"last_refresh_at": "2019-08-24T14:15:22Z",
"last_refresh_status": "success",
"last_refresh_error": "string",
"refresh_interval": "manual",
"next_refresh_at": "string",
"has_unsafe_documents": true,
"embedding_status": "pending",
"crawl_mode": "single",
"crawl_config": null,
"original_filename": "string",
"file_content_type": "string",
"file_size_bytes": 0,
"always_include": true
}

Update business knowledge sources

Required API key scopes

business_knowledge:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • text
    string
  • always_include
    boolean

Response


Example request

PATCH /api/projects/:project_id/business_knowledge/sources/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/business_knowledge/sources/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"source_type": "text",
"status": "pending",
"error_message": "string",
"document_count": 0,
"chunk_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"source_url": "http://example.com",
"last_refresh_at": "2019-08-24T14:15:22Z",
"last_refresh_status": "success",
"last_refresh_error": "string",
"refresh_interval": "manual",
"next_refresh_at": "string",
"has_unsafe_documents": true,
"embedding_status": "pending",
"crawl_mode": "single",
"crawl_config": null,
"original_filename": "string",
"file_content_type": "string",
"file_size_bytes": 0,
"always_include": true
}

Delete business knowledge sources

Required API key scopes

business_knowledge:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/business_knowledge/sources/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/business_knowledge/sources/:id/

Example response

Status 204 No response body

Create business knowledge sources refresh

Path parameters

  • id
    string

Request parameters


    Response


    Example request

    POST /api/projects/:project_id/business_knowledge/sources/:id/refresh
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl
    -H 'Content-Type: application/json'\
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    <ph_app_host>/api/projects/:project_id/business_knowledge/sources/:id/refresh/\
    -d team_id="integer"

    Example response

    Status 200
    RESPONSE
    {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "team_id": 0,
    "name": "string",
    "source_type": "text",
    "status": "pending",
    "error_message": "string",
    "document_count": 0,
    "chunk_count": 0,
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z",
    "source_url": "http://example.com",
    "last_refresh_at": "2019-08-24T14:15:22Z",
    "last_refresh_status": "success",
    "last_refresh_error": "string",
    "refresh_interval": "manual",
    "next_refresh_at": "string",
    "has_unsafe_documents": true,
    "embedding_status": "pending",
    "crawl_mode": "single",
    "crawl_config": null,
    "original_filename": "string",
    "file_content_type": "string",
    "file_size_bytes": 0,
    "always_include": true
    }

    Retrieve business knowledge sources text

    Path parameters

    • id
      string

    Example request

    GET /api/projects/:project_id/business_knowledge/sources/:id/text
    export POSTHOG_PERSONAL_API_KEY=[your personal api key]
    curl \
    -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
    <ph_app_host>/api/projects/:project_id/business_knowledge/sources/:id/text/

    Example response

    Status 200

    Community questions

    Questions about this page? or post a community question.