Customer

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

Endpoints

GET
POST
GET
GET
GET
POST
GET
POST
GET
DELETE
GET
POST
DELETE
POST
GET
POST

Retrieve customer analytics external account

Fetch one account by external ID with its properties, controlled relationship ownership, tags, active relationship assignments and custom property values. Accepts the team secret API token or a project secret API key with the account:read scope.

Query parameters

  • external_id
    string

Response


Example request

GET /api/customer_analytics/external/account
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/customer_analytics/external/account

Example response

Status 200 The account.
RESPONSE
{
"id": "string",
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"properties": {
"property1": null,
"property2": null
},
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"tags": [
"string"
],
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string"
}
]
},
"custom_properties": {
"property1": null,
"property2": null
}
}
Status 400 Missing external_id.
RESPONSE
{
"error": "string"
}
Status 401 Missing or invalid Bearer token.
RESPONSE
{
"error": "string"
}
Status 403 Project secret API key does not carry the account:read scope.
RESPONSE
{
"error": "string"
}
Status 404 No account with that external_id.
RESPONSE
{
"error": "string"
}

Retrieve customer analytics external account

Fetch one account by external ID with its properties, controlled relationship ownership, tags, active relationship assignments and custom property values. Accepts the team secret API token or a project secret API key with the account:read scope.

Query parameters

  • external_id
    string

Response


Example request

GET /api/customer_analytics/external/account
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/customer_analytics/external/account

Example response

Status 200 The account.
RESPONSE
{
"id": "string",
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"properties": {
"property1": null,
"property2": null
},
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"tags": [
"string"
],
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string"
}
]
},
"custom_properties": {
"property1": null,
"property2": null
}
}
Status 400 Missing external_id.
RESPONSE
{
"error": "string"
}
Status 401 Missing or invalid Bearer token.
RESPONSE
{
"error": "string"
}
Status 403 Project secret API key does not carry the account:read scope.
RESPONSE
{
"error": "string"
}
Status 404 No account with that external_id.
RESPONSE
{
"error": "string"
}

Create customer analytics external account

Create an account by external ID. If the account already exists, return it unchanged with HTTP 200. Accepts the team secret API token or a project secret API key with the account:write scope.

Request parameters

  • external_id
    string
  • name
    string | null
  • properties
    object | null

Response


Example request

POST /api/customer_analytics/external/account
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/customer_analytics/external/account\
-d external_id="string"

Example response

Status 200 The account already existed.
RESPONSE
{
"id": "string",
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"properties": {
"property1": null,
"property2": null
},
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"tags": [
"string"
],
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string"
}
]
},
"custom_properties": {
"property1": null,
"property2": null
}
}
Status 201 The account was created.
RESPONSE
{
"id": "string",
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"properties": {
"property1": null,
"property2": null
},
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"tags": [
"string"
],
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string"
}
]
},
"custom_properties": {
"property1": null,
"property2": null
}
}
Status 400 Invalid request body.
Status 401 Missing or invalid Bearer token.
RESPONSE
{
"error": "string"
}
Status 403 Project secret API key does not carry the account:write scope.
RESPONSE
{
"error": "string"
}

Create customer analytics external account

Create an account by external ID. If the account already exists, return it unchanged with HTTP 200. Accepts the team secret API token or a project secret API key with the account:write scope.

Request parameters

  • external_id
    string
  • name
    string | null
  • properties
    object | null

Response


Example request

POST /api/customer_analytics/external/account
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/customer_analytics/external/account\
-d external_id="string"

Example response

Status 200 The account already existed.
RESPONSE
{
"id": "string",
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"properties": {
"property1": null,
"property2": null
},
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"tags": [
"string"
],
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string"
}
]
},
"custom_properties": {
"property1": null,
"property2": null
}
}
Status 201 The account was created.
RESPONSE
{
"id": "string",
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"properties": {
"property1": null,
"property2": null
},
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"tags": [
"string"
],
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string"
}
]
},
"custom_properties": {
"property1": null,
"property2": null
}
}
Status 400 Invalid request body.
Status 401 Missing or invalid Bearer token.
RESPONSE
{
"error": "string"
}
Status 403 Project secret API key does not carry the account:write scope.
RESPONSE
{
"error": "string"
}

Retrieve customer analytics external accounts

List tracked accounts with external IDs, lifecycle timestamps, controlled relationship ownership, and active relationship assignments. Set include_ignored=true to include ignored accounts and managed_only=true to read only the accounts customer analytics holds ownership authority for. Requires a project secret API key or personal API key with the account:read scope. Personal API keys also require project_id and return only accounts the key owner can access.

