HashiCorp Consul Sessions API

Session management for distributed locking

Operations 4

PUT /session/create Create a session #
PUT /session/destroy/{sessionID} Destroy a session #
GET /session/info/{sessionID} Read a session #
GET /session/list List sessions #

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-sessions-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-sessions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: HashiCorp Consul HTTP ACL Sessions 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: Sessions
  description: Session management for distributed locking
paths:
  /session/create:
    put:
      operationId: createSession
      summary: Create a session
      tags:
      - Sessions
      parameters:
      - $ref: '#/components/parameters/dc'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                LockDelay:
                  type: string
                Name:
                  type: string
                Node:
                  type: string
                Checks:
                  type: array
                  items:
                    type: string
                Behavior:
                  type: string
                  enum:
                  - release
                  - delete
                TTL:
                  type: string
      responses:
        '200':
          description: Session created
          content:
            application/json:
              schema:
                type: object
                properties:
                  ID:
                    type: string
  /session/destroy/{sessionID}:
    put:
      operationId: destroySession
      summary: Destroy a session
      tags:
      - Sessions
      parameters:
      - name: sessionID
        in: path
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/dc'
      responses:
        '200':
          description: Session destroyed
  /session/info/{sessionID}:
    get:
      operationId: getSession
      summary: Read a session
      tags:
      - Sessions
      parameters:
      - name: sessionID
        in: path
        required: true
        schema:
          type: string
      - $ref: '#/components/parameters/dc'
      responses:
        '200':
          description: Session info
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Session'
  /session/list:
    get:
      operationId: listSessions
      summary: List sessions
      tags:
      - Sessions
      parameters:
      - $ref: '#/components/parameters/dc'
      responses:
        '200':
          description: List of sessions
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Session'
components:
  schemas:
    Session:
      type: object
      properties:
        ID:
          type: string
        Name:
          type: string
        Node:
          type: string
        LockDelay:
          type: number
        Behavior:
          type: string
        TTL:
          type: string
        Checks:
          type: array
          items:
            type: string
        CreateIndex:
          type: integer
        ModifyIndex:
          type: integer
  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