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/functions/collections/lookup.md.

lookup

Retrieves the value of a single key from a map, returning a fallback default if the key does not exist.

Signature

lookup(map: map, key: string, default: any) -> any

Parameters

ParameterTypeRequiredDescription
map, key, defaultmap, string, anyyesSource map, key, fallback value

Return value

Returns the documented result for the function signature.

Example

respond {
  status = 200
  body = { role = lookup(ctx.request.body, "role", "standard_user") }
}