Users

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

Endpoints

GET
PATCH
GET
GET
POST
DELETE
DELETE
GET
GET
POST

Retrieve users hedgehog config

Required API key scopes

user:read

Path parameters

  • uuid
    string

Example request

GET /api/users/:uuid/hedgehog_config
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/hedgehog_config/

Example response

Status 200 No response body

Retrieve users hedgehog config

Required API key scopes

user:read

Path parameters

  • uuid
    string

Example request

GET /api/users/:uuid/hedgehog_config
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/hedgehog_config/

Example response

Status 200 No response body

Update users hedgehog config

Required API key scopes

user:write

Path parameters

  • uuid
    string

Request parameters

  • first_name
    string
  • last_name
    string
  • email
    string
  • notification_settings
    object
  • anonymize_data
    boolean | null
  • allow_impersonation
    boolean | null
  • toolbar_mode
  • is_staff
    boolean
  • set_current_organization
    string
  • set_current_team
    string
  • password
    string
  • current_password
    string
  • events_column_config
  • has_seen_product_intro_for
  • theme_mode
  • hedgehog_config
  • allow_sidebar_suggestions
    boolean | null
  • shortcut_position
  • role_at_organization
  • passkeys_enabled_for_2fa
    boolean | null
  • hide_mcp_hints
    boolean
  • ui_configuration

Example request

PATCH /api/users/:uuid/hedgehog_config
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/hedgehog_config/\
-d date_joined="string"

Example response

Status 200 No response body

Update users hedgehog config

Required API key scopes

user:write

Path parameters

  • uuid
    string

Request parameters

  • first_name
    string
  • last_name
    string
  • email
    string
  • notification_settings
    object
  • anonymize_data
    boolean | null
  • allow_impersonation
    boolean | null
  • toolbar_mode
  • is_staff
    boolean
  • set_current_organization
    string
  • set_current_team
    string
  • password
    string
  • current_password
    string
  • events_column_config
  • has_seen_product_intro_for
  • theme_mode
  • hedgehog_config
  • allow_sidebar_suggestions
    boolean | null
  • shortcut_position
  • role_at_organization
  • passkeys_enabled_for_2fa
    boolean | null
  • hide_mcp_hints
    boolean
  • ui_configuration

Example request

PATCH /api/users/:uuid/hedgehog_config
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/hedgehog_config/\
-d date_joined="string"

Example response

Status 200 No response body

List all users integrations

Return the authenticated user's personal integrations of a given kind (github or slack).

The response shape varies per kind because the underlying UserIntegration rows carry different identity fields — GitHub rows expose installation_id / account / uses_shared_installation; Slack rows expose slack_user_id / slack_team_id / slack_team_name. Kind-specific destroy and start actions remain split so their distinct semantics (e.g. Slack's lack of "uninstall on last reference") stay explicit at the URL layer.

Default of kind=github is load-bearing: mobile (apps/mobile/...) and the Code SDK (packages/api-client/...) both call this endpoint without a query param today and rely on receiving GitHub rows.

Required API key scopes

user:read

Path parameters

  • uuid
    string

Query parameters

  • kind
    string
    One of: "github""slack"
  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/users/:uuid/integrations
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/

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": [
{
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"kind": "string",
"installation_id": "string",
"repository_selection": "string",
"account": {
"type": "string",
"name": "string"
},
"github_login": "string",
"uses_shared_installation": true,
"installation_shared": true,
"installation_status": "connected",
"created_at": "2019-08-24T14:15:22Z"
}
]
}
]
}

List all users integrations

Return the authenticated user's personal integrations of a given kind (github or slack).

The response shape varies per kind because the underlying UserIntegration rows carry different identity fields — GitHub rows expose installation_id / account / uses_shared_installation; Slack rows expose slack_user_id / slack_team_id / slack_team_name. Kind-specific destroy and start actions remain split so their distinct semantics (e.g. Slack's lack of "uninstall on last reference") stay explicit at the URL layer.

Default of kind=github is load-bearing: mobile (apps/mobile/...) and the Code SDK (packages/api-client/...) both call this endpoint without a query param today and rely on receiving GitHub rows.

Required API key scopes

user:read

Path parameters

  • uuid
    string

Query parameters

  • kind
    string
    One of: "github""slack"
  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/users/:uuid/integrations
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/

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": [
{
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"kind": "string",
"installation_id": "string",
"repository_selection": "string",
"account": {
"type": "string",
"name": "string"
},
"github_login": "string",
"uses_shared_installation": true,
"installation_shared": true,
"installation_status": "connected",
"created_at": "2019-08-24T14:15:22Z"
}
]
}
]
}

