Notebooks

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

Endpoints

POST
POST
GET
GET
GET
GET
GET
GET

Create notebooks widget

The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.

Required API key scopes

notebook:writequery:read

Path parameters

  • node_id
    string
  • short_id
    string

Request parameters

  • name
    string
  • description
    string
  • tags
    array

Response


Example request

POST /api/projects/:project_id/notebooks/:short_id/widgets/:node_id/publish
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/notebooks/:short_id/widgets/:node_id/publish/\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"tags": [
"string"
],
"publication_status": "published",
"current_version": {
"generation_cost_usd": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"version": 0,
"operation": "initial",
"model": "string",
"artifact_url": "http://example.com",
"build_status": "queued",
"build_hash": "string",
"frame_names": [
"string"
],
"input_contract": [
{
"slot": "string",
"sourceName": "string",
"columns": [
{
"name": "string",
"type": "string"
}
],
"schemaHash": "string"
}
],
"security_review": {
"severity": "none",
"summary": "string",
"findings": [
{
"severity": "low",
"title": "string",
"details": "string"
}
],
"model": "string",
"review_version": "string",
"reviewed_at": "2019-08-24T14:15:22Z"
},
"has_demo_data": true,
"created_at": "2019-08-24T14:15:22Z"
},
"pending_version": {
"generation_cost_usd": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"title": "string",
"version": 0,
"operation": "initial",
"model": "string",
"artifact_url": "http://example.com",
"build_status": "queued",
"build_hash": "string",
"frame_names": [
"string"
],
"input_contract": [
{
"slot": "string",
"sourceName": "string",
"columns": [
{
"name": "string",
"type": "string"
}
],
"schemaHash": "string"
}
],
"security_review": {
"severity": "none",
"summary": "string",
"findings": [
{
"severity": "low",
"title": "string",
"details": "string"
}
],
"model": "string",
"review_version": "string",
"reviewed_at": "2019-08-24T14:15:22Z"
},
"has_demo_data": true,
"created_at": "2019-08-24T14:15:22Z"
},
"version_count": 0,
"instance_count": 0,
"created_at": "2019-08-24T14:15:22Z",
"published_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
Status 400
RESPONSE
{
"code": "string",
"detail": "string"
}
Status 403
RESPONSE
{
"code": "string",
"detail": "string"
}
Status 404
RESPONSE
{
"code": "string",
"detail": "string"
}
Status 409
RESPONSE
{
"code": "string",
"detail": "string"
}

Create notebooks widget

The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.

Required API key scopes

notebook:write

Path parameters

  • node_id
    string
  • short_id
    string

Request parameters

  • version_id
    string
  • expected_current_version_id
    string

Response


Example request

POST /api/projects/:project_id/notebooks/:short_id/widgets/:node_id/revert
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/notebooks/:short_id/widgets/:node_id/revert/\
-d version_id="string",\
-d expected_current_version_id="string"

Example response

Status 200
RESPONSE
{
"lifecycle_status": "awaiting_generation",
"error_detail": "string",
"error_code": "string",
"failure_phase": "generating_source",
"artifact_url": "http://example.com",
"frame_names": [
"string"
],
"input_bindings": {
"property1": {
"source": "string",
"hog": "string"
},
"property2": {
"source": "string",
"hog": "string"
}
},
"input_contract": [
{
"slot": "string",
"sourceName": "string",
"columns": [
{
"name": "string",
"type": "string"
}
],
"schemaHash": "string"
}
],
"current_version_id": "158beffb-f9de-457f-bbee-873740e72504",
"pinned_version_id": "acdd174b-fedb-4cc2-a413-d2bf36fbaf58",
"widget_id": "917f3fdb-2905-481f-8ff6-04c0fb7d466c",
"instance_id": "06587974-2dbe-4e10-8bf9-38cce0f5a366",
"has_versions": true,
"active_job": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"status": "queued",
"phase": "string",
"model": "string",
"created_at": "2019-08-24T14:15:22Z",
"started_at": "2019-08-24T14:15:22Z"
},
"security_review": {
"severity": "none",
"summary": "string",
"findings": [
{
"severity": "low",
"title": "string",
"details": "string"
}
],
"model": "string",
"review_version": "string",
"reviewed_at": "2019-08-24T14:15:22Z"
},
"is_reusable": true,
"build_hash": "string"
}
Status 400
RESPONSE
{
"code": "string",
"detail": "string"
}
Status 404
RESPONSE
{
"code": "string",
"detail": "string"
}
Status 409
RESPONSE
{
"code": "string",
"detail": "string"
}
Status 429
RESPONSE
{
"code": "string",
"detail": "string"
}

