HashiCorp Consul Agent API

Interact with the local Consul agent

Operations 12

GET /agent/self Read agent configuration #
GET /agent/members List cluster members #
GET /agent/services List registered services #
GET /agent/service/{serviceID} Get service configuration #
PUT /agent/service/register Register a service #
PUT /agent/service/deregister/{serviceID} Deregister a service #
GET /agent/checks List registered checks #
PUT /agent/check/register Register a check #
PUT /agent/check/deregister/{checkID} Deregister a check #
PUT /agent/join/{address} Join a cluster #
PUT /agent/leave Gracefully leave cluster #
PUT /agent/maintenance Toggle maintenance mode #

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/consul-agent-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

consul-agent-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: HashiCorp Consul HTTP ACL Agent API
  description: The Consul HTTP API provides full access to Consul functionality including service discovery, health checking, key/value storage, ACL management, Connect service mesh, configuration entries, and multi-datacenter operations.
  version: 1.18.0
  contact:
    name: HashiCorp
    url: https://www.consul.io/
  license:
    name: Business Source License 1.1
    url: https://github.com/hashicorp/consul/blob/main/LICENSE
servers:
- url: http://localhost:8500/v1
  description: Local Consul agent
- url: https://{consul_host}:{port}/v1
  description: Custom Consul server
  variables:
    consul_host:
      default: localhost
    port:
      default: '8500'
security:
- ConsulToken: []
tags:
- name: Agent
  description: Interact with the local Consul agent
