Create Notification Channel
POST /notification_channels
POST /notification_channelsInteractive request editor loads with JavaScript.
Authorization
BearerAdminToken Organization-scoped admin token. Read operations require a valid token, and write operations require a token with write permission.
In: header
Request Body
application/json
Create-notification-channel body.
Response Body
application/json
application/json
application/json
application/json
curl -X POST "$AISIX_CP/notification_channels" \ -H "Authorization: Bearer $AISIX_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "string", "type": "webhook", "url": "string" }'Created
{
"notification_channel": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
"name": "string",
"type": "webhook",
"url": "string",
"enabled": true,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
}Request body or parameters failed validation.
{
"error": {
"code": "string",
"message": "string"
}
}Missing or invalid bearer.
{
"error": {
"code": "UNAUTHENTICATED",
"message": "no org context"
}
}The organization already has a channel with this name.
{
"error": {
"code": "DUPLICATE",
"message": "channel name already exists"
}
}Complete operation details and schema variants
POST /notification_channels
Create Notification Channel
Create an outbound notification channel. webhook channels
receive alert events as JSON POSTs; slack channels expect a
Slack incoming-webhook URL and receive a rendered text message.
Enabled channels receive every alert raised in the organization
(budget threshold alerts today). The URL is stored write-only
and masked in every read.
Parameters
Request body
Content type: application/json
-
name(string, required): Human-readable channel name, unique per organization. -
type(string, required): Delivery mechanism.webhookposts alert events as JSON;slackposts a rendered text message to a Slack incoming-webhook URL. -
url(string, required): Destination URL (http/https). Forslackchannels, the Slack incoming-webhook URL. Private / internal addresses are refused at send time unless the deployment opts in viaAISIX_CLOUD_NOTIFY_ALLOW_PRIVATE_URLS.
The masked form reads return (scheme://host/***) is
rejected with 400 here: there is no stored value to keep,
so it can only be a copy of a read response.
enabled(boolean, optional): Defaults totrue.
Responses
-
201: Created -
notification_channel(object, required): An outbound alert destination. Enabled channels receive every alert raised in the organization. -
notification_channel.id(string, required): Notification channel ID. -
notification_channel.org_id(string, required): Organization that owns this channel. -
notification_channel.name(string, required): Human-readable channel name, unique per organization. -
notification_channel.type(string, required): Delivery mechanism.webhookposts alert events as JSON;slackposts a rendered text message to a Slack incoming-webhook URL. -
notification_channel.url(string, required): Masked destination URL (scheme://host/***). The full URL — which for Slack incoming webhooks IS the credential — is write-only.
This masked value may be sent straight back on update, so a read-modify-write round-trip works unchanged: it is accepted as an echo and keeps the stored URL. It never writes anything — a masked value naming a different host is rejected with 400 rather than stored, since storing it would replace the credential with the redaction. The mask carries only the scheme and host, so it does not identify one channel: a mask read from another channel on the same host is accepted here too, and likewise changes nothing.
-
notification_channel.enabled(boolean, required): Whether new alerts are delivered to this channel. -
notification_channel.created_at(string, required): Time when the channel was created. -
notification_channel.updated_at(string, required): Time when the channel was last updated. -
400: Request body or parameters failed validation. -
error(object, required): Error details. -
error.code(string, required): Machine-readable identifier. Examples:UNAUTHENTICATED,INVALID_REQUEST,MASTER_KEY_UNSET,INTERNAL. -
error.message(string, required): Human-readable explanation; safe to surface to operators. -
401: Missing or invalid bearer. Response fields (application/json): identical toPOST /notification_channels, response 400 above. -
409: The organization already has a channel with this name. Response fields (application/json): identical toPOST /notification_channels, response 400 above.
cURL
curl -X POST '$AISIX_CP/notification_channels' -H 'Authorization: Bearer $AISIX_TOKEN'