Batch exports

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

Endpoints

GET
POST
GET
POST
GET
POST
GET
GET
POST
GET
POST
GET

List all batch exports

Also available via the PostHog MCP server:

  • batch-exports-list — List batch exports

Required API key scopes

batch_export:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/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/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",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "AwsS3",
"config": {
"http_path": "string",
"catalog": "string",
"schema": "string",
"table_name": "string",
"use_variant_type": true,
"use_automatic_schema_evolution": true
},
"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",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"hogql_modifiers": {
"bounceRateDurationSeconds": null,
"bounceRatePageViewMode": null,
"convertToProjectTimezone": null,
"cookielessTrafficIsRegular": null,
"customBotDefinitions": null,
"customChannelTypeRules": null,
"dataWarehouseEventsModifiers": null,
"debug": null,
"forceClickhouseDataSkippingIndexes": null,
"formatCsvAllowDoubleQuotes": null,
"inCohortVia": null,
"inlineCohortCalculation": null,
"materializationMode": null,
"materializedColumnsOptimizationMode": null,
"mergeFederatedAggregateJoins": null,
"optimizeJoinedFilters": null,
"optimizeProjections": null,
"parserMode": null,
"personIdPushdown": null,
"personsArgMaxVersion": null,
"personsJoinMode": null,
"personsOnEventsMode": null,
"propertyGroupsMode": null,
"pushDownPredicates": null,
"s3TableUseInvalidColumns": null,
"sessionIdPushdown": null,
"sessionPropertyPreAggregation": null,
"sessionTableVersion": null,
"sessionsV2JoinMode": null,
"timings": null,
"typeAwareCastSimplification": null,
"useMaterializedViews": null,
"useNewEventsSchema": null,
"usePreaggregatedIntermediateResults": null,
"usePreaggregatedTableTransforms": null,
"useWebAnalyticsPreAggregatedTables": null,
"webAnalyticsFirstPageviewFilters": null
},
"schema": null,
"filters": null,
"timezone": "Africa/Abidjan",
"offset_day": 6,
"offset_hour": 23
}
]
}

List all batch exports

Also available via the PostHog MCP server:

  • batch-exports-list — List batch exports

Required API key scopes

batch_export:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/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/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",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "AwsS3",
"config": {
"http_path": "string",
"catalog": "string",
"schema": "string",
"table_name": "string",
"use_variant_type": true,
"use_automatic_schema_evolution": true
},
"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",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"hogql_modifiers": {
"bounceRateDurationSeconds": null,
"bounceRatePageViewMode": null,
"convertToProjectTimezone": null,
"cookielessTrafficIsRegular": null,
"customBotDefinitions": null,
"customChannelTypeRules": null,
"dataWarehouseEventsModifiers": null,
"debug": null,
"forceClickhouseDataSkippingIndexes": null,
"formatCsvAllowDoubleQuotes": null,
"inCohortVia": null,
"inlineCohortCalculation": null,
"materializationMode": null,
"materializedColumnsOptimizationMode": null,
"mergeFederatedAggregateJoins": null,
"optimizeJoinedFilters": null,
"optimizeProjections": null,
"parserMode": null,
"personIdPushdown": null,
"personsArgMaxVersion": null,
"personsJoinMode": null,
"personsOnEventsMode": null,
"propertyGroupsMode": null,
"pushDownPredicates": null,
"s3TableUseInvalidColumns": null,
"sessionIdPushdown": null,
"sessionPropertyPreAggregation": null,
"sessionTableVersion": null,
"sessionsV2JoinMode": null,
"timings": null,
"typeAwareCastSimplification": null,
"useMaterializedViews": null,
"useNewEventsSchema": null,
"usePreaggregatedIntermediateResults": null,
"usePreaggregatedTableTransforms": null,
"useWebAnalyticsPreAggregatedTables": null,
"webAnalyticsFirstPageviewFilters": null
},
"schema": null,
"filters": null,
"timezone": "Africa/Abidjan",
"offset_day": 6,
"offset_hour": 23
}
]
}

