Workload Trust

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

Endpoints

GET
POST
GET
PATCH
DELETE
GET

List all workload trust policies

Required API key scopes

workload_trust_policy:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

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",
"issuer": "string",
"provider": "github_actions",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"enabled": 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": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
]
}

Create workload trust policies

Required API key scopes

workload_trust_policy:write

Request parameters

  • name
    string
  • issuer
    string
  • subject_name
    string
  • subject
    string
  • conditions
    object
  • scopes
    array
  • enabled
    boolean

Response


Example request

POST /api/projects/:project_id/workload_trust_policies
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/workload_trust_policies/\
-d name="string",\
-d issuer="string",\
-d subject_name="string",\
-d subject="string",\
-d scopes="array"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"issuer": "string",
"provider": "github_actions",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"enabled": 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": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve workload trust policies

Required API key scopes

workload_trust_policy:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"issuer": "string",
"provider": "github_actions",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"enabled": 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": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Update workload trust policies

Required API key scopes

workload_trust_policy:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • issuer
    string
  • subject_name
    string
  • subject
    string
  • conditions
    object
  • scopes
    array
  • enabled
    boolean

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"issuer": "string",
"provider": "github_actions",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"enabled": 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": {},
"role_at_organization": "engineering"
},
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Delete workload trust policies

Required API key scopes

workload_trust_policy:write

Path parameters

  • id
    string

Example request

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

Example response

Status 204 No response body

Retrieve workload trust policies providers

Required API key scopes

workload_trust_policy:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"supported": [
{
"key": "github_actions",
"name": "string",
"issuer": "string",
"docs_url": "string",
"subject_claim": {
"name": "string",
"label": "string",
"help_text": "string",
"placeholder": "string"
},
"subject_name_claim": {
"name": "string",
"label": "string",
"help_text": "string",
"placeholder": "string"
},
"condition_claims": [
{
"name": "string",
"label": "string",
"help_text": "string",
"placeholder": "string"
}
],
"required_condition_claims": [
"string"
],
"account_condition_claims": [
"string"
],
"condition_presets": [
{
"key": "string",
"label": "string",
"help_text": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"takes_value": true,
"placeholder": "string",
"default_value": "string"
}
],
"condition_companions": [
{
"claims": [
"string"
],
"companions": [
"string"
],
"reason": "string"
}
],
"required_presets": [
"string"
],
"default_presets": [
"string"
],
"can_resolve_subject": true,
"subject_lookup_conditions": {
"property1": "string",
"property2": "string"
},
"setup_snippet": "string"
}
],
"job_settings": {
"host": "string",
"project_id": 0,
"host_in_posthog_json": true
},
"grantable_scopes": [
"string"
],
"risky_scopes": {
"property1": "string",
"property2": "string"
}
}