Visual

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

Endpoints

GET
POST
GET
PATCH
GET
POST
GET
POST
POST
POST

List all visual review repos

List all projects for the team.

Required API key scopes

visual_review:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}
]
}

List all visual review repos

List all projects for the team.

Required API key scopes

visual_review:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}
]
}

Create visual review repos

Create a new repo.

Required API key scopes

visual_review:write

Path parameters

  • project_id
    string

Request parameters

  • repo_full_name
    string
  • repo_external_id
    integer

Response


Example request

POST /api/projects/:project_id/visual_review/repos
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/visual_review/repos/\
-d repo_full_name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}

Create visual review repos

Create a new repo.

Required API key scopes

visual_review:write

Path parameters

  • project_id
    string

Request parameters

  • repo_full_name
    string
  • repo_external_id
    integer

Response


Example request

POST /api/projects/:project_id/visual_review/repos
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/visual_review/repos/\
-d repo_full_name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}

Retrieve visual review repos

Get a repo by ID.

Required API key scopes

visual_review:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

GET /api/projects/:project_id/visual_review/repos/: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/visual_review/repos/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}

Retrieve visual review repos

Get a repo by ID.

Required API key scopes

visual_review:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

GET /api/projects/:project_id/visual_review/repos/: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/visual_review/repos/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}

Update visual review repos

Update a repo's settings.

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • baseline_file_paths
    object
  • enable_pr_comments
    boolean

Response


Example request

PATCH /api/projects/:project_id/visual_review/repos/: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/visual_review/repos/:id/\
-d baseline_file_paths="object"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}

Update visual review repos

Update a repo's settings.

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • baseline_file_paths
    object
  • enable_pr_comments
    boolean

Response


Example request

PATCH /api/projects/:project_id/visual_review/repos/: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/visual_review/repos/:id/\
-d baseline_file_paths="object"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"repo_external_id": 0,
"repo_full_name": "string",
"baseline_file_paths": {
"property1": "string",
"property2": "string"
},
"enable_pr_comments": true,
"created_at": "2019-08-24T14:15:22Z"
}

List all visual review runs

List runs for the team, optionally filtered by review state.

Required API key scopes

visual_review:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer
  • review_state
    string

Response


Example request

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

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",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
}
]
}

List all visual review runs

List runs for the team, optionally filtered by review state.

Required API key scopes

visual_review:read

Path parameters

  • project_id
    string

Query parameters

  • limit
    integer
  • offset
    integer
  • review_state
    string

Response


Example request

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

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",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
}
]
}

Create visual review runs

Create a new run from a CI manifest.

Required API key scopes

visual_review:write

Path parameters

  • project_id
    string

Request parameters

  • repo_id
    string
  • run_type
    string
  • commit_sha
    string
  • branch
    string
  • snapshots
    Click to open
    array
  • pr_number
    integer
  • baseline_hashes
    object
  • unchanged_count
    integer
  • removed_identifiers
    array
  • purpose
    string
  • metadata
    object

Response


Example request

POST /api/projects/:project_id/visual_review/runs
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/visual_review/runs/\
-d repo_id="string",\
-d run_type="string",\
-d commit_sha="string",\
-d branch="string",\
-d snapshots="array"

Example response

Status 201
RESPONSE
{
"run_id": "dded282c-8ebd-44cf-8ba5-9a234973d1ec",
"uploads": [
{
"content_hash": "string",
"url": "string",
"fields": {
"property1": "string",
"property2": "string"
}
}
]
}

Create visual review runs

Create a new run from a CI manifest.

Required API key scopes

visual_review:write

Path parameters

  • project_id
    string

Request parameters

  • repo_id
    string
  • run_type
    string
  • commit_sha
    string
  • branch
    string
  • snapshots
    Click to open
    array
  • pr_number
    integer
  • baseline_hashes
    object
  • unchanged_count
    integer
  • removed_identifiers
    array
  • purpose
    string
  • metadata
    object

Response


Example request

POST /api/projects/:project_id/visual_review/runs
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/visual_review/runs/\
-d repo_id="string",\
-d run_type="string",\
-d commit_sha="string",\
-d branch="string",\
-d snapshots="array"