Query parameters

  • assigned_only
    boolean
    Default: false
  • cursor
    string
  • include_ignored
    boolean
    Default: false
  • limit
    integer
    Default: 100
  • managed_only
    boolean
    Default: false
  • project_id
    integer

Response


Example request

GET /api/customer_analytics/external/accounts
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/customer_analytics/external/accounts

Example response

Status 200 Page of external accounts.
RESPONSE
{
"results": [
{
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string",
"name": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string",
"name": "string"
}
]
}
}
],
"next_cursor": "string"
}
Status 400 Invalid query parameters.
RESPONSE
{
"error": {
"property1": [
"string"
],
"property2": [
"string"
]
}
}
Status 401 Authentication failed.
RESPONSE
{
"error": "string"
}
Status 403 API key lacks the required scope or access to the selected project or accounts.
RESPONSE
{
"error": "string"
}
Status 404 The project selected with a personal API key does not exist.
RESPONSE
{
"type": "string",
"code": "string",
"detail": "string",
"attr": "string"
}

Retrieve customer analytics external accounts

List tracked accounts with external IDs, lifecycle timestamps, controlled relationship ownership, and active relationship assignments. Set include_ignored=true to include ignored accounts and managed_only=true to read only the accounts customer analytics holds ownership authority for. Requires a project secret API key or personal API key with the account:read scope. Personal API keys also require project_id and return only accounts the key owner can access.

Query parameters

  • assigned_only
    boolean
    Default: false
  • cursor
    string
  • include_ignored
    boolean
    Default: false
  • limit
    integer
    Default: 100
  • managed_only
    boolean
    Default: false
  • project_id
    integer

Response


Example request

GET /api/customer_analytics/external/accounts
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/customer_analytics/external/accounts

Example response

Status 200 Page of external accounts.
RESPONSE
{
"results": [
{
"external_id": "string",
"name": "string",
"churned_at": "2019-08-24T14:15:22Z",
"ignored_at": "2019-08-24T14:15:22Z",
"ownership": {
"account_id": "string",
"external_id": "string",
"region": "string",
"roles": [
{
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"definition_name": "string",
"state": "unmanaged",
"controlled_at": "2019-08-24T14:15:22Z",
"relationship_id": "81412018-ffa2-43f9-a3eb-d39f1c5e0f87",
"holder": {
"user_id": 0,
"email": "string",
"name": "string",
"is_organization_member": true,
"is_active": true
},
"diagnostics": [
"holder_missing"
]
}
]
},
"relationships": {
"property1": [
{
"user_id": 0,
"email": "string",
"name": "string"
}
],
"property2": [
{
"user_id": 0,
"email": "string",
"name": "string"
}
]
}
}
],
"next_cursor": "string"
}
Status 400 Invalid query parameters.
RESPONSE
{
"error": {
"property1": [
"string"
],
"property2": [
"string"
]
}
}
Status 401 Authentication failed.
RESPONSE
{
"error": "string"
}
Status 403 API key lacks the required scope or access to the selected project or accounts.
RESPONSE
{
"error": "string"
}
Status 404 The project selected with a personal API key does not exist.
RESPONSE
{
"type": "string",
"code": "string",
"detail": "string",
"attr": "string"
}

List all account notes

Required API key scopes

account:read

Query parameters

  • account_id
    string
  • assigned_to
    array
  • created_by
    array
  • limit
    integer
  • offset
    integer
  • search
    string

Response


Example request

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

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": [
{
"short_id": "string",
"title": "string",
"created_at": "2019-08-24T14:15:22Z",
"last_modified_at": "2019-08-24T14:15:22Z",
"account_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65",
"account_name": "string",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
}
}
]
}

List all accounts custom property values

Required API key scopes

account:read

Path parameters

  • account_id
    string

Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"account_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65",
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by_id": 0
}

Create accounts custom property values

Required API key scopes

account:write

Path parameters

  • account_id
    string

Request parameters

  • definition
    string
  • value

Response


Example request

POST /api/projects/:project_id/accounts/:account_id/custom_property_values
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/accounts/:account_id/custom_property_values/\
-d definition="string",\
-d value=undefined

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"account_id": "449e7a5c-69d3-4b8a-aaaf-5c9b713ebc65",
"definition_id": "91c1994f-b1db-4fef-840d-7d3ab2984871",
"value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by_id": 0
}
Status 204 No response body

List all accounts notebooks

Required API key scopes

account:read

Path parameters

  • account_id
    string

