Workload Trust Policy

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

Endpoints

GET
POST
GET
POST
POST
GET
GET

List all workload trust policy requests

Required API key scopes

workload_trust_policy_request:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/workload_trust_policy_requests
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_policy_requests/

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",
"provider_name": "string",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"risky_scopes": {
"property1": "string",
"property2": "string"
},
"status": "pending",
"approval_url": "string",
"can_approve": true,
"approvers": [
"string"
],
"requested_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"
},
"requested_via": "string",
"requested_via_verified": true,
"created_at": "2019-08-24T14:15:22Z",
"expires_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"resolved_at": "2019-08-24T14:15:22Z",
"policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04"
}
]
}

Create workload trust policy requests

Required API key scopes

workload_trust_policy_request:write

Request parameters

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

Response


Example request

POST /api/projects/:project_id/workload_trust_policy_requests
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_policy_requests/\
-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",
"provider_name": "string",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"risky_scopes": {
"property1": "string",
"property2": "string"
},
"status": "pending",
"approval_url": "string",
"can_approve": true,
"approvers": [
"string"
],
"requested_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"
},
"requested_via": "string",
"requested_via_verified": true,
"created_at": "2019-08-24T14:15:22Z",
"expires_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"resolved_at": "2019-08-24T14:15:22Z",
"policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04"
}

Retrieve workload trust policy requests

Required API key scopes

workload_trust_policy_request:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"issuer": "string",
"provider": "github_actions",
"provider_name": "string",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"risky_scopes": {
"property1": "string",
"property2": "string"
},
"status": "pending",
"approval_url": "string",
"can_approve": true,
"approvers": [
"string"
],
"requested_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"
},
"requested_via": "string",
"requested_via_verified": true,
"created_at": "2019-08-24T14:15:22Z",
"expires_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"resolved_at": "2019-08-24T14:15:22Z",
"policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04"
}

Create workload trust policy requests approve

Required API key scopes

workload_trust_policy_request:write

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/workload_trust_policy_requests/:id/approve
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_policy_requests/:id/approve/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"issuer": "string",
"provider": "github_actions",
"provider_name": "string",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"risky_scopes": {
"property1": "string",
"property2": "string"
},
"status": "pending",
"approval_url": "string",
"can_approve": true,
"approvers": [
"string"
],
"requested_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"
},
"requested_via": "string",
"requested_via_verified": true,
"created_at": "2019-08-24T14:15:22Z",
"expires_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"resolved_at": "2019-08-24T14:15:22Z",
"policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04"
}

Create workload trust policy requests reject

Required API key scopes

workload_trust_policy_request:write

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/workload_trust_policy_requests/:id/reject
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_policy_requests/:id/reject/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"issuer": "string",
"provider": "github_actions",
"provider_name": "string",
"subject_name": "string",
"subject": "string",
"conditions": {
"property1": "string",
"property2": "string"
},
"claim_labels": {
"subject": "string",
"subject_name": "string",
"conditions": {
"property1": "string",
"property2": "string"
}
},
"scopes": [
"string"
],
"risky_scopes": {
"property1": "string",
"property2": "string"
},
"status": "pending",
"approval_url": "string",
"can_approve": true,
"approvers": [
"string"
],
"requested_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"
},
"requested_via": "string",
"requested_via_verified": true,
"created_at": "2019-08-24T14:15:22Z",
"expires_at": "2019-08-24T14:15:22Z",
"resolved_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"
},
"resolved_at": "2019-08-24T14:15:22Z",
"policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04"
}

Retrieve workload trust policy requests providers

The supported providers and the settings a job needs, for any member who asks for a policy.

Required API key scopes

workload_trust_policy_request:read

Response


Example request

GET /api/projects/:project_id/workload_trust_policy_requests/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_policy_requests/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"
}
}

Retrieve workload trust policy requests resolve subject

Find a workload's immutable ID from the name people know it by, so nobody has to look the ID up to ask for or write a policy.

Required API key scopes

workload_trust_policy_request:read

Query parameters

  • condition
    array
  • issuer
    string
  • subject_name
    string

Response


Example request

GET /api/projects/:project_id/workload_trust_policy_requests/resolve_subject
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_policy_requests/resolve_subject/

Example response

Status 200
RESPONSE
{
"subject": "string",
"subject_name": "string",
"found_via": "string"
}
Status 404 The provider has no such workload, or PostHog can't ask it.
Status 503 The provider didn't answer.