Saved

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

Endpoints

GET
POST
GET
PATCH
DELETE
POST
GET
GET
POST
GET
POST
POST
POST

List all saved

List saved heatmaps for the project. A saved heatmap pins a page URL and a set of viewport widths, and (for type 'screenshot') renders the page so heatmap data can be overlaid on it.

Required API key scopes

heatmap:read

Query parameters

  • created_by
    integer
  • limit
    integer
    Default: 100
  • offset
    integer
    Default: 0
  • order
    string
  • search
    string
  • status
    string
  • type
    string

Example request

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

Example response

Status 200
RESPONSE
{
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}
],
"count": 0
}

Create saved

Create a saved heatmap for a page URL. For type 'screenshot' (the default) this enqueues a headless render of the page at each target width; poll the saved heatmap or its content endpoint until status is 'completed'. Provide 'widths' to control which viewport widths are rendered.

Required API key scopes

heatmap:write

Request parameters

  • name
    string | null
  • url
    string
  • data_url
  • widths
    array
  • type
    Default: screenshot
  • deleted
    boolean
  • block_consent_modals
    boolean

Response


Example request

POST /api/projects/:project_id/saved
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/saved/\
-d url="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}

Retrieve saved

Get a single saved heatmap by its short_id, including per-width render status.

Required API key scopes

heatmap:read

Path parameters

  • short_id
    string

Response


Example request

GET /api/projects/:project_id/saved/:short_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/saved/:short_id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}

Update saved

Update a saved heatmap (e.g. rename, change widths, or soft-delete via 'deleted'). Changing the URL of a 'screenshot' heatmap triggers a re-render.

Required API key scopes

heatmap:write

Path parameters

  • short_id
    string

Request parameters

  • name
    string | null
  • url
    string
  • data_url
  • widths
    array
  • type
    Default: screenshot
  • deleted
    boolean
  • block_consent_modals
    boolean

Response


Example request

PATCH /api/projects/:project_id/saved/:short_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/saved/:short_id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}

Delete saved

Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

Required API key scopes

heatmap:write

Path parameters

  • short_id
    string

Example request

DELETE /api/projects/:project_id/saved/:short_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/saved/:short_id/

Example response

Status 405 No response body

Create saved regenerate

Re-run screenshot generation for a saved heatmap of type 'screenshot'. Clears existing renders and re-renders at every target width; status returns to 'processing'.

Required API key scopes

heatmap:write

Path parameters

  • short_id
    string

Response


Example request

POST /api/projects/:project_id/saved/:short_id/regenerate
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/saved/:short_id/regenerate/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}
Status 400 Not a screenshot

Retrieve saved screenshot history

List the daily screenshot captures kept for a saved heatmap, newest first. Each capture is a render of the page on that day at one viewport width, so the clicks of a day or a range can be viewed over the background that matches it. Captures older than the retention window are deleted.

Required API key scopes

heatmap:read

Path parameters

  • short_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"width": 0,
"retention_days": 0,
"storage_available": true,
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"captured_on": "2019-08-24",
"captured_at": "2019-08-24T14:15:22Z",
"width": 0,
"timezone": "string",
"day_start": "2019-08-24T14:15:22Z",
"day_end": "2019-08-24T14:15:22Z",
"expires_at": "2019-08-24T14:15:22Z",
"revision": "b587a570-d9a5-40c2-87da-edba28b3005f",
"trigger": "scheduled",
"status": "ok",
"failure_cause": "string",
"page_status": 0,
"content_url": "string",
"thumbnail_url": "string",
"latest_request": {
"request_id": "266ea41d-adf5-480b-af50-15b940c2b846",
"state": "queued",
"deadline": "2019-08-24T14:15:22Z",
"failure_cause": "string",
"page_status": 0,
"completed_at": "2019-08-24T14:15:22Z"
}
}
]
}
Status 404 Page history is not enabled for this project

Retrieve saved screenshot history content

Fetch the JPEG for one daily capture, or its thumbnail. The list endpoint hands out versioned URLs, so the response carries a private day-long cache lifetime and an ETag that changes when the day is captured again.

Required API key scopes

heatmap:read

Path parameters

  • history_id
    string
  • short_id
    string

Query parameters

  • v
    string
  • variant
    string
    Default: full
    One of: "full""thumbnail"

