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/encoding/base64_encode.md.

base64_encode

Encodes a string using standard RFC 4648 Base64 encoding.

Signature

base64_encode(str: string) -> string

Parameters

ParameterTypeRequiredDescription
strstringyesThe plain text string to encode

Return value

Returns the documented result for the function signature.

Example

respond {
  status = 200
  body = {
    basic_token = base64_encode("${ctx.request.body.user}:${ctx.request.body.pass}")
  }
}