Push Token

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

Endpoints

POST
GET
POST
POST
GET

Create push token imports

Reads the file and imports its devices into the push channel in the background. Poll the import to follow its progress.

Required API key scopes

integration:writeperson:write


Response


Example request

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"integration_id": 0,
"status": "running",
"create_missing_persons": true,
"total_devices": 0,
"processed_devices": 0,
"imported_devices": 0,
"failed_devices": 0,
"unknown_person_devices": 0,
"duplicate_lines": 0,
"failures": [
{
"line": 0,
"distinct_id": "string",
"device_token_suffix": "string",
"reason": "invalid_row",
"detail": "string"
}
],
"can_import_unknown_persons": true,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z"
}
Status 400 The file can't be used, or an import into the channel is running.

Retrieve push token imports

Required API key scopes

integration:readperson:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"integration_id": 0,
"status": "running",
"create_missing_persons": true,
"total_devices": 0,
"processed_devices": 0,
"imported_devices": 0,
"failed_devices": 0,
"unknown_person_devices": 0,
"duplicate_lines": 0,
"failures": [
{
"line": 0,
"distinct_id": "string",
"device_token_suffix": "string",
"reason": "invalid_row",
"detail": "string"
}
],
"can_import_unknown_persons": true,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z"
}

Create push token imports cancel

Required API key scopes

integration:writeperson:write

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/push_token_imports/: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/push_token_imports/:id/cancel/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"integration_id": 0,
"status": "running",
"create_missing_persons": true,
"total_devices": 0,
"processed_devices": 0,
"imported_devices": 0,
"failed_devices": 0,
"unknown_person_devices": 0,
"duplicate_lines": 0,
"failures": [
{
"line": 0,
"distinct_id": "string",
"device_token_suffix": "string",
"reason": "invalid_row",
"detail": "string"
}
],
"can_import_unknown_persons": true,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z"
}

Create push token imports import unknown persons

Starts a new import of the devices whose distinct ID had no person, creating those persons.

Required API key scopes

integration:writeperson:write

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/push_token_imports/:id/import_unknown_persons
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/push_token_imports/:id/import_unknown_persons/

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"integration_id": 0,
"status": "running",
"create_missing_persons": true,
"total_devices": 0,
"processed_devices": 0,
"imported_devices": 0,
"failed_devices": 0,
"unknown_person_devices": 0,
"duplicate_lines": 0,
"failures": [
{
"line": 0,
"distinct_id": "string",
"device_token_suffix": "string",
"reason": "invalid_row",
"detail": "string"
}
],
"can_import_unknown_persons": true,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z"
}
Status 400 The devices can't be imported again.

Retrieve push token imports latest

Required API key scopes

integration:readperson:read

Query parameters

  • integration_id
    integer

Response


Example request

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

Example response

Status 200
RESPONSE
{
"latest": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"integration_id": 0,
"status": "running",
"create_missing_persons": true,
"total_devices": 0,
"processed_devices": 0,
"imported_devices": 0,
"failed_devices": 0,
"unknown_person_devices": 0,
"duplicate_lines": 0,
"failures": [
{
"line": 0,
"distinct_id": "string",
"device_token_suffix": "string",
"reason": "invalid_row",
"detail": "string"
}
],
"can_import_unknown_persons": true,
"error": "string",
"created_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z"
}
}