Query parameters

  • limit
    integer
  • offset
    integer
  • ordering
    string
    One of: "-created_at""-created_by""created_at""created_by"
  • search
    string

Response


Example request

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

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",
"short_id": "string",
"title": "string",
"content": null,
"text_content": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"last_modified_at": "2019-08-24T14:15:22Z",
"last_modified_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
}
}
]
}

Create accounts notebooks

Required API key scopes

account:write

Path parameters

  • account_id
    string

Request parameters

  • title
    string | null
  • content
  • text_content
    string | null

Response


Example request

POST /api/projects/:project_id/accounts/:account_id/notebooks
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/accounts/:account_id/notebooks/\
-d title="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"title": "string",
"content": null,
"text_content": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"last_modified_at": "2019-08-24T14:15:22Z",
"last_modified_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
}
}

Retrieve accounts notebooks

Required API key scopes

account:read

Path parameters

  • account_id
    string
  • short_id
    string

Response


Example request

GET /api/projects/:project_id/accounts/:account_id/notebooks/:short_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/accounts/:account_id/notebooks/:short_id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"short_id": "string",
"title": "string",
"content": null,
"text_content": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"last_modified_at": "2019-08-24T14:15:22Z",
"last_modified_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
}
}

Delete accounts notebooks

Required API key scopes

account:write

Path parameters

  • account_id
    string
  • short_id
    string

Example request

DELETE /api/projects/:project_id/accounts/:account_id/notebooks/:short_id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/accounts/:account_id/notebooks/:short_id/

Example response

Status 204 No response body

List all accounts relationships

Required API key scopes

account:read

Path parameters

  • account_id
    string

Query parameters

  • include_history
    boolean

Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"is_single_holder": true,
"is_controlled": true
},
"user": {
"id": 0,
"email": "user@example.com"
},
"started_at": "2019-08-24T14:15:22Z",
"ended_at": "2019-08-24T14:15:22Z",
"source": "human"
}

Create accounts relationships

Required API key scopes

account:write

Path parameters

  • account_id
    string

Request parameters

  • definition
    string
  • user
    integer

Response


Example request

POST /api/projects/:project_id/accounts/:account_id/relationships
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/accounts/:account_id/relationships/\
-d definition="string",\
-d user="integer"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"is_single_holder": true,
"is_controlled": true
},
"user": {
"id": 0,
"email": "user@example.com"
},
"started_at": "2019-08-24T14:15:22Z",
"ended_at": "2019-08-24T14:15:22Z",
"source": "human"
}

Delete accounts relationships

Required API key scopes

account:write

Path parameters

  • account_id
    string
  • id
    string

Example request

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

Example response

Status 204 No response body

Create accounts relationships end

Path parameters

  • account_id
    string
  • id
    string

Response


Example request

POST /api/projects/:project_id/accounts/:account_id/relationships/:id/end
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/accounts/:account_id/relationships/:id/end/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"is_single_holder": true,
"is_controlled": true
},
"user": {
"id": 0,
"email": "user@example.com"
},
"started_at": "2019-08-24T14:15:22Z",
"ended_at": "2019-08-24T14:15:22Z",
"source": "human"
}

List all event streams

The caller's event stream: a live feed of selected accounts' events posted to a Slack channel of their choice. Per-user — each team member owns at most one stream, and every endpoint is scoped to the caller's own. Delivery runs through a managed CDP destination that is re-provisioned inside the same transaction as every write, so config and delivery can't drift apart.

Required API key scopes

account:read

Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"enabled": false,
"event_names": [
"string"
],
"slack_integration": 0,
"slack_channel_id": "",
"slack_channel_name": "",
"account_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z"
}

Create event streams

The caller's event stream: a live feed of selected accounts' events posted to a Slack channel of their choice. Per-user — each team member owns at most one stream, and every endpoint is scoped to the caller's own. Delivery runs through a managed CDP destination that is re-provisioned inside the same transaction as every write, so config and delivery can't drift apart.

Required API key scopes

account:write

Request parameters

  • enabled
    boolean
    Default: false
  • event_names
    array
  • slack_integration
    integer | null
  • slack_channel_id
    string
    Default:
  • slack_channel_name
    string
    Default:

Response


Example request

POST /api/projects/:project_id/event_streams
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/event_streams/\
-d enabled="boolean"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"enabled": false,
"event_names": [
"string"
],
"slack_integration": 0,
"slack_channel_id": "",
"slack_channel_name": "",
"account_ids": [
"497f6eca-6276-4993-bfeb-53cbbbba6f08"
],
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z"
}