Project Secret Api

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

Endpoints

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

List all environments project secret api keys

Required API key scopes

project:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/environments/:environment_id/project_secret_api_keys
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/project_secret_api_keys/

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": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}
]
}

Create environments project secret api keys

Required API key scopes

project:write

Request parameters

  • label
    string
  • scopes
    array

Response


Example request

POST /api/environments/:environment_id/project_secret_api_keys
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/environments/:environment_id/project_secret_api_keys/\
-d label="string",\
-d scopes="array"

Example response

Status 201
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

Retrieve environments project secret api keys

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

Update environments project secret api keys

Required API key scopes

project:write

Path parameters

  • id
    string

Request parameters

  • label
    string
  • scopes
    array

Response


Example request

PATCH /api/environments/:environment_id/project_secret_api_keys/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:environment_id/project_secret_api_keys/:id/\
-d label="string"

Example response

Status 200
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

Delete environments project secret api keys

Required API key scopes

project:write

Path parameters

  • id
    string

Example request

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

Example response

Status 204 No response body

Create environments project secret api keys roll

Roll a project secret API key

Path parameters

  • id
    string

Response


Example request

POST /api/environments/:environment_id/project_secret_api_keys/:id/roll
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/environments/:environment_id/project_secret_api_keys/:id/roll/

Example response

Status 200
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

List all project secret api keys

Required API key scopes

project:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}
]
}

Create project secret api keys

Required API key scopes

project:write

Request parameters

  • label
    string
  • scopes
    array

Response


Example request

POST /api/projects/:project_id/project_secret_api_keys
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/project_secret_api_keys/\
-d label="string",\
-d scopes="array"

Example response

Status 201
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

Retrieve project secret api keys

Required API key scopes

project:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

Update project secret api keys

Required API key scopes

project:write

Path parameters

  • id
    string

Request parameters

  • label
    string
  • scopes
    array

Response


Example request

PATCH /api/projects/:project_id/project_secret_api_keys/: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/project_secret_api_keys/:id/\
-d label="string"

Example response

Status 200
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

Delete project secret api keys

Required API key scopes

project:write

Path parameters

  • id
    string

Example request

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

Example response

Status 204 No response body

Create project secret api keys roll

Roll a project secret API key

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/project_secret_api_keys/:id/roll
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/project_secret_api_keys/:id/roll/

Example response

Status 200
RESPONSE
{
"id": "string",
"label": "string",
"value": "string",
"mask_value": "string",
"created_at": "2019-08-24T14:15:22Z",
"created_by": 0,
"last_used_at": "2019-08-24T14:15:22Z",
"last_rolled_at": "2019-08-24T14:15:22Z",
"scopes": [
"string"
]
}

Community questions

Questions about this page? or post a community question.