To create a static key, call the Event Gateway API’s /static-keys endpoint.
curl -X POST https://{region}.api.konghq.com/v1/event-gateways/{eventGatewayId}/static-keys \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "my-key",
"value": "'$MY_KEY'"
}
'
Make sure to replace the following placeholders with your own values:
-
region: Geographic region where your Kong Konnect is hosted and operates.
-
KONNECT_TOKEN: Your Personal Access Token (PAT) associated with your Konnect account.
-
virtualClusterId: The id of the Virtual Cluster.
-
eventGatewayId: The id of the Event Gateway.
-
eventGatewayListenerId: The id of the Event Gateway Listener.
See the Konnect Event Gateway API reference to learn about region-specific URLs and personal access tokens.
The following creates a new static key called my-key.
Add this snippet to an event_gateways resource in your declarative configuration file, and then manage it with kongctl:
event_gateways:
- ref: eventGatewayName
name: eventGatewayName
static_keys:
- ref: my-key
name: my-key
value: "$MY_KEY"
Make sure to replace the following placeholders with your own values:
-
eventGatewayName: The name of your Event Gateway.
The following creates a new static key called my-key with basic configuration:
- In Konnect, navigate to Event Gateway in the sidebar.
- Click an Event Gateway.
- Click the Resources tab.
- Click Static keys
- Click New Static key.
- In the Key name field, enter
my-key.
- In the Value field, enter
$MY_KEY.
- Click Save.