HashiCorp Consul Health API

Query health check information

OpenAPI Specification

consul-health-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: HashiCorp Consul HTTP ACL Health 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: Health
  description: Query health check information
paths:
  /health/node/{node}:
    get:
      operationId: getHealthNode
      summary: List checks for a node
      description: Returns the checks specific to the node provided.
      tags:
      - Health
      parameters:
      - name: node
        in: path
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/dc'
      - name: filter
        in: query
        schema:
          type: string
      responses:
        '200':
          description: List of health checks
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HealthCheck'
  /health/checks/{serviceName}:
    get:
      operationId: getHealthChecks
      summary: List checks for a service
      description: Returns the checks associated with the service provided.
      tags:
      - Health
      parameters:
      - name: serviceName
        in: path
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/dc'
      - name: near
        in: query
        schema:
          type: string
      - name: filter
        in: query
        schema:
          type: string
      responses:
        '200':
          description: List of health checks
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HealthCheck'
  /health/service/{serviceName}:
    get:
      operationId: getHealthService
      summary: List service instances with health
      description: Returns the service instances providing the service along with health check information.
      tags:
      - Health
      parameters:
      - name: serviceName
        in: path
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/dc'
      - name: near
        in: query
        schema:
          type: string
      - name: tag
        in: query
        schema:
          type: string
      - name: passing
        in: query
        schema:
          type: boolean
        description: Filter to only passing instances
      - name: filter
        in: query
        schema:
          type: string
      responses:
        '200':
          description: Service instances with health info
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    Node:
                      $ref: '#/components/schemas/CatalogNode'
                    Service:
                      $ref: '#/components/schemas/AgentService'
                    Checks:
                      type: array
                      items:
                        $ref: '#/components/schemas/HealthCheck'
  /health/state/{state}:
    get:
      operationId: getHealthState
      summary: List checks in a state
      description: Returns the checks in the specified state (any, passing, warning, critical).
      tags:
      - Health
      parameters:
      - name: state
        in: path
        required: true
        schema:
          type: string
          enum:
          - any
          - passing
          - warning
          - critical
      - $ref: '#/components/parameters/dc'
      - name: filter
        in: query
        schema:
          type: string
      responses:
        '200':
          description: List of health checks
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HealthCheck'
components:
  parameters:
    dc:
      name: dc
      in: query
      description: Datacenter to query (defaults to agent's datacenter)
      schema:
        type: string
  schemas:
    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
    CatalogNode:
      type: object
      properties:
        ID:
          type: string
        Node:
          type: string
        Address:
          type: string
        Datacenter:
          type: string
        TaggedAddresses:
          type: object
          additionalProperties:
            type: string
        Meta:
          type: object
          additionalProperties:
            type: string
        CreateIndex:
          type: integer
        ModifyIndex:
          type: integer
    HealthCheck:
      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
        ServiceTags:
          type: array
          items:
            type: string
        Type:
          type: string
        CreateIndex:
          type: integer
        ModifyIndex:
          type: integer
  securitySchemes:
    ConsulToken:
      type: apiKey
      name: X-Consul-Token
      in: header
      description: ACL token for authentication