Organizations-4

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

Endpoints

PATCH
GET
POST
DELETE
GET
GET
POST
GET
PATCH
DELETE
GET
POST
GET
DELETE
GET

Update organizations projects rotate secret token

Projects for the current organization.

Path parameters

  • id
    integer

Request parameters

  • name
    string
  • product_description
    stringnull
  • app_urls
    array
  • anonymize_ips
    boolean
  • completed_snippet_onboarding
    boolean
  • test_account_filters
  • test_account_filters_default_checked
    booleannull
  • path_cleaning_filters
  • is_demo
    boolean
  • timezone
  • data_attributes
  • person_display_name_properties
    arraynull
  • correlation_config
  • autocapture_opt_out
    booleannull
  • autocapture_exceptions_opt_in
    booleannull
  • autocapture_web_vitals_opt_in
    booleannull
  • autocapture_web_vitals_allowed_metrics
  • autocapture_exceptions_errors_to_ignore
  • capture_console_log_opt_in
    booleannull
  • capture_performance_opt_in
    booleannull
  • session_recording_opt_in
    boolean
  • session_recording_sample_rate
    stringnull
  • session_recording_minimum_duration_milliseconds
    integernull
  • session_recording_linked_flag
  • session_recording_network_payload_capture_config
  • session_recording_masking_config
  • session_recording_url_trigger_config
    arraynull
  • session_recording_url_blocklist_config
    arraynull
  • session_recording_event_trigger_config
    arraynull
  • session_recording_trigger_match_type_config
    stringnull
  • session_recording_trigger_groups
  • session_recording_retention_period
  • session_replay_config
  • survey_config
  • access_control
    boolean
  • week_start_day
  • primary_dashboard
    integernull
  • live_events_columns
    arraynull
  • recording_domains
    arraynull
  • inject_web_apps
    booleannull
  • extra_settings
  • modifiers
  • has_completed_onboarding_for
  • surveys_opt_in
    booleannull
  • heatmaps_opt_in
    booleannull
  • flags_persistence_default
    booleannull
  • receive_org_level_activity_logs
    booleannull
  • business_model
  • conversations_enabled
    booleannull
  • conversations_settings
  • logs_settings
  • proactive_tasks_enabled
    booleannull

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": 0,
"organization": "452c1a86-a0af-475b-b03f-724878b0f387",
"name": "string",
"product_description": "string",
"created_at": "2019-08-24T14:15:22Z",
"effective_membership_level": 1,
"has_group_types": true,
"group_types": [
{}
],
"live_events_token": "string",
"updated_at": "2019-08-24T14:15:22Z",
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"api_token": "string",
"app_urls": [
"string"
],
"anonymize_ips": true,
"completed_snippet_onboarding": true,
"ingested_event": true,
"test_account_filters": null,
"test_account_filters_default_checked": true,
"path_cleaning_filters": null,
"is_demo": true,
"timezone": "Africa/Abidjan",
"data_attributes": null,
"person_display_name_properties": [
"string"
],
"correlation_config": null,
"autocapture_opt_out": true,
"autocapture_exceptions_opt_in": true,
"autocapture_web_vitals_opt_in": true,
"autocapture_web_vitals_allowed_metrics": null,
"autocapture_exceptions_errors_to_ignore": null,
"capture_console_log_opt_in": true,
"capture_performance_opt_in": true,
"session_recording_opt_in": true,
"session_recording_sample_rate": "string",
"session_recording_minimum_duration_milliseconds": 30000,
"session_recording_linked_flag": null,
"session_recording_network_payload_capture_config": null,
"session_recording_masking_config": null,
"session_recording_url_trigger_config": [
null
],
"session_recording_url_blocklist_config": [
null
],
"session_recording_event_trigger_config": [
"string"
],
"session_recording_trigger_match_type_config": "string",
"session_recording_trigger_groups": null,
"session_recording_retention_period": "30d",
"session_replay_config": null,
"survey_config": null,
"access_control": true,
"week_start_day": 0,
"primary_dashboard": 0,
"live_events_columns": [
"string"
],
"recording_domains": [
"string"
],
"person_on_events_querying_enabled": true,
"inject_web_apps": true,
"extra_settings": null,
"modifiers": null,
"default_modifiers": {},
"has_completed_onboarding_for": null,
"surveys_opt_in": true,
"heatmaps_opt_in": true,
"product_intents": [
{
"product_type": "string",
"created_at": "2019-08-24T14:15:22Z",
"onboarding_completed_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
],
"flags_persistence_default": true,
"secret_api_token": "string",
"secret_api_token_backup": "string",
"receive_org_level_activity_logs": true,
"business_model": "b2b",
"conversations_enabled": true,
"conversations_settings": null,
"logs_settings": null,
"proactive_tasks_enabled": true,
"available_setup_task_ids": [
"ingest_first_event"
]
}

List all role external references

Required API key scopes

organization:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/organizations/:organization_id/role_external_references
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/role_external_references/

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",
"provider": "string",
"provider_organization_id": "string",
"provider_role_id": "string",
"provider_role_slug": "string",
"provider_role_name": "string",
"role": "543e2fa5-dae3-497f-aa96-e06da8fcb379",
"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"
}
}
]
}

Create role external references

Required API key scopes

organization:write

Request parameters

  • provider
    string
  • provider_organization_id
    string
  • provider_role_id
    string
  • provider_role_slug
    stringnull
  • provider_role_name
    string
  • role
    string

Response


Example request

