Validate Resource Configuration
POST /apisix/admin/schema/validate/{resource}
POST /apisix/admin/schema/validate/{resource}Interactive request editor loads with JavaScript.
Admin API key configured in config.yaml under deployment.admin.admin_key. You can also pass the key as a query parameter api_key or cookie x_api_key.
In: header
Path Parameters
Resource kind.
Value in
- "routes"
- "services"
- "upstreams"
- "consumers"
- "ssls"
- "plugin_configs"
- "global_rules"
- "stream_routes"
- "protos"
- "consumer_groups"
- "credentials"
Request Body
application/json
The resource configuration to validate. The structure depends on the resource type specified in the path parameter.
Response Body
application/json
application/json
curl -X POST "http://127.0.0.1:9180/apisix/admin/schema/validate/routes" \ -H "Content-Type: application/json" \ -d '{ "uri": "/api/v1/*", "upstream": { "scheme": "https", "type": "roundrobin", "nodes": { "httpbin.org:443": 1 } } }'Successful response.
Bad Request
{
"error_msg": "invalid configuration: property \"uri\" is required"
}{
"error_msg": "invalid request body: unexpected character at line 1 column 2"
}**Unauthorized** — The API key is missing, invalid, or lacks permission.
{
"error_msg": "failed to check token",
"description": "missing apikey"
}{
"error_msg": "failed to check token",
"description": "wrong apikey"
}{
"error_msg": "failed to check token",
"description": "invalid method for role viewer"
}Complete operation details and schema variants
POST /apisix/admin/schema/validate/{resource}
Validate Resource Configuration
Validate a resource configuration against APISIX's JSON Schema without creating the resource. Useful for dry-run validation in CI/CD pipelines.
The {resource} path parameter specifies the resource type (e.g., routes, upstreams, services, etc.).
Parameters
resource(path, string, required): Resource kind.
Request body
Content type: application/json
Responses
200: Successful response.400: Bad Request — The request body is invalid or missing required fields.error_msg(string, required): Human-readable error message describing what went wrong.401: Unauthorized — The API key is missing, invalid, or lacks permission.error_msg(string, required): Authentication error message.description(string, optional): Detailed reason for the authentication failure.
cURL
curl -X POST 'http://127.0.0.1:9180/apisix/admin/schema/validate/{resource}'