notebook_widgets

post/api/projects/{project_id}/notebook_widgets/{id}/generate/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/notebook_widgets/{id}/generate/
  • Auth: HTTP bearer

Path parameters

idstring required
project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Request body

promptstring required

Instructions for the generated widget. Initial and improvement instructions accept up to 20,000 characters; regeneration accepts complete instructions up to 50,000 characters.

generation_idstring uuid required

Idempotency key for this generation job.

model'claude-haiku-4-5' | 'claude-sonnet-4-6' | 'claude-sonnet-5' | 'claude-opus-5'
  • claude-haiku-4-5 - claude-haiku-4-5
  • claude-sonnet-4-6 - claude-sonnet-4-6
  • claude-sonnet-5 - claude-sonnet-5
  • claude-opus-5 - claude-opus-5
generation_operation'initial' | 'regenerate' | 'improve'
  • initial - initial
  • regenerate - regenerate
  • improve - improve
expected_current_version_idstring uuid

Current widget version the improvement is based on. Required for improve operations.

Response

lifecycle_status'awaiting_generation' | 'generating' | 'building' | 'ready' | 'failed' | 'incompatible' required
  • awaiting_generation - awaiting_generation
  • generating - generating
  • building - building
  • ready - ready
  • failed - failed
  • incompatible - incompatible
error_detailstring nullable

Actionable failure detail.

error_codestring nullable

Stable failure code for support and diagnostics.

artifact_urlstring uri nullable

Short-lived URL for the selected widget version's preview.

frame_namesstring[] required

Logical dataframe slots available to the selected version.

input_bindingsobject required

Notebook-local mapping from each logical widget input slot to a dataframe and optional Hog transform.

current_version_idstring uuid nullable required

Selected immutable widget version.

pinned_version_idstring uuid nullable required

Version explicitly pinned for this notebook placement, or null when it follows the latest version.

widget_idstring uuid nullable required

Reusable widget identity.

instance_idstring uuid nullable required

Placement in this notebook.

has_versionsboolean required

Whether the widget has generated history.

is_reusableboolean required

Whether this widget identity is published in the reusable widget catalog.

build_hashstring nullable required

Hex SHA-256 over the exact immutable artifact manifest selected for display.

Changes

No recorded changes to this operation across all 1 revision of this API.