Environments-3

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

Endpoints

POST
GET
PATCH
DELETE
POST
GET
POST
POST
POST

Create environments batch exports runs retry

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string
  • id
    string
  • project_id
    string

Request parameters

  • status
  • records_completed
    integer
  • latest_error
    string
  • data_interval_start
    string
  • data_interval_end
    string
  • cursor
    string
  • finished_at
    string
  • records_total_count
    integer
  • bytes_exported
    integer
  • backfill
    string

Example request

POST /api/environments/:project_id/batch_exports/:batch_export_id/runs/:id/retry
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/environments/:project_id/batch_exports/:batch_export_id/runs/:id/retry/\
-d status=undefined,\
-d data_interval_end="string"

Example response

Status 200 No response body

Create environments batch exports runs retry

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string
  • id
    string
  • project_id
    string

Request parameters

  • status
  • records_completed
    integer
  • latest_error
    string
  • data_interval_start
    string
  • data_interval_end
    string
  • cursor
    string
  • finished_at
    string
  • records_total_count
    integer
  • bytes_exported
    integer
  • backfill
    string

Example request

POST /api/environments/:project_id/batch_exports/:batch_export_id/runs/:id/retry
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/environments/:project_id/batch_exports/:batch_export_id/runs/:id/retry/\
-d status=undefined,\
-d data_interval_end="string"

Example response

Status 200 No response body

Retrieve environments batch exports

Required API key scopes

batch_export:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "S3",
"config": null,
"integration": 0,
"integration_id": 0
},
"interval": "hour",
"paused": true,
"created_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"last_paused_at": "2019-08-24T14:15:22Z",
"start_at": "2019-08-24T14:15:22Z",
"end_at": "2019-08-24T14:15:22Z",
"latest_runs": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"status": "Cancelled",
"records_completed": -2147483648,
"latest_error": "string",
"data_interval_start": "2019-08-24T14:15:22Z",
"data_interval_end": "2019-08-24T14:15:22Z",
"cursor": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"records_total_count": -2147483648,
"bytes_exported": -9223372036854776000,
"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"schema": null,
"filters": null
}

Retrieve environments batch exports

Required API key scopes

batch_export:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "S3",
"config": null,
"integration": 0,
"integration_id": 0
},
"interval": "hour",
"paused": true,
"created_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"last_paused_at": "2019-08-24T14:15:22Z",
"start_at": "2019-08-24T14:15:22Z",
"end_at": "2019-08-24T14:15:22Z",
"latest_runs": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"status": "Cancelled",
"records_completed": -2147483648,
"latest_error": "string",
"data_interval_start": "2019-08-24T14:15:22Z",
"data_interval_end": "2019-08-24T14:15:22Z",
"cursor": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"records_total_count": -2147483648,
"bytes_exported": -9223372036854776000,
"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"schema": null,
"filters": null
}

Update environments batch exports

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Response


Example request

PATCH /api/environments/:project_id/batch_exports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/batch_exports/:id/\
-d team_id="integer"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "S3",
"config": null,
"integration": 0,
"integration_id": 0
},
"interval": "hour",
"paused": true,
"created_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"last_paused_at": "2019-08-24T14:15:22Z",
"start_at": "2019-08-24T14:15:22Z",
"end_at": "2019-08-24T14:15:22Z",
"latest_runs": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"status": "Cancelled",
"records_completed": -2147483648,
"latest_error": "string",
"data_interval_start": "2019-08-24T14:15:22Z",
"data_interval_end": "2019-08-24T14:15:22Z",
"cursor": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"records_total_count": -2147483648,
"bytes_exported": -9223372036854776000,
"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"schema": null,
"filters": null
}

Update environments batch exports

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Response


Example request

PATCH /api/environments/:project_id/batch_exports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/batch_exports/:id/\
-d team_id="integer"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "S3",
"config": null,
"integration": 0,
"integration_id": 0
},
"interval": "hour",
"paused": true,
"created_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"last_paused_at": "2019-08-24T14:15:22Z",
"start_at": "2019-08-24T14:15:22Z",
"end_at": "2019-08-24T14:15:22Z",
"latest_runs": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"status": "Cancelled",
"records_completed": -2147483648,
"latest_error": "string",
"data_interval_start": "2019-08-24T14:15:22Z",
"data_interval_end": "2019-08-24T14:15:22Z",
"cursor": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"records_total_count": -2147483648,
"bytes_exported": -9223372036854776000,
"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"schema": null,
"filters": null
}

Delete environments batch exports

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Example request

DELETE /api/environments/:project_id/batch_exports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/batch_exports/:id/

Example response

Status 204 No response body

Delete environments batch exports

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Example request

DELETE /api/environments/:project_id/batch_exports/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/batch_exports/:id/

Example response

Status 204 No response body

Create environments batch exports backfill

Trigger a backfill for a BatchExport.

Note: This endpoint is deprecated. Please use POST /batch_exports/<id>/backfills/ instead.

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/backfill
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/environments/:project_id/batch_exports/:id/backfill/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create environments batch exports backfill

Trigger a backfill for a BatchExport.

Note: This endpoint is deprecated. Please use POST /batch_exports/<id>/backfills/ instead.

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/backfill
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/environments/:project_id/batch_exports/:id/backfill/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Retrieve environments batch exports logs

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Retrieve environments batch exports logs

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Create environments batch exports pause

Pause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/pause
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/environments/:project_id/batch_exports/:id/pause/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create environments batch exports pause

Pause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/pause
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/environments/:project_id/batch_exports/:id/pause/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create environments batch exports run test step

Required API key scopes

INTERNAL

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/run_test_step
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/environments/:project_id/batch_exports/:id/run_test_step/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create environments batch exports run test step

Required API key scopes

INTERNAL

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/run_test_step
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/environments/:project_id/batch_exports/:id/run_test_step/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create environments batch exports unpause

Unpause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/unpause
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/environments/:project_id/batch_exports/:id/unpause/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create environments batch exports unpause

Unpause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    string
  • start_at
    string
  • end_at
    string
  • hogql_query
    string
  • filters

Example request

POST /api/environments/:project_id/batch_exports/:id/unpause
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/environments/:project_id/batch_exports/:id/unpause/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body
Next page →

Community questions

Questions about this page? or post a community question.