POST /api/organizations/:organization_id/role_external_references
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/organizations/:organization_id/role_external_references/\
-d provider="string",\
-d provider_organization_id="string",\
-d provider_role_id="string",\
-d provider_role_name="string",\
-d role="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"provider": "string",
"provider_organization_id": "string",
"provider_role_id": "string",
"provider_role_slug": "string",
"provider_role_name": "string",
"role": "543e2fa5-dae3-497f-aa96-e06da8fcb379",
"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"
}
}

Delete role external references

Required API key scopes

organization:write

Path parameters

  • id
    string

Example request

DELETE /api/organizations/:organization_id/role_external_references/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/role_external_references/:id/

Example response

Status 204 No response body

Retrieve role external references lookup

Query parameters

  • provider
    string
  • provider_organization_id
    string
  • provider_role_id
    string
  • provider_role_slug
    string

Response


Example request

GET /api/organizations/:organization_id/role_external_references/lookup
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/role_external_references/lookup/

Example response

Status 200
RESPONSE
{
"reference": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"provider": "string",
"provider_organization_id": "string",
"provider_role_id": "string",
"provider_role_slug": "string",
"provider_role_name": "string",
"role": "543e2fa5-dae3-497f-aa96-e06da8fcb379",
"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"
}
}
}

List all roles

Also available via the PostHog MCP server:

  • roles-listList organization roles.

Required API key scopes

organization:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/organizations/:organization_id/roles
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/roles/

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",
"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"
},
"members": [
{}
],
"is_default": true
}
]
}

Create roles

Required API key scopes

organization:write

Request parameters

  • name
    string

Response


Example request

POST /api/organizations/:organization_id/roles
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/organizations/:organization_id/roles/\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "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"
},
"members": [
{}
],
"is_default": true
}

Retrieve roles

Required API key scopes

organization:read

Path parameters

  • id
    string

Response


Example request

GET /api/organizations/:organization_id/roles/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/roles/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "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"
},
"members": [
{}
],
"is_default": true
}

Update roles

Required API key scopes

organization:write

Path parameters

  • id
    string

Request parameters

  • name
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "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"
},
"members": [
{}
],
"is_default": true
}

Delete roles

Required API key scopes

organization:write

Path parameters

  • id
    string

Example request

DELETE /api/organizations/:organization_id/roles/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/roles/:id/

Example response

Status 204 No response body

List all roles role memberships

Required API key scopes

organization:read

Path parameters

  • role_id
    string

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/organizations/:organization_id/roles/:role_id/role_memberships
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/roles/:role_id/role_memberships/

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",
"role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9",
"organization_member": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"user": {
"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"
},
"level": 1,
"joined_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"is_2fa_enabled": true,
"has_social_auth": true,
"last_login": "2019-08-24T14:15:22Z"
},
"user": {
"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"
},
"joined_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_uuid": "7c4d2d7d-8620-4fb3-967a-4a621082cf1f"
}
]
}

Create roles role memberships

Required API key scopes

organization:write

Path parameters

  • role_id
    string

Request parameters

  • user_uuid
    string

Response


Example request

POST /api/organizations/:organization_id/roles/:role_id/role_memberships
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/organizations/:organization_id/roles/:role_id/role_memberships/\
-d user_uuid="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9",
"organization_member": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"user": {
"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"
},
"level": 1,
"joined_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"is_2fa_enabled": true,
"has_social_auth": true,
"last_login": "2019-08-24T14:15:22Z"
},
"user": {
"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"
},
"joined_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_uuid": "7c4d2d7d-8620-4fb3-967a-4a621082cf1f"
}

Retrieve roles role memberships

Required API key scopes

organization:read

Path parameters

  • id
    string
  • role_id
    string

Response


Example request

GET /api/organizations/:organization_id/roles/:role_id/role_memberships/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/roles/:role_id/role_memberships/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"role_id": "ac4e70c8-d5be-48af-93eb-760f58fc91a9",
"organization_member": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"user": {
"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"
},
"level": 1,
"joined_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"is_2fa_enabled": true,
"has_social_auth": true,
"last_login": "2019-08-24T14:15:22Z"
},
"user": {
"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"
},
"joined_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"user_uuid": "7c4d2d7d-8620-4fb3-967a-4a621082cf1f"
}

Delete roles role memberships

Required API key scopes

organization:write

Path parameters

  • id
    string
  • role_id
    string

Example request

DELETE /api/organizations/:organization_id/roles/:role_id/role_memberships/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/roles/:role_id/role_memberships/:id/

Example response

Status 204 No response body

Retrieve welcome current

Aggregated payload for the invited-user welcome screen.

Response


Example request

GET /api/organizations/:organization_id/welcome/current
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/organizations/:organization_id/welcome/current/

Example response

Status 200
RESPONSE
{
"organization_name": "string",
"inviter": {
"name": "string",
"email": "user@example.com"
},
"team_members": [
{
"name": "string",
"email": "user@example.com",
"avatar": "string",
"role": "string",
"last_active": "today"
}
],
"recent_activity": [
{
"type": "string",
"actor_name": "string",
"entity_name": "string",
"entity_url": "string",
"timestamp": "2019-08-24T14:15:22Z"
}
],
"popular_dashboards": [
{
"id": 0,
"name": "string",
"description": "string",
"team_id": 0,
"url": "string"
}
],
"products_in_use": [
"string"
],
"suggested_next_steps": [
{
"label": "string",
"href": "string",
"reason": "string",
"docs_href": "string",
"product_key": "string"
}
],
"is_organization_first_user": true
}
Status 404 Current organization not found

Community questions

Questions about this page? or post a community question.