Kgateway DirectResponse API

Configure Gateways to directly respond to incoming requests with a custom HTTP response code and body without forwarding to a backend service.

Operations 5

GET /namespaces/{namespace}/directresponses Kgateway List DirectResponse resources #
POST /namespaces/{namespace}/directresponses Kgateway Create a DirectResponse #
GET /namespaces/{namespace}/directresponses/{name} Kgateway Get a DirectResponse #
PUT /namespaces/{namespace}/directresponses/{name} Kgateway Replace a DirectResponse #
DELETE /namespaces/{namespace}/directresponses/{name} Kgateway Delete a DirectResponse #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/kgateway-directresponse-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

kgateway-directresponse-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: kgateway Kubernetes Gateway Direct Response API
  description: kgateway is the most widely deployed gateway in Kubernetes for microservices and AI agents.
  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:
    Namespace:
      name: namespace
      in: path
      required: true
      description: The Kubernetes namespace.
      schema:
        type: string
    Name:
      name: name
      in: path
      required: true
      description: The name of the resource.
      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
    Continue:
      name: continue
      in: query
      required: false
      description: Continue token for paginated list requests.
      schema:
        type: string
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum number of resources to return.
      schema:
        type: integer
  schemas:
    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'
    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.
    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
  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/