Need help with your APIs? I offer API discovery, governance & evangelism services. Explore services →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

HashiCorp Consul Agent API

Interact with the local Consul agent

HashiCorp Consul Agent API is one of 14 APIs that HashiCorp Consul publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

Tagged areas include Agent. The published artifact set on APIs.io includes an OpenAPI specification, API documentation, authentication docs, and a GitHub repository.

This API exposes 12 operations across 12 paths, and defines 5 schemas. It is described by OpenAPI 3.1.0, at version 1.18.0.

Requests are made against 2 base URLs: http://localhost:8500/v1, https://{consul_host}:{port}/v1.

12 operations 12 paths 5 schemas 5 GET7 PUT

Metadata

The identity and technical contract details declared by the specification.

Specification
OpenAPI 3.1.0
API Version
1.18.0
Base URL
http://localhost:8500/v1
Authentication
API Key
Contact
Resource Areas
1

Authentication & Security 1

HashiCorp Consul Agent API declares 1 security scheme for authenticating requests. An API key is passed in the header as X-Consul-Token (ConsulToken). By default, every request must be authenticated.

  • ConsulToken — ACL token for authentication

Paths & Operations 12

Across 12 paths, the API surfaces 12 operations — 5 GET, 7 PUT. Each is listed below with its method, path, parameters, and response codes.

Agent 12

Interact with the local Consul agent

GET
/agent/self
Read agent configuration
getAgentSelf 1 param → 200
GET
/agent/members
List cluster members
listAgentMembers 3 params → 200
GET
/agent/services
List registered services
listAgentServices 2 params → 200
GET
/agent/service/{serviceID}
Get service configuration
getAgentService 1 param → 200404
PUT
/agent/service/register
Register a service
registerAgentService body → 200
PUT
/agent/service/deregister/{serviceID}
Deregister a service
deregisterAgentService 1 param → 200
GET
/agent/checks
List registered checks
listAgentChecks → 200
PUT
/agent/check/register
Register a check
registerAgentCheck body → 200
PUT
/agent/check/deregister/{checkID}
Deregister a check
deregisterAgentCheck 1 param → 200
PUT
/agent/join/{address}
Join a cluster
agentJoin 2 params → 200
PUT
/agent/leave
Gracefully leave cluster
agentLeave → 200
PUT
/agent/maintenance
Toggle maintenance mode
agentMaintenance 2 params → 200

Schemas 5

The contract defines 5 schemas that model the data the API accepts and returns. The most detailed are ServiceRegistration (12 properties), CheckRegistration (12 properties), AgentMember (11 properties), AgentCheck (9 properties). Each schema is shown below with its type and property counts.

AgentMember
object
11 properties
AgentService
object
9 properties
AgentCheck
object
9 properties
CheckRegistration
object
12 properties
ServiceRegistration
object
12 properties 1 required

Specification

The full machine-readable OpenAPI contract behind this narrative.

Source

consul-agent-api-openapi.yml Raw ↑

Other APIs HashiCorp Consul publishes across the network.

HashiCorp Consul ACL API
HashiCorp Consul Catalog API
HashiCorp Consul Config Entries API
HashiCorp Consul Connect API
HashiCorp Consul Coordinates API
HashiCorp Consul Events API
HashiCorp Consul Health API
HashiCorp Consul KV Store API
HashiCorp Consul Operator API
HashiCorp Consul Sessions API
HashiCorp Consul Snapshot API
HashiCorp Consul Status API