Organizations-2

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

Endpoints

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

Retrieve batch exports logs

Path parameters

  • id
    string

    A UUID string identifying this batch export.

  • organization_id
    string

Example request

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

Example response

Status 200 No response body

Create batch exports pause

Pause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string

    A UUID string identifying this batch export.

  • organization_id
    string

Request parameters

  • name
    string

    A human-readable name for this BatchExport.

  • model

    Which model this BatchExport is exporting.

    • events - Events
    • persons - Persons
    • sessions - Sessions
  • destination
  • interval
  • paused
    boolean

    Whether this BatchExport is paused or not.

  • last_paused_at
    string

    The timestamp at which this BatchExport was last paused.

  • start_at
    string

    Time before which any Batch Export runs won't be triggered.

  • end_at
    string

    Time after which any Batch Export runs won't be triggered.

  • hogql_query
    string
  • filters

Example request

POST /api/organizations/:organization_id/batch_exports/:id/pause
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/batch_exports/:id/pause/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create batch exports run test step

Required API key scopes

INTERNAL

Path parameters

  • id
    string

    A UUID string identifying this batch export.

  • organization_id
    string

Request parameters

  • name
    string

    A human-readable name for this BatchExport.

  • model

    Which model this BatchExport is exporting.

    • events - Events
    • persons - Persons
    • sessions - Sessions
  • destination
  • interval
  • paused
    boolean

    Whether this BatchExport is paused or not.

  • last_paused_at
    string

    The timestamp at which this BatchExport was last paused.

  • start_at
    string

    Time before which any Batch Export runs won't be triggered.

  • end_at
    string

    Time after which any Batch Export runs won't be triggered.

  • hogql_query
    string
  • filters

Example request

POST /api/organizations/:organization_id/batch_exports/:id/run_test_step
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/batch_exports/:id/run_test_step/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create batch exports unpause

Unpause a BatchExport.

Required API key scopes

batch_export:write

Path parameters

  • id
    string

    A UUID string identifying this batch export.

  • organization_id
    string

Request parameters

  • name
    string

    A human-readable name for this BatchExport.

  • model

    Which model this BatchExport is exporting.

    • events - Events
    • persons - Persons
    • sessions - Sessions
  • destination
  • interval
  • paused
    boolean

    Whether this BatchExport is paused or not.

  • last_paused_at
    string

    The timestamp at which this BatchExport was last paused.

  • start_at
    string

    Time before which any Batch Export runs won't be triggered.

  • end_at
    string

    Time after which any Batch Export runs won't be triggered.

  • hogql_query
    string
  • filters

Example request

POST /api/organizations/:organization_id/batch_exports/:id/unpause
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/batch_exports/:id/unpause/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Create batch exports run test step new

Required API key scopes

INTERNAL

Path parameters

  • organization_id
    string

Request parameters

  • name
    string

    A human-readable name for this BatchExport.

  • model

    Which model this BatchExport is exporting.

    • events - Events
    • persons - Persons
    • sessions - Sessions
  • destination
  • interval
  • paused
    boolean

    Whether this BatchExport is paused or not.

  • last_paused_at
    string

    The timestamp at which this BatchExport was last paused.

  • start_at
    string

    Time before which any Batch Export runs won't be triggered.

  • end_at
    string

    Time after which any Batch Export runs won't be triggered.

  • hogql_query
    string
  • filters

Example request

POST /api/organizations/:organization_id/batch_exports/run_test_step_new
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/batch_exports/run_test_step_new/\
-d name="string",\
-d destination=undefined,\
-d interval=undefined

Example response

Status 200 No response body

Retrieve batch exports test

Required API key scopes

INTERNAL

Path parameters

  • organization_id
    string

Example request

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

Example response

Status 200 No response body

List all domains

Required API key scopes

organization: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


Example request

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

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",
"domain": "string",
"is_verified": true,
"verified_at": "2019-08-24T14:15:22Z",
"verification_challenge": "string",
"jit_provisioning_enabled": true,
"sso_enforcement": "string",
"has_saml": true,
"saml_entity_id": "string",
"saml_acs_url": "string",
"saml_x509_cert": "string"
}
]
}

Create domains

Required API key scopes

organization:write

Path parameters

  • organization_id
    string

Request parameters

  • domain
    string
  • jit_provisioning_enabled
    boolean
  • sso_enforcement
    string
  • saml_entity_id
    string
  • saml_acs_url
    string
  • saml_x509_cert
    string

