For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/endpoints.md.

endpoint

Binds an HTTP method and path to a request schema and a pipeline.

Declaration

endpoint "GET /api/v1/accounts/{id}" {
  description = "Fetches account details by identifier"

  request {
    path {
      field "id" {
        type     = int
        required = true
      }
    }
  }

  pipeline {
    sql "find_account" {
      connection = connection.postgres.main
      query      = "SELECT id, name, tier FROM accounts WHERE id = @id"
      args       = { id = ctx.request.path.id }
    }

    respond {
      condition = steps.find_account.rows_affected == 0
      status    = 404
      body      = { error = "Account not found" }
    }

    respond {
      status = 200
      body   = steps.find_account.result
    }
  }
}

Attributes

AttributeTypeRequiredDescription
Route label ("METHOD /path")stringyesHTTP method and path pattern
descriptionstringnoUsed in logs and generated API documentation
authlistnoRoute-level authentication guards; [] marks the route public
requestblocknoValidation for path, query, headers, and body
pipelineblockyesSteps that handle the request

Supported methods: GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD.

Path templates

A single segment binds to ctx.request.path.<param>.

endpoint "GET /api/v1/organizations/{org_id}/members/{member_id}" {
  pipeline {
    respond {
      status = 200
      body = {
        org    = ctx.request.path.org_id
        member = ctx.request.path.member_id
      }
    }
  }
}

A trailing ... matches all remaining segments:

endpoint "GET /static/{filepath...}" {
  pipeline {
    respond {
      status = 200
      body   = { path = ctx.request.path.filepath }
    }
  }
}

Request validation

The request block validates path, query, headers, and body independently.

Sub-blockTargetValidates
pathctx.request.pathRoute parameter types
queryctx.request.queryQuery string and defaults
headersctx.request.headersRequired headers and formats
bodyctx.request.bodyJSON body against a schema

Authentication overrides

An endpoint inherits global authentication guards unless it opts out explicitly.

endpoint "GET /health/live" {
  description = "Bypassed by load balancers"
  auth        = []

  pipeline {
    respond {
      status = 200
      body   = { status = "healthy", timestamp = ctx.timestamp_epoch }
    }
  }
}