Batch

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

Endpoints

POST
POST
GET
GET
POST
GET
POST
GET
GET

Create batch exports unpause

Unpause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    stringnull
  • start_at
    stringnull
  • end_at
    stringnull
  • hogql_query
    string
  • filters
  • timezone
  • offset_day
    integernull
  • offset_hour
    integernull

Example request

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

Example response

Status 200 No response body

Create batch exports unpause

Unpause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    stringnull
  • start_at
    stringnull
  • end_at
    stringnull
  • hogql_query
    string
  • filters
  • timezone
  • offset_day
    integernull
  • offset_hour
    integernull

Example request

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

Example response

Status 200 No response body

Create batch exports run test step new

Required API key scopes

batch_export:write

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    stringnull
  • start_at
    stringnull
  • end_at
    stringnull
  • hogql_query
    string
  • filters
  • timezone
  • offset_day
    integernull
  • offset_hour
    integernull

Example request

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

Example response

Status 200 No response body

Create batch exports run test step new

Required API key scopes

batch_export:write

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • last_paused_at
    stringnull
  • start_at
    stringnull
  • end_at
    stringnull
  • hogql_query
    string
  • filters
  • timezone
  • offset_day
    integernull
  • offset_hour
    integernull

Example request

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

Example response

Status 200 No response body

Retrieve batch exports test

Required API key scopes

batch_export:read

Example request

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

Example response

Status 200 No response body

Retrieve batch exports test

Required API key scopes

batch_export:read

Example request

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

Example response

Status 200 No response body

List all file download batch exports

Required API key scopes

batch_export:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"status": "Cancelled"
}
]
}

Create file download batch exports

Create and start a batch export on demand run to download a file.

Required API key scopes

batch_export:write


Response


Example request

Example response

Status 202
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}

Retrieve file download batch exports

Get a batch export on demand run.

If the underlying batch export run has completed, we return keys to the generated file downloads so that users may download them by making a request to /download.

Required API key scopes

batch_export:read

Path parameters

  • id
    string

Example request

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

Example response

Status 200
RESPONSE
{
"status": "Starting"
}

Create file download batch exports cancel

Cancel an ongoing file-download batch export.

Required API key scopes

batch_export:write

Path parameters

  • id
    string

Request parameters

  • file
  • model
  • include
    array
  • exclude
    array
  • data_interval_start
    string
  • data_interval_end
    string

Example request

POST /api/projects/:project_id/file_download_batch_exports/:id/cancel
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/file_download_batch_exports/:id/cancel/\
-d file=undefined,\
-d model=undefined,\
-d data_interval_start="string",\
-d data_interval_end="string"

Example response

Status 200 No response body

Retrieve file download batch exports download

Download a file (or a part) from this batch export run.

Users can provide a part component with an id or index, or no part component at all:

  • If part id is included: The file download matching the id is downloaded.
  • If part index is included: The file download matching the index (as ordered by key) is downloaded.
  • If no part component is present: If there is only one file downloaded, that is downloaded. Otherwise the first one as sorted by key is downloaded.

Required API key scopes

batch_export:read

Path parameters

  • id
    string

Example request

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

Example response

Status 200 No response body

Retrieve file download batch exports logs

Path parameters

  • id
    string

Query parameters

  • after
    string
  • before
    string
  • instance_id
    string
  • level
    string
  • limit
    integer
    Default: 50
  • search
    string

Example request

GET /api/projects/:project_id/file_download_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/projects/:project_id/file_download_batch_exports/:id/logs/

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.