Response


Example request

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

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"domain": "string",
"is_verified": true,
"verified_at": "2019-08-24T14:15:22Z",
"verification_challenge": "string",
"jit_provisioning_enabled": true,
"sso_enforcement": "string",
"has_saml": true,
"saml_entity_id": "string",
"saml_acs_url": "string",
"saml_x509_cert": "string"
}

Retrieve domains

Required API key scopes

organization:read

Path parameters

  • id
    string

    A UUID string identifying this domain.

  • organization_id
    string

Response


Example request

GET /api/organizations/:organization_id/domains/: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/domains/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"domain": "string",
"is_verified": true,
"verified_at": "2019-08-24T14:15:22Z",
"verification_challenge": "string",
"jit_provisioning_enabled": true,
"sso_enforcement": "string",
"has_saml": true,
"saml_entity_id": "string",
"saml_acs_url": "string",
"saml_x509_cert": "string"
}

Update domains

Required API key scopes

organization:write

Path parameters

  • id
    string

    A UUID string identifying this domain.

  • organization_id
    string

Request parameters

  • domain
    string
  • jit_provisioning_enabled
    boolean
  • sso_enforcement
    string
  • saml_entity_id
    string
  • saml_acs_url
    string
  • saml_x509_cert
    string

Response


Example request

PATCH /api/organizations/:organization_id/domains/: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/domains/:id/\
-d domain="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"domain": "string",
"is_verified": true,
"verified_at": "2019-08-24T14:15:22Z",
"verification_challenge": "string",
"jit_provisioning_enabled": true,
"sso_enforcement": "string",
"has_saml": true,
"saml_entity_id": "string",
"saml_acs_url": "string",
"saml_x509_cert": "string"
}

Delete domains

Required API key scopes

organization:write

Path parameters

  • id
    string

    A UUID string identifying this domain.

  • organization_id
    string

Example request

DELETE /api/organizations/:organization_id/domains/: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/domains/:id/

Example response

Status 204 No response body

Create domains verify

Path parameters

  • id
    string

    A UUID string identifying this domain.

  • organization_id
    string

Request parameters

  • domain
    string
  • jit_provisioning_enabled
    boolean
  • sso_enforcement
    string
  • saml_entity_id
    string
  • saml_acs_url
    string
  • saml_x509_cert
    string

Example request

POST /api/organizations/:organization_id/domains/:id/verify
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/domains/:id/verify/\
-d domain="string"

Example response

Status 200 No response body

List all invites

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


Example request

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

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",
"target_email": "user@example.com",
"first_name": "string",
"emailing_attempt_made": true,
"level": 1,
"is_expired": true,
"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": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message": "string",
"private_project_access": null,
"send_email": true,
"combine_pending_invites": false
}
]
}

Create invites

Path parameters

  • organization_id
    string

Request parameters

  • target_email
    string
  • first_name
    string
  • level
  • message
    string
  • private_project_access

    List of team IDs and corresponding access levels to private projects.

  • send_email
    boolean
    Default: true
  • combine_pending_invites
    boolean
    Default: false

Response


Example request

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

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"target_email": "user@example.com",
"first_name": "string",
"emailing_attempt_made": true,
"level": 1,
"is_expired": true,
"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": {
"property1": null,
"property2": null
},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message": "string",
"private_project_access": null,
"send_email": true,
"combine_pending_invites": false
}

Delete invites

Path parameters

  • id
    string

    A UUID string identifying this organization invite.

  • organization_id
    string

Example request

DELETE /api/organizations/:organization_id/invites/: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/invites/:id/

Example response

Status 204 No response body

Create invites bulk

Path parameters

  • organization_id
    string

Request parameters

  • target_email
    string
  • first_name
    string
  • level
  • message
    string
  • private_project_access

    List of team IDs and corresponding access levels to private projects.

  • send_email
    boolean
    Default: true
  • combine_pending_invites
    boolean
    Default: false

Example request

POST /api/organizations/:organization_id/invites/bulk
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/invites/bulk/\
-d target_email="string"

Example response

Status 200 No response body

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


Example 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/

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",
"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
},
"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"
}
]
}

Update members

Required API key scopes

organization_member:write

Path parameters

  • organization_id
    string
  • user__uuid
    string

Request parameters

  • level

Response


Example 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

Example 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
},
"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"
}
Next page →

Community questions

Questions about this page? or post a community question.