Custom Property

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

Endpoints

GET
POST
GET
PATCH
DELETE
GET

List all custom property definitions

Required API key scopes

account:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"name": "string",
"description": "string",
"display_type": "text",
"target_type": "account",
"group_type_index": 4,
"is_big_number": false,
"options": [
{
"id": "string",
"label": "string",
"color": "preset-1"
}
],
"source": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition": "c35d856b-b1ee-4229-bde7-cabd2df03b58",
"saved_query": "e3652b9e-1a82-4fa6-9330-52b013787fcc",
"external_data_schema": "ba92a32d-bbb9-4eb7-b909-202e1efb6c98",
"source_column": "string",
"column_property_map": null,
"column_descriptions": null,
"key_column": "string",
"is_enabled": true,
"consecutive_failures": 0,
"last_synced_at": "2019-08-24T14:15:22Z",
"last_sync_error": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"sync_frequency_interval_seconds": 0,
"next_sync_at": "2019-08-24T14:15:22Z",
"latest_run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trigger": "string",
"status": "string",
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"rows_read": 0,
"changed": 0,
"existing": 0,
"produced": 0,
"skipped_missing_person": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z"
}
},
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"references": [
{
"id": "string",
"name": "string",
"status": "string",
"type": "string"
}
]
}
]
}

Create custom property definitions

Required API key scopes

account:write

Request parameters

  • name
    string
  • description
    stringnull
  • display_type
  • target_type
    Default: account
  • group_type_index
    integernull
  • is_big_number
    boolean
    Default: false
  • options
    Click to open
    arraynull

Response


Example request

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

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"display_type": "text",
"target_type": "account",
"group_type_index": 4,
"is_big_number": false,
"options": [
{
"id": "string",
"label": "string",
"color": "preset-1"
}
],
"source": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition": "c35d856b-b1ee-4229-bde7-cabd2df03b58",
"saved_query": "e3652b9e-1a82-4fa6-9330-52b013787fcc",
"external_data_schema": "ba92a32d-bbb9-4eb7-b909-202e1efb6c98",
"source_column": "string",
"column_property_map": null,
"column_descriptions": null,
"key_column": "string",
"is_enabled": true,
"consecutive_failures": 0,
"last_synced_at": "2019-08-24T14:15:22Z",
"last_sync_error": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"sync_frequency_interval_seconds": 0,
"next_sync_at": "2019-08-24T14:15:22Z",
"latest_run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trigger": "string",
"status": "string",
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"rows_read": 0,
"changed": 0,
"existing": 0,
"produced": 0,
"skipped_missing_person": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z"
}
},
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"references": [
{
"id": "string",
"name": "string",
"status": "string",
"type": "string"
}
]
}

Retrieve custom property definitions

Required API key scopes

account:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"display_type": "text",
"target_type": "account",
"group_type_index": 4,
"is_big_number": false,
"options": [
{
"id": "string",
"label": "string",
"color": "preset-1"
}
],
"source": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition": "c35d856b-b1ee-4229-bde7-cabd2df03b58",
"saved_query": "e3652b9e-1a82-4fa6-9330-52b013787fcc",
"external_data_schema": "ba92a32d-bbb9-4eb7-b909-202e1efb6c98",
"source_column": "string",
"column_property_map": null,
"column_descriptions": null,
"key_column": "string",
"is_enabled": true,
"consecutive_failures": 0,
"last_synced_at": "2019-08-24T14:15:22Z",
"last_sync_error": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"sync_frequency_interval_seconds": 0,
"next_sync_at": "2019-08-24T14:15:22Z",
"latest_run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trigger": "string",
"status": "string",
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"rows_read": 0,
"changed": 0,
"existing": 0,
"produced": 0,
"skipped_missing_person": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z"
}
},
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"references": [
{
"id": "string",
"name": "string",
"status": "string",
"type": "string"
}
]
}

Update custom property definitions

Required API key scopes

account:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • description
    stringnull
  • display_type
  • target_type
    Default: account
  • group_type_index
    integernull
  • is_big_number
    boolean
    Default: false
  • options
    Click to open
    arraynull

Response


Example request

PATCH /api/projects/:project_id/custom_property_definitions/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/custom_property_definitions/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"display_type": "text",
"target_type": "account",
"group_type_index": 4,
"is_big_number": false,
"options": [
{
"id": "string",
"label": "string",
"color": "preset-1"
}
],
"source": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"definition": "c35d856b-b1ee-4229-bde7-cabd2df03b58",
"saved_query": "e3652b9e-1a82-4fa6-9330-52b013787fcc",
"external_data_schema": "ba92a32d-bbb9-4eb7-b909-202e1efb6c98",
"source_column": "string",
"column_property_map": null,
"column_descriptions": null,
"key_column": "string",
"is_enabled": true,
"consecutive_failures": 0,
"last_synced_at": "2019-08-24T14:15:22Z",
"last_sync_error": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"sync_frequency_interval_seconds": 0,
"next_sync_at": "2019-08-24T14:15:22Z",
"latest_run": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"trigger": "string",
"status": "string",
"started_at": "2019-08-24T14:15:22Z",
"finished_at": "2019-08-24T14:15:22Z",
"rows_read": 0,
"changed": 0,
"existing": 0,
"produced": 0,
"skipped_missing_person": 0,
"error": "string",
"created_at": "2019-08-24T14:15:22Z"
}
},
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"updated_at": "2019-08-24T14:15:22Z",
"references": [
{
"id": "string",
"name": "string",
"status": "string",
"type": "string"
}
]
}

Delete custom property definitions

Required API key scopes

account:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/custom_property_definitions/: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/custom_property_definitions/:id/

Example response

Status 204 No response body

Retrieve custom property definitions values

Required API key scopes

account:read

Query parameters

  • key
    string
  • value
    string

Response


Example request

GET /api/projects/:project_id/custom_property_definitions/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/custom_property_definitions/values/

Example response

Status 200
RESPONSE
{
"results": [
{
"name": "string"
}
],
"refreshing": true
}

Community questions