Consul API Overview
Learn about the Consul REST API, which is the primary interface to all functionality available in Consul.
The Consul HTTP API is a RESTful interface that allows you to leverage Consul functionality in your network. This topic provides guidance about the essential API endpoints for different workstreams. Refer to the HTTP API structure docs to learn how to interact with and authenticate against the Consul HTTP API.
Connect your services
Use the following API endpoints to configure and connect your services.
/catalog
: Register and deregister nodes, services, and health checks./health
: Query node health when health checks are enabled./query
: Create and manage prepared queries in Consul. Prepared queries allow you to register a complex service query and send it later./coordinate
: Query the network coordinates for nodes in the local datacenter and Consul servers in the local datacenter and remote datacenters.
The following endpoints are specific to service mesh:
/config
: Create, update, delete, and query central configuration entries registered with Consul. Configuration entries define the default behavior of resources in the service mesh./agent/connect
: Interact with local agents in the service mesh./connect
: Manage service mesh-related operations, including service intentions (/connect/intentions
) and the service mesh certificate authority (CA) (/connect/ca
).
Enable zero-trust network security
The following API endpoints give you control over access to services in your network and access to the Consul API.
/acl
: Create and manage tokens that authenticate requests and authorize access to resources in the network. We recommend enabling access control lists (ACL) to secure access to the Consul API, UI, and CLI./connect/intentions
: Create and manage service intentions.
Observe your network
Use the following API endpoints enable network observability.
/status
: Debug your Consul datacenter by returning low-level Raft information about Consul server peers./agent/metrics
: Retrieve metrics for the most recent intervals that have finished. For more information about metrics, refer to Telemetry.
Manage Consul
The following API endpoints help you manage Consul operations.
/operator
: Perform cluster-level tasks, such as interacting with the Raft subsystem or obtaining license information./partition
: Create and manage administrative or admin partitions in Consul. Admin partitions are supersets of Consul namespaces that isolate groups of resources to lower operational overhead./namespace
: Create and manage namespaces in Consul. Namespaces isolate groups of resources to lower operational overhead./snapshot
: Save and restore Consul server state in the event of a disaster./txn
: Apply multiple operations, such as updating the catalog and retrieving multiple KV entries, in a single transaction./api/hcp/v2/link/global
: Link cluster to HCP Consul Central. HCP Consul Central is a management plane service hosted by HashiCorp that enables you to monitor and manage Consul clusters.
Configure your services dynamically
The following API endpoints enable you to dynamically configure your services.
/event
: Start a custom event that you can use to build scripts and automations./kv
: Add, remove, and update metadata stored in the Consul KV store./session
: Create and manage sessions in Consul. You can use sessions to build distributed and granular locks to ensure nodes are properly writing to the Consul KV store.