Retrieve notebooks widget

The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.

Required API key scopes

notebook:read

Path parameters

  • node_id
    string
  • short_id
    string

Query parameters

  • version_id
    string

Response


Example request

GET /api/projects/:project_id/notebooks/:short_id/widgets/:node_id/source
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/notebooks/:short_id/widgets/:node_id/source/

Example response

Status 200
RESPONSE
{
"source": "string"
}
Status 400
RESPONSE
{
"code": "string",
"detail": "string"
}
Status 404
RESPONSE
{
"code": "string",
"detail": "string"
}

Retrieve notebooks widget

The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.

Required API key scopes

notebook:read

Path parameters

  • node_id
    string
  • short_id
    string

Response


Example request

GET /api/projects/:project_id/notebooks/:short_id/widgets/:node_id/status
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/notebooks/:short_id/widgets/:node_id/status/

Example response

Status 200
RESPONSE
{
"lifecycle_status": "awaiting_generation",
"error_detail": "string",
"error_code": "string",
"failure_phase": "generating_source",
"artifact_url": "http://example.com",
"frame_names": [
"string"
],
"input_bindings": {
"property1": {
"source": "string",
"hog": "string"
},
"property2": {
"source": "string",
"hog": "string"
}
},
"input_contract": [
{
"slot": "string",
"sourceName": "string",
"columns": [
{
"name": "string",
"type": "string"
}
],
"schemaHash": "string"
}
],
"current_version_id": "158beffb-f9de-457f-bbee-873740e72504",
"pinned_version_id": "acdd174b-fedb-4cc2-a413-d2bf36fbaf58",
"widget_id": "917f3fdb-2905-481f-8ff6-04c0fb7d466c",
"instance_id": "06587974-2dbe-4e10-8bf9-38cce0f5a366",
"has_versions": true,
"active_job": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"status": "queued",
"phase": "string",
"model": "string",
"created_at": "2019-08-24T14:15:22Z",
"started_at": "2019-08-24T14:15:22Z"
},
"security_review": {
"severity": "none",
"summary": "string",
"findings": [
{
"severity": "low",
"title": "string",
"details": "string"
}
],
"model": "string",
"review_version": "string",
"reviewed_at": "2019-08-24T14:15:22Z"
},
"is_reusable": true,
"build_hash": "string"
}
Status 404
RESPONSE
{
"code": "string",
"detail": "string"
}

Retrieve notebooks widget

The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.

Required API key scopes

notebook:read

Path parameters

  • node_id
    string
  • short_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/notebooks/:short_id/widgets/:node_id/versions
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/notebooks/:short_id/widgets/:node_id/versions/

Example response

Status 200
RESPONSE
{
"results": [
{
"generation_cost_usd": "string",
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"parent_version_id": "f8d7c285-7613-4ade-8a91-ac987c2c73a9",
"version": 1,
"version_operation": "initial",
"prompt_delta": "string",
"effective_prompt": "string",
"model": "string",
"created_at": "2019-08-24T14:15:22Z",
"build_status": "queued",
"artifact_url": "http://example.com",
"frame_names": [
"string"
],
"is_current": true,
"security_review": {
"severity": "none",
"summary": "string",
"findings": [
{
"severity": "low",
"title": "string",
"details": "string"
}
],
"model": "string",
"review_version": "string",
"reviewed_at": "2019-08-24T14:15:22Z"
},
"build_hash": "string"
}
],
"count": 0,
"next_offset": 0
}
Status 404
RESPONSE
{
"code": "string",
"detail": "string"
}

Retrieve notebooks all activity

The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.

Example request

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

Example response

Status 200 No response body

Retrieve notebooks kernel compute options

Compute rates, presets, and the sizes the kernel config endpoint accepts. Static per region, so a client can fetch it once and price any shape a user picks.

Required API key scopes

notebook:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"currency": "string",
"cpu_rate_per_core_hour": 0.1,
"memory_rate_per_gb_hour": 0.1,
"default_preset_key": "string",
"presets": [
{
"key": "string",
"name": "string",
"description": "string",
"cpu_cores": 0.1,
"memory_gb": 0.1,
"hourly_price": 0.1
}
],
"allowed_cpu_cores": [
0.1
],
"allowed_memory_gb": [
0.1
],
"allowed_idle_timeout_seconds": [
0
]
}

Retrieve notebooks recording comments

The API for interacting with Notebooks. This feature is in early access and the API can have breaking changes without announcement.

Example request

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

Example response

Status 200 No response body