Members

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

List all members

Required API key scopes

organization_member:read

Path parameters

  • organization_id
    string

Query parameters

  • limit
    integer

    Number of results to return per page.

  • offset
    integer

    The initial index from which to return the results.

Response


Request

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

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",
"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": {
"property1": null,
"property2": null
}
},
"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"
}
]
}

Update members

Required API key scopes

organization_member:write

Path parameters

  • organization_id
    string
  • user__uuid
    string

Request parameters

  • level

Response


Request

PATCH /api/organizations/:organization_id/members/:user__uuid
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/members/:user__uuid/\
-d user=undefined

Response

Status 200
RESPONSE
{
"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": {
"property1": null,
"property2": null
}
},
"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"
}

Delete members

Required API key scopes

organization_member:write

Path parameters

  • organization_id
    string
  • user__uuid
    string

Request

DELETE /api/organizations/:organization_id/members/:user__uuid
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/members/:user__uuid/

Response

Status 204 No response body

Questions?

  • Kranthi
    a year ago

    Country code of the user

    Hi there,

    Can this api be used to fetch the country code of the current user or a specific user?

    Thank you.

  • Robert
    2 years ago

    :parent_lookup_organization_id

    Where can I find this organization ID?

    • Robert
      Author2 years ago

      I figured it out with some help from a teammate - thanks Paul.

      There is an undocumented API for organizations, and calling it like: /api/organizations/@current returns the current organization.

      Then with that in hand, it's easy to extract the org ID and then use that in the call to /api/organizations/:parent_lookup_organization_id/members/

Was this page useful?

PostHog.com doesn't use third party cookies - only a single in-house cookie.

No data is sent to a third party.

Ursula von der Leyen, President of the European Commission