Retrieve users integrations codex

/api/users/@me/integrations/ — manage the user's personal GitHub integrations.

Required API key scopes

user:read

Path parameters

  • uuid
    string

Response


Example request

GET /api/users/:uuid/integrations/codex
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/codex/

Example response

Status 200
RESPONSE
{
"status": "connected",
"plan_type": "string",
"email": "user@example.com",
"connected_at": "2019-08-24T14:15:22Z"
}

Retrieve users integrations codex

/api/users/@me/integrations/ — manage the user's personal GitHub integrations.

Required API key scopes

user:read

Path parameters

  • uuid
    string

Response


Example request

GET /api/users/:uuid/integrations/codex
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/codex/

Example response

Status 200
RESPONSE
{
"status": "connected",
"plan_type": "string",
"email": "user@example.com",
"connected_at": "2019-08-24T14:15:22Z"
}

Create users integrations codex

Submit the tokens object of the auth.json that codex login wrote on the user's machine. PostHog refreshes the chain once to prove it works, stores the rotated tokens encrypted, and from then on refreshes them for the user's Codex cloud runs. Only the owning user can connect. No response carries a token.

Required API key scopes

user:write

Path parameters

  • uuid
    string

Request parameters

  • tokens

Response


Example request

POST /api/users/:uuid/integrations/codex
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/users/:uuid/integrations/codex/\
-d tokens=undefined

Example response

Status 200 The account is connected.
RESPONSE
{
"status": "connected",
"plan_type": "string",
"email": "user@example.com",
"connected_at": "2019-08-24T14:15:22Z"
}
Status 400 The tokens are not usable, or OpenAI rejected the refresh token.
Status 403 A cloud task sandbox token cannot connect an account.
Status 404 ChatGPT plans for cloud tasks are not available to this user.
Status 502 OpenAI could not be reached.

Create users integrations codex

Submit the tokens object of the auth.json that codex login wrote on the user's machine. PostHog refreshes the chain once to prove it works, stores the rotated tokens encrypted, and from then on refreshes them for the user's Codex cloud runs. Only the owning user can connect. No response carries a token.

Required API key scopes

user:write

Path parameters

  • uuid
    string

Request parameters

  • tokens

Response


Example request

POST /api/users/:uuid/integrations/codex
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/users/:uuid/integrations/codex/\
-d tokens=undefined

Example response

Status 200 The account is connected.
RESPONSE
{
"status": "connected",
"plan_type": "string",
"email": "user@example.com",
"connected_at": "2019-08-24T14:15:22Z"
}
Status 400 The tokens are not usable, or OpenAI rejected the refresh token.
Status 403 A cloud task sandbox token cannot connect an account.
Status 404 ChatGPT plans for cloud tasks are not available to this user.
Status 502 OpenAI could not be reached.

Delete users integrations codex

Revokes the refresh token at OpenAI and deletes the stored tokens. Idempotent.

Required API key scopes

user:write

Path parameters

  • uuid
    string

Example request

DELETE /api/users/:uuid/integrations/codex
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/codex/

Example response

Status 204 No account is connected any more.
Status 403 A cloud task sandbox token cannot disconnect an account.

Delete users integrations codex

Revokes the refresh token at OpenAI and deletes the stored tokens. Idempotent.

Required API key scopes

user:write

Path parameters

  • uuid
    string

Example request

DELETE /api/users/:uuid/integrations/codex
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/codex/

Example response

Status 204 No account is connected any more.
Status 403 A cloud task sandbox token cannot disconnect an account.

Delete users integrations github

Remove a specific GitHub installation by its installation_id.

Required API key scopes

user:write

Path parameters

  • installation_id
    string
  • uuid
    string

Example request

DELETE /api/users/:uuid/integrations/github/:installation_id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/github/:installation_id/

Example response

Status 204 Integration removed.

Delete users integrations github

Remove a specific GitHub installation by its installation_id.

