openapi: 3.1.0 info: title: kgateway Kubernetes Gateway AIBackend DirectResponse API description: kgateway is the most widely deployed gateway in Kubernetes for microservices and AI agents. It is a feature-rich, fast, and flexible Kubernetes-native ingress controller and next-generation API gateway built on top of Envoy proxy and the Kubernetes Gateway API. kgateway provides custom resource definitions (CRDs) under the gateway.kgateway.dev API group for configuring traffic policies, backends, direct responses, gateway extensions, gateway parameters, HTTP listener policies, and AI backends. These resources are managed through the Kubernetes API server. version: 2.1.0 contact: name: kgateway url: https://kgateway.dev license: name: Apache 2.0 url: https://github.com/kgateway-dev/kgateway/blob/main/LICENSE servers: - url: https://{kubernetes-api-server}/apis/gateway.kgateway.dev/v1alpha1 description: Kubernetes API Server - kgateway Custom Resources variables: kubernetes-api-server: default: kubernetes.default.svc description: The Kubernetes API server hostname security: - BearerAuth: [] tags: - name: DirectResponse description: Configure Gateways to directly respond to incoming requests with a custom HTTP response code and body without forwarding to a backend service. paths: /namespaces/{namespace}/directresponses: get: operationId: listDirectResponses summary: Kgateway List DirectResponse resources description: List all DirectResponse resources in the specified namespace. DirectResponse resources allow Gateways to directly respond to requests with custom HTTP response codes and bodies. tags: - DirectResponse parameters: - $ref: '#/components/parameters/Namespace' - $ref: '#/components/parameters/LabelSelector' - $ref: '#/components/parameters/Limit' - $ref: '#/components/parameters/Continue' responses: '200': description: Successfully retrieved list of DirectResponse resources. content: application/json: schema: $ref: '#/components/schemas/DirectResponseList' '401': description: Unauthorized post: operationId: createDirectResponse summary: Kgateway Create a DirectResponse description: Create a DirectResponse resource to configure a Gateway to directly respond to incoming requests with a custom HTTP response. tags: - DirectResponse parameters: - $ref: '#/components/parameters/Namespace' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DirectResponse' responses: '201': description: Successfully created DirectResponse. content: application/json: schema: $ref: '#/components/schemas/DirectResponse' '401': description: Unauthorized '409': description: Conflict - resource already exists /namespaces/{namespace}/directresponses/{name}: get: operationId: getDirectResponse summary: Kgateway Get a DirectResponse description: Retrieve a specific DirectResponse resource by name and namespace. tags: - DirectResponse parameters: - $ref: '#/components/parameters/Namespace' - $ref: '#/components/parameters/Name' responses: '200': description: Successfully retrieved DirectResponse. content: application/json: schema: $ref: '#/components/schemas/DirectResponse' '401': description: Unauthorized '404': description: DirectResponse not found put: operationId: replaceDirectResponse summary: Kgateway Replace a DirectResponse description: Replace a specific DirectResponse resource. tags: - DirectResponse parameters: - $ref: '#/components/parameters/Namespace' - $ref: '#/components/parameters/Name' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/DirectResponse' responses: '200': description: Successfully replaced DirectResponse. content: application/json: schema: $ref: '#/components/schemas/DirectResponse' '401': description: Unauthorized '404': description: DirectResponse not found delete: operationId: deleteDirectResponse summary: Kgateway Delete a DirectResponse description: Delete a specific DirectResponse resource. tags: - DirectResponse parameters: - $ref: '#/components/parameters/Namespace' - $ref: '#/components/parameters/Name' responses: '200': description: Successfully deleted DirectResponse. '401': description: Unauthorized '404': description: DirectResponse not found components: parameters: Name: name: name in: path required: true description: The name of the resource. schema: type: string Namespace: name: namespace in: path required: true description: The Kubernetes namespace. schema: type: string Limit: name: limit in: query required: false description: Maximum number of resources to return. schema: type: integer Continue: name: continue in: query required: false description: Continue token for paginated list requests. schema: type: string LabelSelector: name: labelSelector in: query required: false description: A selector to restrict the list of returned objects by labels. schema: type: string schemas: DirectResponse: type: object description: DirectResponse configures a Gateway to directly respond to incoming requests with a custom HTTP response code and body. properties: apiVersion: type: string enum: - gateway.kgateway.dev/v1alpha1 kind: type: string enum: - DirectResponse metadata: $ref: '#/components/schemas/ObjectMeta' spec: type: object description: DirectResponseSpec defines the desired state of a DirectResponse. properties: statusCode: type: integer description: HTTP status code to return. minimum: 200 maximum: 599 body: type: string description: Response body to return. required: - statusCode status: type: object description: Status of the DirectResponse. properties: conditions: type: array items: type: object properties: type: type: string status: type: string reason: type: string message: type: string lastTransitionTime: type: string format: date-time ObjectMeta: type: object description: Standard Kubernetes object metadata. properties: name: type: string description: Name of the resource. namespace: type: string description: Namespace of the resource. labels: type: object additionalProperties: type: string description: Map of string keys and values for organizing resources. annotations: type: object additionalProperties: type: string description: Annotations for storing arbitrary metadata. resourceVersion: type: string description: An opaque value that represents the internal version of this object. creationTimestamp: type: string format: date-time description: Timestamp representing the server time when this object was created. DirectResponseList: type: object description: List of DirectResponse resources. properties: apiVersion: type: string kind: type: string enum: - DirectResponseList metadata: type: object properties: continue: type: string resourceVersion: type: string items: type: array items: $ref: '#/components/schemas/DirectResponse' securitySchemes: BearerAuth: type: http scheme: bearer description: Kubernetes API bearer token authentication. Use a service account token or kubeconfig token. externalDocs: description: kgateway API Reference Documentation url: https://kgateway.dev/docs/envoy/latest/reference/api/