Create batch exports

Required API key scopes

batch_export:write

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • hogql_query
    string | null
  • hogql_modifiers
  • filters
  • timezone
    string | null
  • offset_day
    integer | null
  • offset_hour
    integer | null

Response


Example request

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

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "AwsS3",
"config": {
"http_path": "string",
"catalog": "string",
"schema": "string",
"table_name": "string",
"use_variant_type": true,
"use_automatic_schema_evolution": true
},
"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",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"hogql_modifiers": {
"bounceRateDurationSeconds": null,
"bounceRatePageViewMode": null,
"convertToProjectTimezone": null,
"cookielessTrafficIsRegular": null,
"customBotDefinitions": null,
"customChannelTypeRules": null,
"dataWarehouseEventsModifiers": null,
"debug": null,
"forceClickhouseDataSkippingIndexes": null,
"formatCsvAllowDoubleQuotes": null,
"inCohortVia": null,
"inlineCohortCalculation": null,
"materializationMode": null,
"materializedColumnsOptimizationMode": null,
"mergeFederatedAggregateJoins": null,
"optimizeJoinedFilters": null,
"optimizeProjections": null,
"parserMode": null,
"personIdPushdown": null,
"personsArgMaxVersion": null,
"personsJoinMode": null,
"personsOnEventsMode": null,
"propertyGroupsMode": null,
"pushDownPredicates": null,
"s3TableUseInvalidColumns": null,
"sessionIdPushdown": null,
"sessionPropertyPreAggregation": null,
"sessionTableVersion": null,
"sessionsV2JoinMode": null,
"timings": null,
"typeAwareCastSimplification": null,
"useMaterializedViews": null,
"useNewEventsSchema": null,
"usePreaggregatedIntermediateResults": null,
"usePreaggregatedTableTransforms": null,
"useWebAnalyticsPreAggregatedTables": null,
"webAnalyticsFirstPageviewFilters": null
},
"schema": null,
"filters": null,
"timezone": "Africa/Abidjan",
"offset_day": 6,
"offset_hour": 23
}

Create batch exports

Required API key scopes

batch_export:write

Request parameters

  • name
    string
  • model
  • destination
  • interval
  • paused
    boolean
  • hogql_query
    string | null
  • hogql_modifiers
  • filters
  • timezone
    string | null
  • offset_day
    integer | null
  • offset_hour
    integer | null

Response


Example request

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

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"team_id": 0,
"name": "string",
"model": "events",
"destination": {
"type": "AwsS3",
"config": {
"http_path": "string",
"catalog": "string",
"schema": "string",
"table_name": "string",
"use_variant_type": true,
"use_automatic_schema_evolution": true
},
"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",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"hogql_modifiers": {
"bounceRateDurationSeconds": null,
"bounceRatePageViewMode": null,
"convertToProjectTimezone": null,
"cookielessTrafficIsRegular": null,
"customBotDefinitions": null,
"customChannelTypeRules": null,
"dataWarehouseEventsModifiers": null,
"debug": null,
"forceClickhouseDataSkippingIndexes": null,
"formatCsvAllowDoubleQuotes": null,
"inCohortVia": null,
"inlineCohortCalculation": null,
"materializationMode": null,
"materializedColumnsOptimizationMode": null,
"mergeFederatedAggregateJoins": null,
"optimizeJoinedFilters": null,
"optimizeProjections": null,
"parserMode": null,
"personIdPushdown": null,
"personsArgMaxVersion": null,
"personsJoinMode": null,
"personsOnEventsMode": null,
"propertyGroupsMode": null,
"pushDownPredicates": null,
"s3TableUseInvalidColumns": null,
"sessionIdPushdown": null,
"sessionPropertyPreAggregation": null,
"sessionTableVersion": null,
"sessionsV2JoinMode": null,
"timings": null,
"typeAwareCastSimplification": null,
"useMaterializedViews": null,
"useNewEventsSchema": null,
"usePreaggregatedIntermediateResults": null,
"usePreaggregatedTableTransforms": null,
"useWebAnalyticsPreAggregatedTables": null,
"webAnalyticsFirstPageviewFilters": null
},
"schema": null,
"filters": null,
"timezone": "Africa/Abidjan",
"offset_day": 6,
"offset_hour": 23
}