Required API key scopes

user:write

Path parameters

  • installation_id
    string
  • uuid
    string

Example request

DELETE /api/users/:uuid/integrations/github/:installation_id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/github/:installation_id/

Example response

Status 204 Integration removed.

Retrieve users integrations github branches

List branches for a repository accessible to a personal GitHub installation.

Required API key scopes

user:read

Path parameters

  • installation_id
    string
  • uuid
    string

Query parameters

  • limit
    integer
    Default: 100
  • offset
    integer
    Default: 0
  • repo
    string
  • search
    string
    Default:

Response


Example request

GET /api/users/:uuid/integrations/github/:installation_id/branches
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/github/:installation_id/branches/

Example response

Status 200
RESPONSE
{
"branches": [
"string"
],
"default_branch": "string",
"has_more": true
}

Retrieve users integrations github branches

List branches for a repository accessible to a personal GitHub installation.

Required API key scopes

user:read

Path parameters

  • installation_id
    string
  • uuid
    string

Query parameters

  • limit
    integer
    Default: 100
  • offset
    integer
    Default: 0
  • repo
    string
  • search
    string
    Default:

Response


Example request

GET /api/users/:uuid/integrations/github/:installation_id/branches
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/github/:installation_id/branches/

Example response

Status 200
RESPONSE
{
"branches": [
"string"
],
"default_branch": "string",
"has_more": true
}

Retrieve users integrations github repos

List repositories accessible to a specific GitHub installation (paginated, cached).

Required API key scopes

user:read

Path parameters

  • installation_id
    string
  • uuid
    string

Query parameters

  • compact
    boolean
    Default: false
  • limit
    integer
    Default: 100
  • offset
    integer
    Default: 0
  • search
    string
    Default:

Response


Example request

GET /api/users/:uuid/integrations/github/:installation_id/repos
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/github/:installation_id/repos/

Example response

Status 200
RESPONSE
{
"repositories": [
{
"id": 0,
"name": "string",
"full_name": "string",
"private": true,
"default_branch": "string",
"language": "string",
"pushed_at": "string",
"archived": true,
"can_push": true
}
],
"has_more": true,
"next_offset": 0,
"total": 0
}

Retrieve users integrations github repos

List repositories accessible to a specific GitHub installation (paginated, cached).

Required API key scopes

user:read

Path parameters

  • installation_id
    string
  • uuid
    string

Query parameters

  • compact
    boolean
    Default: false
  • limit
    integer
    Default: 100
  • offset
    integer
    Default: 0
  • search
    string
    Default:

Response


Example request

GET /api/users/:uuid/integrations/github/:installation_id/repos
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/users/:uuid/integrations/github/:installation_id/repos/

Example response

Status 200
RESPONSE
{
"repositories": [
{
"id": 0,
"name": "string",
"full_name": "string",
"private": true,
"default_branch": "string",
"language": "string",
"pushed_at": "string",
"archived": true,
"can_push": true
}
],
"has_more": true,
"next_offset": 0,
"total": 0
}

Create users integrations github repos refresh

Refresh repositories accessible to a specific GitHub installation.

Required API key scopes

user:write

Path parameters

  • installation_id
    string
  • uuid
    string

Response


Example request

POST /api/users/:uuid/integrations/github/:installation_id/repos/refresh
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/users/:uuid/integrations/github/:installation_id/repos/refresh/

Example response

Status 200
RESPONSE
{
"repositories": [
{
"id": 0,
"name": "string",
"full_name": "string",
"private": true,
"default_branch": "string",
"language": "string",
"pushed_at": "string",
"archived": true,
"can_push": true
}
],
"installation_status": "connected"
}

Create users integrations github repos refresh

Refresh repositories accessible to a specific GitHub installation.

Required API key scopes

user:write

Path parameters

  • installation_id
    string
  • uuid
    string

Response


Example request

POST /api/users/:uuid/integrations/github/:installation_id/repos/refresh
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/users/:uuid/integrations/github/:installation_id/repos/refresh/

Example response

Status 200
RESPONSE
{
"repositories": [
{
"id": 0,
"name": "string",
"full_name": "string",
"private": true,
"default_branch": "string",
"language": "string",
"pushed_at": "string",
"archived": true,
"can_push": true
}
],
"installation_status": "connected"
}