Create a global rule on a gateway group
POST /apisix/admin/global_rules
POST /apisix/admin/global_rulesInteractive request editor loads with JavaScript.
In: header
Query Parameters
Gateway group ID. Optional when using the gateway group admin key to authenticate.
1 <= lengthRequest Body
application/json
The global rule description.
Response Body
application/json
application/json
curl -X POST "$API_BASE_URL/apisix/admin/global_rules?gateway_group_id=86fb9981-d9d2-4555-9df8-91ae92129335" \ -H "Content-Type: application/json" \ -d '{ "plugins": { "key-auth": {} } }'Global rule created successfully.
{
"value": {
"plugins": {
"key-auth": {}
},
"id": "key-auth",
"gateway_group_id": "bc1b95c9-b348-4832-acc3-e257d2342df1",
"created_at": 1742288232,
"updated_at": 1742288235
}
}Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
{
"value": {},
"error_msg": "error message"
}Complete operation details and schema variants
POST /apisix/admin/global_rules
Create a global rule on a gateway group
Create a global rule that applies plugin configuration to all requests in the gateway group. Use this for cross-cutting behavior such as global authentication, logging, or rate controls.
Required IAM Permission: Action gateway:CreateGlobalPluginRule, Resource arn:api7:gateway:gatewaygroup/%s
Parameters
gateway_group_id(query, string, required): Gateway group ID. Optional when using the gateway group admin key to authenticate.
Request body
Content type: application/json
plugins(object, required): Key-value pairs of plugins and their configurations on the object.
Responses
200: Global rule created successfully.- allOf variant 1
value(object, optional): The specific resource.- allOf variant 2
value(object, optional): The global rule with management fields.- allOf variant 1
value.plugins(object, required): Key-value pairs of plugins and their configurations on the object.- allOf variant 2
value.id(string, optional): Name of the plugin.value.gateway_group_id(string, optional): The gateway group ID.value.created_at(integer, optional): The object created timestamp.value.updated_at(integer, optional): The object updated timestamp.400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.value(object, optional): The specific resource.error_msg(string, optional): The error message.
cURL
curl -X POST '$API_BASE_URL/apisix/admin/global_rules'