Skip to content

Admin REST API Overview

The Sushi Gateway Admin REST API provides an internal interface for managing and configuring your API gateway. It allows administrators to create, update, delete, and retrieve information about services, routes, plugins, and more.

The Admin REST API is designed to automate gateway management tasks, making it easier to integrate with CI/CD pipelines or other external systems.

Accessing the Admin API

The Admin REST API is hosted on port 8081 and communicates over HTTP. Ensure that the API is accessible only from trusted networks or through secure tunnels (e.g., VPN or SSH).

Base URL

http://<gateway-host>:8081

Authentication

The Admin REST API is secured through Basic Authentication (RFC 7617) and JWT (RFC 7519). These methods ensure that only authorized users can access and modify gateway configurations. By design, the Admin API is not exposed publicly and is intended for internal use only.

Login Workflow

  1. Login Request: Clients authenticate via POST /login by sending a Base64-encoded username and password in the Authorization header.
  2. JWT Provision: Upon successful authentication, the API issues a JWT stored as an HttpOnly cookie.
  3. Subsequent Requests: The JWT cookie is included in requests to authenticate against the Admin API.

CRUD Operations and Configuration Modes

CRUD operations (create, read, update, delete) for the Admin API are only available when Sushi Gateway is running in stateful (DB) configuration mode. This design choice ensures that:

  • Stateful Mode: The database serves as the source of truth, enabling dynamic updates and real-time changes through the Admin API.
  • Stateless Mode: The configuration is maintained via a declarative configuration file (config.json), which acts as the source of truth. In this mode, changes must be made directly to the configuration file and cannot be managed via the Admin API.

This separation ensures consistency and prevents conflicting sources of truth across configuration modes.

INFO

For more information regarding data persistence modes, please refer to the Data Persistence section.

Endpoints

Here are the endpoints available in the Admin REST API:

MethodEndpointDescription
POST/loginLogin and authenticate via Basic Authentication.
DELETE/logoutLog out by clearing the JWT cookie.
GET/gatewayRetrieve the global gateway configuration (ProxyConfig).
GET/gateway/configRetrieve the gateway environment configuration.
GET/serviceRetrieve all services.
POST/serviceAdd a new service.
DELETE/serviceRemove a service by its name.
POST/routeAdd a route to an existing service.
DELETE/routeRemove a route by its name.
POST/pluginAdd a plugin at a global, service, or route level.
DELETE/pluginRemove a plugin at a global, service, or route level.
PUT/pluginUpdate a plugin at a global, service, or route level.

TIP

For more detailed information on available endpoints, refer to the Admin API Reference.

Released under the MIT License.