Change

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

Endpoints

GET
GET
POST
POST
POST

List all change requests

Required API key scopes

approvals:read

Path parameters

  • project_id
    string

Query parameters

  • action_key
    string
  • limit
    integer
  • offset
    integer
  • requester
    number
  • resource_id
    string
  • resource_type
    string
  • state
    array

Response


Example request

GET /api/environments/:project_id/change_requests
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/environments/:project_id/change_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",
"action_key": "string",
"action_version": 0,
"resource_type": "string",
"resource_id": "string",
"intent": null,
"intent_display": null,
"policy_snapshot": null,
"validation_status": "valid",
"validation_errors": null,
"validated_at": "2019-08-24T14:15:22Z",
"state": "pending",
"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"
},
"applied_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",
"expires_at": "2019-08-24T14:15:22Z",
"applied_at": "2019-08-24T14:15:22Z",
"apply_error": "string",
"result_data": null,
"approvals": [
{}
],
"can_approve": true,
"can_cancel": true,
"is_requester": true,
"user_decision": "string"
}
]
}

Retrieve change requests

Required API key scopes

approvals:read

Path parameters

  • id
    string
  • project_id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"action_key": "string",
"action_version": 0,
"resource_type": "string",
"resource_id": "string",
"intent": null,
"intent_display": null,
"policy_snapshot": null,
"validation_status": "valid",
"validation_errors": null,
"validated_at": "2019-08-24T14:15:22Z",
"state": "pending",
"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"
},
"applied_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",
"expires_at": "2019-08-24T14:15:22Z",
"applied_at": "2019-08-24T14:15:22Z",
"apply_error": "string",
"result_data": null,
"approvals": [
{}
],
"can_approve": true,
"can_cancel": true,
"is_requester": true,
"user_decision": "string"
}

Create change requests approve

Approve a change request. If quorum is reached, automatically applies the change immediately.

Required API key scopes

approvals:write

Path parameters

  • id
    string
  • project_id
    string

Request parameters


    Response


    Example request

    POST /api/environments/:project_id/change_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/environments/:project_id/change_requests/:id/approve/\
    -d action_key="string"

    Example response

    Status 200
    RESPONSE
    {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "action_key": "string",
    "action_version": 0,
    "resource_type": "string",
    "resource_id": "string",
    "intent": null,
    "intent_display": null,
    "policy_snapshot": null,
    "validation_status": "valid",
    "validation_errors": null,
    "validated_at": "2019-08-24T14:15:22Z",
    "state": "pending",
    "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"
    },
    "applied_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",
    "expires_at": "2019-08-24T14:15:22Z",
    "applied_at": "2019-08-24T14:15:22Z",
    "apply_error": "string",
    "result_data": null,
    "approvals": [
    {}
    ],
    "can_approve": true,
    "can_cancel": true,
    "is_requester": true,
    "user_decision": "string"
    }

    Create change requests cancel

    Cancel a change request. Only the requester can cancel their own pending change request.

    Required API key scopes

    approvals:write

    Path parameters

    • id
      string
    • project_id
      string

    Request parameters


      Response


      Example request

      POST /api/environments/:project_id/change_requests/:id/cancel
      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/:project_id/change_requests/:id/cancel/\
      -d action_key="string"

      Example response

      Status 200
      RESPONSE
      {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "action_key": "string",
      "action_version": 0,
      "resource_type": "string",
      "resource_id": "string",
      "intent": null,
      "intent_display": null,
      "policy_snapshot": null,
      "validation_status": "valid",
      "validation_errors": null,
      "validated_at": "2019-08-24T14:15:22Z",
      "state": "pending",
      "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"
      },
      "applied_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",
      "expires_at": "2019-08-24T14:15:22Z",
      "applied_at": "2019-08-24T14:15:22Z",
      "apply_error": "string",
      "result_data": null,
      "approvals": [
      {}
      ],
      "can_approve": true,
      "can_cancel": true,
      "is_requester": true,
      "user_decision": "string"
      }

      Create change requests reject

      Reject a change request.

      Required API key scopes

      approvals:write

      Path parameters

      • id
        string
      • project_id
        string

      Request parameters


        Response


        Example request

        POST /api/environments/:project_id/change_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/environments/:project_id/change_requests/:id/reject/\
        -d action_key="string"

        Example response

        Status 200
        RESPONSE
        {
        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
        "action_key": "string",
        "action_version": 0,
        "resource_type": "string",
        "resource_id": "string",
        "intent": null,
        "intent_display": null,
        "policy_snapshot": null,
        "validation_status": "valid",
        "validation_errors": null,
        "validated_at": "2019-08-24T14:15:22Z",
        "state": "pending",
        "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"
        },
        "applied_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",
        "expires_at": "2019-08-24T14:15:22Z",
        "applied_at": "2019-08-24T14:15:22Z",
        "apply_error": "string",
        "result_data": null,
        "approvals": [
        {}
        ],
        "can_approve": true,
        "can_cancel": true,
        "is_requester": true,
        "user_decision": "string"
        }

        Community questions

        Questions about this page? or post a community question.