List all batch exports backfills

ViewSet for BatchExportBackfill models.

Allows creating and reading backfills, but not updating or deleting them.

Required API key scopes

batch_export:read

Path parameters

  • batch_export_id
    string

Query parameters

  • cursor
    string
  • ordering
    string

Response


Example request

GET /api/projects/:project_id/batch_exports/:batch_export_id/backfills
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/:batch_export_id/backfills/

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"",
"previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"progress": {
"total_runs": 0,
"finished_runs": 0,
"progress": 0
},
"start_at": "2019-08-24T14:15:22Z",
"end_at": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"total_records_count": -9223372036854776000,
"adjusted_start_at": "2019-08-24T14:15:22Z",
"team": 0,
"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"
}
]
}

Create batch exports backfills

Create a new backfill for a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string

Request parameters

  • start_at
    string | null
  • end_at
    string | null
  • status
  • finished_at
    string | null
  • total_records_count
    integer | null
  • adjusted_start_at
    string | null
  • team
    integer
  • batch_export
    string

Response


Example request

POST /api/projects/:project_id/batch_exports/:batch_export_id/backfills
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/:batch_export_id/backfills/\
-d status=undefined,\
-d team="integer",\
-d batch_export="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"progress": {
"total_runs": 0,
"finished_runs": 0,
"progress": 0
},
"start_at": "2019-08-24T14:15:22Z",
"end_at": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"total_records_count": -9223372036854776000,
"adjusted_start_at": "2019-08-24T14:15:22Z",
"team": 0,
"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"
}

Retrieve batch exports backfills

ViewSet for BatchExportBackfill models.

Allows creating and reading backfills, but not updating or deleting them.

Required API key scopes

batch_export:read

Path parameters

  • batch_export_id
    string
  • id
    string

Response


Example request

GET /api/projects/:project_id/batch_exports/:batch_export_id/backfills/: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/batch_exports/:batch_export_id/backfills/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"progress": {
"total_runs": 0,
"finished_runs": 0,
"progress": 0
},
"start_at": "2019-08-24T14:15:22Z",
"end_at": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"last_updated_at": "2019-08-24T14:15:22Z",
"total_records_count": -9223372036854776000,
"adjusted_start_at": "2019-08-24T14:15:22Z",
"team": 0,
"batch_export": "0fa0a8a1-f280-4977-8bb4-bc7801a6902f"
}

Create batch exports backfills cancel

Cancel a batch export backfill.

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string
  • id
    string

Request parameters

  • start_at
    string | null
  • end_at
    string | null
  • status
  • finished_at
    string | null
  • total_records_count
    integer | null
  • adjusted_start_at
    string | null
  • team
    integer
  • batch_export
    string

Example request

POST /api/projects/:project_id/batch_exports/:batch_export_id/backfills/: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/batch_exports/:batch_export_id/backfills/:id/cancel/\
-d status=undefined,\
-d team="integer",\
-d batch_export="string"

Example response

Status 200 No response body

List all batch exports runs

Required API key scopes

batch_export:read

Path parameters

  • batch_export_id
    string

Query parameters

  • after
    string
  • before
    string
  • cursor
    string
  • end
    string
  • ordering
    string
  • start
    string
  • status
    array

Response


Example request

GET /api/projects/:project_id/batch_exports/:batch_export_id/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/batch_exports/:batch_export_id/runs/

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"",
"previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
]
}

List all batch exports runs