Example response

Status 201
RESPONSE
{
"run_id": "dded282c-8ebd-44cf-8ba5-9a234973d1ec",
"uploads": [
{
"content_hash": "string",
"url": "string",
"fields": {
"property1": "string",
"property2": "string"
}
}
]
}

Retrieve visual review runs

Get run status and summary.

Required API key scopes

visual_review:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

GET /api/projects/:project_id/visual_review/runs/: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/visual_review/runs/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
}

Retrieve visual review runs

Get run status and summary.

Required API key scopes

visual_review:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

GET /api/projects/:project_id/visual_review/runs/: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/visual_review/runs/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
}

Create visual review runs add snapshots

Add a batch of snapshots to a pending run (shard-based flow).

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • snapshots
    Click to open
    array
  • baseline_hashes
    object

Response


Example request

POST /api/projects/:project_id/visual_review/runs/:id/add-snapshots
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/visual_review/runs/:id/add-snapshots/\
-d snapshots="array"

Example response

Status 200
RESPONSE
{
"added": 0,
"uploads": [
{
"content_hash": "string",
"url": "string",
"fields": {
"property1": "string",
"property2": "string"
}
}
]
}

Create visual review runs add snapshots

Add a batch of snapshots to a pending run (shard-based flow).

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • snapshots
    Click to open
    array
  • baseline_hashes
    object

Response


Example request

POST /api/projects/:project_id/visual_review/runs/:id/add-snapshots
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/visual_review/runs/:id/add-snapshots/\
-d snapshots="array"

Example response

Status 200
RESPONSE
{
"added": 0,
"uploads": [
{
"content_hash": "string",
"url": "string",
"fields": {
"property1": "string",
"property2": "string"
}
}
]
}

Create visual review runs approve

Approve visual changes for snapshots in this run.

With approve_all=true, approves all changed+new snapshots and returns signed baseline YAML. With specific snapshots, approves only those.

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • snapshots
    Click to open
    array
  • approve_all
    boolean
  • commit_to_github
    boolean

Response


Example request

POST /api/projects/:project_id/visual_review/runs/:id/approve
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/visual_review/runs/:id/approve/\
-d snapshots="array"

Example response

Status 200
RESPONSE
{
"run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
},
"baseline_content": "string"
}

Create visual review runs approve

Approve visual changes for snapshots in this run.

With approve_all=true, approves all changed+new snapshots and returns signed baseline YAML. With specific snapshots, approves only those.

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • snapshots
    Click to open
    array
  • approve_all
    boolean
  • commit_to_github
    boolean

Response


Example request

POST /api/projects/:project_id/visual_review/runs/:id/approve
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/visual_review/runs/:id/approve/\
-d snapshots="array"

Example response

Status 200
RESPONSE
{
"run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
},
"baseline_content": "string"
}

Create visual review runs auto approve

CLI auto-approve: approve all and return baseline YAML for local write.

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

POST /api/projects/:project_id/visual_review/runs/:id/auto-approve
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/visual_review/runs/:id/auto-approve/

Example response

Status 200
RESPONSE
{
"run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
},
"baseline_content": "string"
}

Create visual review runs auto approve

CLI auto-approve: approve all and return baseline YAML for local write.

Required API key scopes

visual_review:write

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

POST /api/projects/:project_id/visual_review/runs/:id/auto-approve
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/visual_review/runs/:id/auto-approve/

Example response

Status 200
RESPONSE
{
"run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"repo_id": "59e69ce7-60be-4408-9333-ec12132fc070",
"status": "string",
"run_type": "string",
"commit_sha": "string",
"branch": "string",
"pr_number": 0,
"approved": true,
"approved_at": "2019-08-24T14:15:22Z",
"summary": {
"total": 0,
"changed": 0,
"new": 0,
"removed": 0,
"unchanged": 0,
"tolerated_matched": 0
},
"error_message": "string",
"created_at": "2019-08-24T14:15:22Z",
"completed_at": "2019-08-24T14:15:22Z",
"is_stale": true,
"metadata": {
"property1": null,
"property2": null
}
},
"baseline_content": "string"
}
Next page →

Community questions

Questions about this page? or post a community question.