|
| 1 | +--- |
| 2 | +title: Webhooks |
| 3 | +title_tag: "Pulumi Cloud REST API: Webhooks" |
| 4 | +meta_desc: Learn about the Pulumi Cloud REST API endpoints for creating and managing webhooks for organizations and stacks. |
| 5 | +menu: |
| 6 | + cloud: |
| 7 | + parent: pulumi-cloud-reference |
| 8 | + weight: 30 |
| 9 | +--- |
| 10 | + |
| 11 | +The Webhooks API allows you to create and manage webhooks for organizations and stacks. Webhooks notify external services of events happening within your Pulumi organization, such as stack updates, deployments, or policy violations. |
| 12 | + |
| 13 | +For comprehensive information about webhooks including event filtering, payload formats, and UI setup, see the [Webhooks documentation](/docs/pulumi-cloud/webhooks/). |
| 14 | + |
| 15 | +## Webhook Operations |
| 16 | + |
| 17 | +The API provides endpoints for the following operations: |
| 18 | + |
| 19 | +- Creating new webhooks for organizations or stacks |
| 20 | +- Listing webhooks with filtering options |
| 21 | +- Getting webhook details |
| 22 | +- Updating webhook configuration |
| 23 | +- Testing webhooks with ping functionality |
| 24 | +- Deleting webhooks |
| 25 | + |
| 26 | +## Create Webhook |
| 27 | + |
| 28 | +Create a new webhook for an organization or stack. |
| 29 | + |
| 30 | +```plain |
| 31 | +// To create an organization webhook |
| 32 | +POST /api/orgs/{organization}/hooks |
| 33 | +
|
| 34 | +// To create a stack webhook |
| 35 | +POST /api/stacks/{organization}/{project}/{stack}/hooks |
| 36 | +``` |
| 37 | + |
| 38 | +### Parameters |
| 39 | + |
| 40 | +| Parameter | Type | In | Description | |
| 41 | +|--------------------|---------------|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 42 | +| `organization` | string | path | Organization name | |
| 43 | +| `project` | string | path | **Optional.** Project name (required for stack webhooks) | |
| 44 | +| `stack` | string | path | **Optional.** Stack name (required for stack webhooks) | |
| 45 | +| `active` | boolean | body | Enable webhook | |
| 46 | +| `displayName` | string | body | Name of webhook | |
| 47 | +| `organizationName` | string | body | Organization name | |
| 48 | +| `payloadUrl` | string | body | URL to send request to | |
| 49 | +| `projectName` | string | body | **Optional.** Project name (required for stack webhooks) | |
| 50 | +| `stackName` | string | body | **Optional.** Stack name (required for stack webhooks) | |
| 51 | +| `format` | string | body | **Optional.** Format of the payload. Possible values are `raw`, `slack`, `ms_teams` or `pulumi_deployments`. Default is `raw`. | |
| 52 | +| `filters` | array[string] | body | **Optional.** List of filters for events the webhook should receive. See [webhook docs](/docs/pulumi-cloud/webhooks#event-filtering) for more information on what filters are available | |
| 53 | +| `secret` | string | body | **Optional.** Secret used as the HMAC key. See [webhook docs](/docs/pulumi-cloud/webhooks#headers) for more information | |
| 54 | + |
| 55 | +### Example |
| 56 | + |
| 57 | +```bash |
| 58 | +# Create organization webhook |
| 59 | +curl \ |
| 60 | + -H "Accept: application/vnd.pulumi+8" \ |
| 61 | + -H "Content-Type: application/json" \ |
| 62 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 63 | + --request POST \ |
| 64 | + --data '{"active": true, "displayName": "My Webhook", "organizationName": "myorg", "payloadUrl": "https://example.com/webhook"}' \ |
| 65 | + https://api.pulumi.com/api/orgs/{organization}/hooks |
| 66 | + |
| 67 | +# Create stack webhook |
| 68 | +curl \ |
| 69 | + -H "Accept: application/vnd.pulumi+8" \ |
| 70 | + -H "Content-Type: application/json" \ |
| 71 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 72 | + --request POST \ |
| 73 | + --data '{"active": true, "displayName": "Stack Webhook", "organizationName": "myorg", "projectName": "myproject", "stackName": "production", "payloadUrl": "https://example.com/webhook"}' \ |
| 74 | + https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/hooks |
| 75 | +``` |
| 76 | + |
| 77 | +## List Webhooks |
| 78 | + |
| 79 | +List all webhooks for an organization or stack. |
| 80 | + |
| 81 | +```plain |
| 82 | +// List organization webhooks |
| 83 | +GET /api/orgs/{organization}/hooks |
| 84 | +
|
| 85 | +// List stack webhooks |
| 86 | +GET /api/stacks/{organization}/{project}/{stack}/hooks |
| 87 | +``` |
| 88 | + |
| 89 | +### Parameters |
| 90 | + |
| 91 | +| Parameter | Type | In | Description | |
| 92 | +|---------------------|--------|-------|--------------------------------------------------------------------------------------------------------------| |
| 93 | +| `organization` | string | path | Organization name | |
| 94 | +| `project` | string | path | **Optional.** Project name (required for stack webhooks) | |
| 95 | +| `stack` | string | path | **Optional.** Stack name (required for stack webhooks) | |
| 96 | +| `continuationToken` | string | query | **Optional.** The continuation token to use for retrieving the next set of results if results were truncated | |
| 97 | + |
| 98 | +### Example |
| 99 | + |
| 100 | +```bash |
| 101 | +# List organization webhooks |
| 102 | +curl \ |
| 103 | + -H "Accept: application/vnd.pulumi+8" \ |
| 104 | + -H "Content-Type: application/json" \ |
| 105 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 106 | + https://api.pulumi.com/api/orgs/{organization}/hooks |
| 107 | + |
| 108 | +# List stack webhooks |
| 109 | +curl \ |
| 110 | + -H "Accept: application/vnd.pulumi+8" \ |
| 111 | + -H "Content-Type: application/json" \ |
| 112 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 113 | + https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/hooks |
| 114 | +``` |
| 115 | + |
| 116 | +## Get Webhook |
| 117 | + |
| 118 | +Get details about a specific webhook. |
| 119 | + |
| 120 | +```plain |
| 121 | +// Get organization webhook |
| 122 | +GET /api/orgs/{organization}/hooks/{webhookname} |
| 123 | +
|
| 124 | +// Get stack webhook |
| 125 | +GET /api/stacks/{organization}/{project}/{stack}/hooks/{webhookname} |
| 126 | +``` |
| 127 | + |
| 128 | +### Parameters |
| 129 | + |
| 130 | +| Parameter | Type | In | Description | |
| 131 | +|----------------|--------|------|-----------------------------------------------------------| |
| 132 | +| `organization` | string | path | Organization name | |
| 133 | +| `project` | string | path | **Optional.** Project name (required for stack webhooks) | |
| 134 | +| `stack` | string | path | **Optional.** Stack name (required for stack webhooks) | |
| 135 | +| `webhookname` | string | path | Name of the webhook | |
| 136 | + |
| 137 | +### Example |
| 138 | + |
| 139 | +```bash |
| 140 | +# Get organization webhook |
| 141 | +curl \ |
| 142 | + -H "Accept: application/vnd.pulumi+8" \ |
| 143 | + -H "Content-Type: application/json" \ |
| 144 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 145 | + https://api.pulumi.com/api/orgs/{organization}/hooks/{webhookname} |
| 146 | + |
| 147 | +# Get stack webhook |
| 148 | +curl \ |
| 149 | + -H "Accept: application/vnd.pulumi+8" \ |
| 150 | + -H "Content-Type: application/json" \ |
| 151 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 152 | + https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/hooks/{webhookname} |
| 153 | +``` |
| 154 | + |
| 155 | +## Update Webhook |
| 156 | + |
| 157 | +Update an existing webhook. |
| 158 | + |
| 159 | +```plain |
| 160 | +// Update organization webhook |
| 161 | +PATCH /api/orgs/{organization}/hooks/{webhookname} |
| 162 | +
|
| 163 | +// Update stack webhook |
| 164 | +PATCH /api/stacks/{organization}/{project}/{stack}/hooks/{webhookname} |
| 165 | +``` |
| 166 | + |
| 167 | +### Parameters |
| 168 | + |
| 169 | +The update endpoint accepts the same body parameters as the create endpoint. Only include the fields you want to update. |
| 170 | + |
| 171 | +### Example |
| 172 | + |
| 173 | +```bash |
| 174 | +# Update organization webhook |
| 175 | +curl \ |
| 176 | + -H "Accept: application/vnd.pulumi+8" \ |
| 177 | + -H "Content-Type: application/json" \ |
| 178 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 179 | + --request PATCH \ |
| 180 | + --data '{"active": false, "displayName": "Updated Webhook Name"}' \ |
| 181 | + https://api.pulumi.com/api/orgs/{organization}/hooks/{webhookname} |
| 182 | +``` |
| 183 | + |
| 184 | +## Delete Webhook |
| 185 | + |
| 186 | +Delete a webhook. |
| 187 | + |
| 188 | +```plain |
| 189 | +// Delete organization webhook |
| 190 | +DELETE /api/orgs/{organization}/hooks/{webhookname} |
| 191 | +
|
| 192 | +// Delete stack webhook |
| 193 | +DELETE /api/stacks/{organization}/{project}/{stack}/hooks/{webhookname} |
| 194 | +``` |
| 195 | + |
| 196 | +### Parameters |
| 197 | + |
| 198 | +| Parameter | Type | In | Description | |
| 199 | +|----------------|--------|------|-----------------------------------------------------------| |
| 200 | +| `organization` | string | path | Organization name | |
| 201 | +| `project` | string | path | **Optional.** Project name (required for stack webhooks) | |
| 202 | +| `stack` | string | path | **Optional.** Stack name (required for stack webhooks) | |
| 203 | +| `webhookname` | string | path | Name of the webhook | |
| 204 | + |
| 205 | +### Example |
| 206 | + |
| 207 | +```bash |
| 208 | +# Delete organization webhook |
| 209 | +curl \ |
| 210 | + -H "Accept: application/vnd.pulumi+8" \ |
| 211 | + -H "Content-Type: application/json" \ |
| 212 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 213 | + --request DELETE \ |
| 214 | + https://api.pulumi.com/api/orgs/{organization}/hooks/{webhookname} |
| 215 | + |
| 216 | +# Delete stack webhook |
| 217 | +curl \ |
| 218 | + -H "Accept: application/vnd.pulumi+8" \ |
| 219 | + -H "Content-Type: application/json" \ |
| 220 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 221 | + --request DELETE \ |
| 222 | + https://api.stacks/{organization}/{project}/{stack}/hooks/{webhookname} |
| 223 | +``` |
| 224 | + |
| 225 | +## Ping Webhook |
| 226 | + |
| 227 | +Send a test ping to a webhook to validate it's working. |
| 228 | + |
| 229 | +```plain |
| 230 | +// Ping organization webhook |
| 231 | +POST /api/orgs/{organization}/hooks/{webhookname}/ping |
| 232 | +
|
| 233 | +// Ping stack webhook |
| 234 | +POST /api/stacks/{organization}/{project}/{stack}/hooks/{webhookname}/ping |
| 235 | +``` |
| 236 | + |
| 237 | +### Parameters |
| 238 | + |
| 239 | +| Parameter | Type | In | Description | |
| 240 | +|----------------|--------|------|-----------------------------------------------------------| |
| 241 | +| `organization` | string | path | Organization name | |
| 242 | +| `project` | string | path | **Optional.** Project name (required for stack webhooks) | |
| 243 | +| `stack` | string | path | **Optional.** Stack name (required for stack webhooks) | |
| 244 | +| `webhookname` | string | path | Name of the webhook | |
| 245 | + |
| 246 | +### Example |
| 247 | + |
| 248 | +```bash |
| 249 | +# Ping organization webhook |
| 250 | +curl \ |
| 251 | + -H "Accept: application/vnd.pulumi+8" \ |
| 252 | + -H "Content-Type: application/json" \ |
| 253 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 254 | + --request POST \ |
| 255 | + https://api.pulumi.com/api/orgs/{organization}/hooks/{webhookname}/ping |
| 256 | + |
| 257 | +# Ping stack webhook |
| 258 | +curl \ |
| 259 | + -H "Accept: application/vnd.pulumi+8" \ |
| 260 | + -H "Content-Type: application/json" \ |
| 261 | + -H "Authorization: token $PULUMI_ACCESS_TOKEN" \ |
| 262 | + --request POST \ |
| 263 | + https://api.pulumi.com/api/stacks/{organization}/{project}/{stack}/hooks/{webhookname}/ping |
| 264 | +``` |
0 commit comments