Example request

GET /api/projects/:project_id/saved/:short_id/screenshot_history/:history_id/content
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/saved/:short_id/screenshot_history/:history_id/content/

Example response

Status 200
Status 304 Not modified
Status 404 No such capture, or page history is not enabled for this project

Create saved screenshot history capture

Render and keep a capture of the page now, instead of waiting for the daily run, for example right after a deploy. The render runs in the background; poll the history list for the new capture. A capture requested on a day that already has one replaces that day's image.

Required API key scopes

heatmap:write

Path parameters

  • short_id
    string

Response


Example request

POST /api/projects/:project_id/saved/:short_id/screenshot_history/capture
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/saved/:short_id/screenshot_history/capture/

Example response

Status 202
RESPONSE
{
"status": "string",
"request_id": "266ea41d-adf5-480b-af50-15b940c2b846",
"deadline": "2019-08-24T14:15:22Z",
"width": 0
}
Status 400 Not a server-rendered screenshot heatmap
Status 404 Page history is not enabled for this project
Status 429 A capture was requested for this heatmap in the last 10 minutes

Retrieve saved screenshot history requests

Read the outcome of a capture request.

Required API key scopes

heatmap:read

Path parameters

  • request_id
    string
  • short_id
    string

Response


Example request

GET /api/projects/:project_id/saved/:short_id/screenshot_history/requests/:request_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/saved/:short_id/screenshot_history/requests/:request_id/

Example response

Status 200
RESPONSE
{
"request_id": "266ea41d-adf5-480b-af50-15b940c2b846",
"state": "queued",
"deadline": "2019-08-24T14:15:22Z",
"failure_cause": "string",
"page_status": 0,
"completed_at": "2019-08-24T14:15:22Z"
}

Create saved capture

Persist screenshots captured client-side by the on-page toolbar as a completed screenshot heatmap. No headless render is enqueued: the toolbar runs in the user's authenticated browser, so this is the path for pages behind a login that Browserless cannot reach. Send one 'image'+'width', or 'images'+'widths' parallel arrays to store several viewport widths on one heatmap (the toolbar re-lays out the page at each width and captures it, matching the widths the server renders). The image bytes are stored and served only through the authenticated content endpoint. The optional data URL selects which pages supply the overlay data and defaults to the captured URL.

Required API key scopes

heatmap:write


Response


Example request

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}

Create saved preflight

Fetch a page URL server-side and report whether it allows being embedded in the live preview iframe, plus the HTTP status it returned. The live preview loads the customer's site directly in their browser, so a site that sends X-Frame-Options or a restrictive frame-ancestors will never render, and a 4xx or 5xx from the site's own host or CDN leaves an empty frame with no explanation. This endpoint makes both cases explainable. The fetch comes from PostHog's own network rather than from the screenshot renderer, so a host that varies its response by IP or user agent can answer this differently than it answers a screenshot render. Settled verdicts are cached briefly, so repeat checks for the same URL do not refetch it.

Required API key scopes

heatmap:read

Request parameters

  • url
    string

Response


Example request

POST /api/projects/:project_id/saved/preflight
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/saved/preflight/\
-d url="string"

Example response

Status 200
RESPONSE
{
"framing": "allowed",
"blocked_by": "x_frame_options",
"http_status": 0,
"body_excerpt": "string"
}

Create saved prewarm

Speculatively render a screenshot for a page URL ahead of heatmap creation, so it's ready (or closer to ready) by the time the user reaches the generation screen. Renders a single preview width. Idempotent within a short window: returns the existing in-flight or completed prewarm render for the same URL and consent setting if one exists (200), otherwise starts a new one (201). The result is reused when a heatmap is later created for the same URL.

Required API key scopes

heatmap:write

Request parameters

  • url
    string
  • block_consent_modals
    boolean
    Default: false

Response


Example request

POST /api/projects/:project_id/saved/prewarm
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/saved/prewarm/\
-d url="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}
Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"name": "string",
"url": "http://example.com",
"data_url": "http://example.com",
"target_widths": [
0
],
"type": "screenshot",
"source": "server",
"status": "processing",
"has_content": true,
"snapshots": [
{
"width": 0,
"has_content": true
}
],
"deleted": true,
"block_consent_modals": true,
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"exception": "string",
"user_access_level": "string"
}