Required API key scopes

batch_export:read

Path parameters

  • batch_export_id
    string

Query parameters

  • after
    string
  • before
    string
  • cursor
    string
  • end
    string
  • ordering
    string
  • start
    string
  • status
    array

Response


Example request

GET /api/projects/:project_id/batch_exports/:batch_export_id/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/batch_exports/:batch_export_id/runs/

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?cursor=cD00ODY%3D\"",
"previous": "http://api.example.org/accounts/?cursor=cj0xJnA9NDg3",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
]
}

Retrieve batch exports runs

Required API key scopes

batch_export:read

Path parameters

  • batch_export_id
    string
  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}

Retrieve batch exports runs

Required API key scopes

batch_export:read

Path parameters

  • batch_export_id
    string
  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}

Create batch exports runs cancel

Cancel a batch export run.

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string
  • id
    string

Request parameters

  • data_interval_end
    string
  • status
  • records_completed
    integer | null
  • records_failed
    integer | null
  • latest_error
    string | null
  • data_interval_start
    string | null
  • cursor
    string | null
  • finished_at
    string | null
  • records_total_count
    integer | null
  • bytes_exported
    integer | null
  • batch_export_on_demand
    string | null
  • backfill
    string | null

Example request

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

Example response

Status 200 No response body

Create batch exports runs cancel

Cancel a batch export run.

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string
  • id
    string

Request parameters

  • data_interval_end
    string
  • status
  • records_completed
    integer | null
  • records_failed
    integer | null
  • latest_error
    string | null
  • data_interval_start
    string | null
  • cursor
    string | null
  • finished_at
    string | null
  • records_total_count
    integer | null
  • bytes_exported
    integer | null
  • batch_export_on_demand
    string | null
  • backfill
    string | null

Example request

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

Example response

Status 200 No response body

Retrieve batch exports runs logs

Path parameters

  • batch_export_id
    string
  • 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/batch_exports/:batch_export_id/runs/: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/batch_exports/:batch_export_id/runs/:id/logs/

Example response

Status 200 No response body

Retrieve batch exports runs logs

Path parameters

  • batch_export_id
    string
  • 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/batch_exports/:batch_export_id/runs/: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/batch_exports/:batch_export_id/runs/:id/logs/

Example response

Status 200 No response body

Create batch exports runs retry

Retry a batch export run.

We use the same underlying mechanism as when backfilling a batch export, as retrying a run is the same as backfilling one run.

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string
  • id
    string

Request parameters

  • data_interval_end
    string
  • status
  • records_completed
    integer | null
  • records_failed
    integer | null
  • latest_error
    string | null
  • data_interval_start
    string | null
  • cursor
    string | null
  • finished_at
    string | null
  • records_total_count
    integer | null
  • bytes_exported
    integer | null
  • batch_export_on_demand
    string | null
  • backfill
    string | null

Example request

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

Example response

Status 200 No response body

Create batch exports runs retry

Retry a batch export run.

We use the same underlying mechanism as when backfilling a batch export, as retrying a run is the same as backfilling one run.

Required API key scopes

batch_export:write

Path parameters

  • batch_export_id
    string
  • id
    string

Request parameters

  • data_interval_end
    string
  • status
  • records_completed
    integer | null
  • records_failed
    integer | null
  • latest_error
    string | null
  • data_interval_start
    string | null
  • cursor
    string | null
  • finished_at
    string | null
  • records_total_count
    integer | null
  • bytes_exported
    integer | null
  • batch_export_on_demand
    string | null
  • backfill
    string | null

Example request

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

Example response

Status 200 No response body

Retrieve batch exports

Required API key scopes

