Notebook
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
GET | |
POST | |
POST | |
GET | |
POST | |
POST | |
POST | |
GET | |
GET | |
GET |
List all reusable widgets
Required API key scopes
notebook:readQuery parameters
- limitinteger
- offsetinteger
- searchstring
Response
Example request
GET /api /projects /:project_id /notebook_widgetsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/notebook_widgets/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/notebook_widgets/".format(project_id=project_id),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"results": [{"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08","name": "string","description": "string","tags": ["string"],"publication_status": "published","current_version_id": "158beffb-f9de-457f-bbee-873740e72504","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"}],"count": 0,"next_offset": 0}
Retrieve reusable widgets
Required API key scopes
notebook:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /notebook_widgets /:idexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/notebook_widgets/:id/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
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 404
RESPONSE
{"code": "string","detail": "string"}
Create reusable widgets update demo
Required API key scopes
notebook:writequery:readPath parameters
- idstring
Request parameters
- version_idstring
- frame_namestring
- rowsarray
Response
Example request
POST /api /projects /:project_id /notebook_widgets /:id /demo-dataexport 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/notebook_widgets/:id/demo-data/\-d version_id="string",\-d frame_name="string",\-d rows="array"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/demo-data/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"version_id": "string","frame_name": "string","rows": "array"}).json()
Example response
Status 200
RESPONSE
{"name": "string","runId": "78c33d18-170c-44d3-a227-b3194f134f73","columns": [{"name": "string","type": "string"}],"rows": [[null]],"totalRowCount": 0,"includedRowCount": 0,"offset": 0,"nextOffset": 0,"truncated": true}
Status 400
RESPONSE
{"code": "string","detail": "string"}
Status 404
RESPONSE
{"code": "string","detail": "string"}
Status 409
RESPONSE
{"code": "string","detail": "string"}
Create reusable widgets discard
Required API key scopes
notebook:writePath parameters
- idstring
Request parameters
- pending_version_idstring
- expected_current_version_idstring
Response
Example request
POST /api /projects /:project_id /notebook_widgets /:id /discard-versionexport 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/notebook_widgets/:id/discard-version/\-d pending_version_id="string",\-d expected_current_version_id="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/discard-version/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"pending_version_id": "string","expected_current_version_id": "string"}).json()
Example response
Status 200
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 404
RESPONSE
{"code": "string","detail": "string"}
Status 409
RESPONSE
{"code": "string","detail": "string"}
Retrieve reusable widgets demo
Required API key scopes
notebook:readquery:readPath parameters
- frame_namestring
- idstring
Query parameters
- version_idstring
Response
Example request
GET /api /projects /:project_id /notebook_widgets /:id /frames /:frame_nameexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/notebook_widgets/:id/frames/:frame_name/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/frames/{frame_name}/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>",frame_name="<the frame name>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"name": "string","runId": "78c33d18-170c-44d3-a227-b3194f134f73","columns": [{"name": "string","type": "string"}],"rows": [[null]],"totalRowCount": 0,"includedRowCount": 0,"offset": 0,"nextOffset": 0,"truncated": true}
Status 404
RESPONSE
{"code": "string","detail": "string"}
Create reusable widgets
Required API key scopes
notebook:writePath parameters
- idstring
Request parameters
- promptstring
- generation_idstring
- modelDefault:
claude-sonnet-5 - generation_operationDefault:
regenerate - expected_current_version_idstring
Response
Example request
POST /api /projects /:project_id /notebook_widgets /:id /generateexport 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/notebook_widgets/:id/generate/\-d prompt="string",\-d generation_id="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/generate/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"prompt": "string","generation_id": "string"}).json()
Example response
Status 202
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 403
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"}
Create reusable widgets
Required API key scopes
notebook:writePath parameters
- idstring
Request parameters
- version_idstring
- expected_current_version_idstring
Response
Example request
POST /api /projects /:project_id /notebook_widgets /:id /restoreexport 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/notebook_widgets/:id/restore/\-d version_id="string",\-d expected_current_version_id="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/restore/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"version_id": "string","expected_current_version_id": "string"}).json()
Example response
Status 200
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 404
RESPONSE
{"code": "string","detail": "string"}
Status 409
RESPONSE
{"code": "string","detail": "string"}
Status 429
RESPONSE
{"code": "string","detail": "string"}
Create reusable widgets save
Required API key scopes
notebook:writePath parameters
- idstring
Request parameters
- pending_version_idstring
- expected_current_version_idstring
Response
Example request
POST /api /projects /:project_id /notebook_widgets /:id /save-versionexport 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/notebook_widgets/:id/save-version/\-d pending_version_id="string",\-d expected_current_version_id="string"
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.post("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/save-version/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},data={"pending_version_id": "string","expected_current_version_id": "string"}).json()
Example response
Status 200
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 404
RESPONSE
{"code": "string","detail": "string"}
Status 409
RESPONSE
{"code": "string","detail": "string"}
Retrieve reusable widgets
Required API key scopes
notebook:readPath parameters
- idstring
Query parameters
- version_idstring
Response
Example request
GET /api /projects /:project_id /notebook_widgets /:id /sourceexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/notebook_widgets/:id/source/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/source/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"source": "string"}
Status 400
RESPONSE
{"code": "string","detail": "string"}
Status 404
RESPONSE
{"code": "string","detail": "string"}
Retrieve reusable widgets
Required API key scopes
notebook:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /notebook_widgets /:id /statusexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/notebook_widgets/:id/status/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/status/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
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"}
Status 409
RESPONSE
{"code": "string","detail": "string"}
Retrieve reusable widgets
Required API key scopes
notebook:readPath parameters
- idstring
Query parameters
- limitintegerDefault:
25 - offsetintegerDefault:
0
Response
Example request
GET /api /projects /:project_id /notebook_widgets /:id /versionsexport POSTHOG_PERSONAL_API_KEY=[your personal api key]curl \-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \<ph_app_host>/api/projects/:project_id/notebook_widgets/:id/versions/
api_key = "[your personal api key]"project_id = "[your project id]"response = requests.get("<ph_app_host>/api/projects/{project_id}/notebook_widgets/{notebook_widget_id}/versions/".format(project_id=project_id,notebook_widget_id="<the notebook widget id>"),headers={"Authorization": "Bearer {}".format(api_key)},).json()
Example response
Status 200
RESPONSE
{"results": [{"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"}],"count": 0,"next_offset": 0}
Status 400
RESPONSE
{"code": "string","detail": "string"}
Status 404
RESPONSE
{"code": "string","detail": "string"}