paths:
  /agent/self:
    get:
      operationId: getAgentSelf
      summary: Read agent configuration
      description: Returns the configuration and member information of the local agent.
      tags:
      - Agent
      parameters:
      - $ref: '#/components/parameters/dc'
      responses:
        '200':
          description: Agent configuration and member info
          content:
            application/json:
              schema:
                type: object
                properties:
                  Config:
                    type: object
                  Member:
                    $ref: '#/components/schemas/AgentMember'
  /agent/members:
    get:
      operationId: listAgentMembers
      summary: List cluster members
      description: Returns the members the agent sees in the cluster gossip pool.
      tags:
      - Agent
      parameters:
      - name: wan
        in: query
        schema:
          type: boolean
        description: List WAN members instead of LAN
      - name: segment
        in: query
        schema:
          type: string
        description: List members in a specific segment
      - $ref: '#/components/parameters/dc'
      responses:
        '200':
          description: List of cluster members
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AgentMember'
  /agent/services:
    get:
      operationId: listAgentServices
      summary: List registered services
      description: Returns all the services registered with the local agent.
      tags:
      - Agent
      parameters:
      - name: filter
        in: query
        schema:
          type: string
        description: Filter expression
      - name: ns
        in: query
        schema:
          type: string
        description: Namespace (Enterprise only)
      responses:
        '200':
          description: Map of service ID to service definition
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/AgentService'
  /agent/service/{serviceID}:
    get:
      operationId: getAgentService
      summary: Get service configuration
      description: Returns full service definition for a single service on the local agent.
      tags:
      - Agent
      parameters:
      - name: serviceID
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Service definition
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentService'
        '404':
          description: Service not found
  /agent/service/register:
    put:
      operationId: registerAgentService
      summary: Register a service
      description: Adds a new service to the local agent with optional health checks.
      tags:
      - Agent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServiceRegistration'
      responses:
        '200':
          description: Service registered successfully
  /agent/service/deregister/{serviceID}:
    put:
      operationId: deregisterAgentService
      summary: Deregister a service
      description: Removes a service from the local agent.
      tags:
      - Agent
      parameters:
      - name: serviceID
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Service deregistered
  /agent/checks:
    get:
      operationId: listAgentChecks
      summary: List registered checks
      description: Returns all checks registered with the local agent.
      tags:
      - Agent
      responses:
        '200':
          description: Map of check ID to check definition
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/AgentCheck'
  /agent/check/register:
    put:
      operationId: registerAgentCheck
      summary: Register a check
      description: Adds a new check to the local agent.
      tags:
      - Agent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckRegistration'
      responses:
        '200':
          description: Check registered
  /agent/check/deregister/{checkID}:
    put:
      operationId: deregisterAgentCheck
      summary: Deregister a check
      tags:
      - Agent
      parameters:
      - name: checkID
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Check deregistered
  /agent/join/{address}:
    put:
      operationId: agentJoin
      summary: Join a cluster
      description: Triggers the agent to join a given address as part of the gossip pool.
      tags:
      - Agent
      parameters:
      - name: address
        in: path
        required: true
        schema:
          type: string
      - name: wan
        in: query
        schema:
          type: boolean
      responses:
        '200':
          description: Successfully joined
  /agent/leave:
    put:
      operationId: agentLeave
      summary: Gracefully leave cluster
      description: Triggers a graceful leave and shutdown of the agent.
      tags:
      - Agent
      responses:
        '200':
          description: Agent leaving
  /agent/maintenance:
    put:
      operationId: agentMaintenance
      summary: Toggle maintenance mode
      tags:
      - Agent
      parameters:
      - name: enable
        in: query
        required: true
        schema:
          type: boolean
      - name: reason
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Maintenance mode toggled
components:
  schemas:
    ServiceRegistration:
      type: object
      required:
      - Name
      properties:
        Name:
          type: string
        ID:
          type: string
        Tags:
          type: array
          items:
            type: string
        Address:
          type: string
        Port:
          type: integer
        Meta:
          type: object
          additionalProperties:
            type: string
        EnableTagOverride:
          type: boolean
        Check:
          $ref: '#/components/schemas/CheckRegistration'
        Checks:
          type: array
          items:
            $ref: '#/components/schemas/CheckRegistration'
        Weights:
          type: object
          properties:
            Passing:
              type: integer
            Warning:
              type: integer
        Kind:
          type: string
          enum:
          - ''
          - connect-proxy
          - mesh-gateway
          - terminating-gateway
          - ingress-gateway
        Proxy:
          type: object
          properties:
            DestinationServiceName:
              type: string
            DestinationServiceID:
              type: string
            LocalServiceAddress:
              type: string
            LocalServicePort:
              type: integer
            Upstreams:
              type: array
              items:
                type: object
                properties:
                  DestinationType:
                    type: string
                  DestinationName:
                    type: string
                  LocalBindPort:
                    type: integer
    AgentMember:
      type: object
      properties:
        Name:
          type: string
        Addr:
          type: string
        Port:
          type: integer
        Tags:
          type: object
          additionalProperties:
            type: string
        Status:
          type: integer
        ProtocolMin:
          type: integer
        ProtocolMax:
          type: integer
        ProtocolCur:
          type: integer
        DelegateMin:
          type: integer
        DelegateMax:
          type: integer
        DelegateCur:
          type: integer
    AgentService:
      type: object
      properties:
        ID:
          type: string
        Service:
          type: string
        Tags:
          type: array
          items:
            type: string
        Meta:
          type: object
          additionalProperties:
            type: string
        Port:
          type: integer
        Address:
          type: string
        EnableTagOverride:
          type: boolean
        Weights:
          type: object
          properties:
            Passing:
              type: integer
            Warning:
              type: integer
        Namespace:
          type: string
    CheckRegistration:
      type: object
      properties:
        Name:
          type: string
        CheckID:
          type: string
        Interval:
          type: string
        Notes:
          type: string
        DeregisterCriticalServiceAfter:
          type: string
        HTTP:
          type: string
        TCP:
          type: string
        GRPC:
          type: string
        GRPCUseTLS:
          type: boolean
        TTL:
          type: string
        ServiceID:
          type: string
        Status:
          type: string
          enum:
          - passing
          - warning
          - critical
    AgentCheck:
      type: object
      properties:
        Node:
          type: string
        CheckID:
          type: string
        Name:
          type: string
        Status:
          type: string
          enum:
          - passing
          - warning
          - critical
        Notes:
          type: string
        Output:
          type: string
        ServiceID:
          type: string
        ServiceName:
          type: string
        Type:
          type: string
  parameters:
    dc:
      name: dc
      in: query
      description: Datacenter to query (defaults to agent's datacenter)
      schema:
        type: string
  securitySchemes:
    ConsulToken:
      type: apiKey
      name: X-Consul-Token
      in: header
      description: ACL token for authentication