batch_export:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/: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/projects/: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": "AwsS3",
"config": {
"http_path": "string",
"catalog": "string",
"schema": "string",
"table_name": "string",
"use_variant_type": true,
"use_automatic_schema_evolution": true
},
"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",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"hogql_modifiers": {
"bounceRateDurationSeconds": null,
"bounceRatePageViewMode": null,
"convertToProjectTimezone": null,
"cookielessTrafficIsRegular": null,
"customBotDefinitions": null,
"customChannelTypeRules": null,
"dataWarehouseEventsModifiers": null,
"debug": null,
"forceClickhouseDataSkippingIndexes": null,
"formatCsvAllowDoubleQuotes": null,
"inCohortVia": null,
"inlineCohortCalculation": null,
"materializationMode": null,
"materializedColumnsOptimizationMode": null,
"mergeFederatedAggregateJoins": null,
"optimizeJoinedFilters": null,
"optimizeProjections": null,
"parserMode": null,
"personIdPushdown": null,
"personsArgMaxVersion": null,
"personsJoinMode": null,
"personsOnEventsMode": null,
"propertyGroupsMode": null,
"pushDownPredicates": null,
"s3TableUseInvalidColumns": null,
"sessionIdPushdown": null,
"sessionPropertyPreAggregation": null,
"sessionTableVersion": null,
"sessionsV2JoinMode": null,
"timings": null,
"typeAwareCastSimplification": null,
"useMaterializedViews": null,
"useNewEventsSchema": null,
"usePreaggregatedIntermediateResults": null,
"usePreaggregatedTableTransforms": null,
"useWebAnalyticsPreAggregatedTables": null,
"webAnalyticsFirstPageviewFilters": null
},
"schema": null,
"filters": null,
"timezone": "Africa/Abidjan",
"offset_day": 6,
"offset_hour": 23
}

Retrieve batch exports

Required API key scopes

batch_export:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/: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/projects/: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": "AwsS3",
"config": {
"http_path": "string",
"catalog": "string",
"schema": "string",
"table_name": "string",
"use_variant_type": true,
"use_automatic_schema_evolution": true
},
"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",
"data_interval_end": "2019-08-24T14:15:22Z",
"status": "Cancelled",
"records_completed": -2147483648,
"records_failed": -2147483648,
"latest_error": "string",
"data_interval_start": "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",
"batch_export_on_demand": "d6e8418b-6c8d-4d3d-8dbd-ab165d4dc1b8",
"backfill": "4f806519-f4aa-4807-bea5-95595ab1adf0"
}
],
"hogql_query": "string",
"hogql_modifiers": {
"bounceRateDurationSeconds": null,
"bounceRatePageViewMode": null,
"convertToProjectTimezone": null,
"cookielessTrafficIsRegular": null,
"customBotDefinitions": null,
"customChannelTypeRules": null,
"dataWarehouseEventsModifiers": null,
"debug": null,
"forceClickhouseDataSkippingIndexes": null,
"formatCsvAllowDoubleQuotes": null,
"inCohortVia": null,
"inlineCohortCalculation": null,
"materializationMode": null,
"materializedColumnsOptimizationMode": null,
"mergeFederatedAggregateJoins": null,
"optimizeJoinedFilters": null,
"optimizeProjections": null,
"parserMode": null,
"personIdPushdown": null,
"personsArgMaxVersion": null,
"personsJoinMode": null,
"personsOnEventsMode": null,
"propertyGroupsMode": null,
"pushDownPredicates": null,
"s3TableUseInvalidColumns": null,
"sessionIdPushdown": null,
"sessionPropertyPreAggregation": null,
"sessionTableVersion": null,
"sessionsV2JoinMode": null,
"timings": null,
"typeAwareCastSimplification": null,
"useMaterializedViews": null,
"useNewEventsSchema": null,
"usePreaggregatedIntermediateResults": null,
"usePreaggregatedTableTransforms": null,
"useWebAnalyticsPreAggregatedTables": null,
"webAnalyticsFirstPageviewFilters": null
},
"schema": null,
"filters": null,
"timezone": "Africa/Abidjan",
"offset_day": 6,
"offset_hour": 23
}