Skip to main content

/images/icons/xs_temp.svg Lambda

api.lambda {
  code = "return true;"
  timeout = 10
} as x2
ParameterPurposeExample
codeThe JavaScript or TypeScript code to be executed in the lambda function"return true;"
timeoutThe maximum execution time in seconds before the lambda times out10
asVariable to hold the return of the Lambda functionx2

Example

api.lambda {
  code = "const sum = (a, b) => a + b; return sum(5, 3);"
  timeout = 5
} as calculator

/images/icons/xs_temp.svg External API Request

api.request {
  url = "https://www.myapi.com/myApiEndpoint"
  method = "GET"
  params = {}|set:"a":1
  headers = []|array_push:"Authorization: Bearer abc123"
} as api1
ParameterPurposeExample
urlThe endpoint URL to send the request to"https://www.myapi.com/myApiEndpoint"
methodThe HTTP method to use"GET", "POST", "PUT", "DELETE"
paramsQuery parameters or body data to send with the request.`
headersArray of HTTP headers to include in the request`[]
asVariable name to reference this requestapi1

Example

api.request {
  url = "https://api.example.com/users"
  method = "POST"
  params = {}|set:"name":"John"|set:"age":30
  headers = []|array_push:"Content-Type: application/json"
} as createUser
This creates an API request that:
  • Sends a POST request to the specified URL
  • Includes query parameters or body data
  • Sets custom headers
  • Can be referenced using the alias “createUser”

/images/icons/xs_temp.svg Streaming API Request

stream.from_request {
  as = ""
  url = ""
  method = "GET"
  params = {}
  headers = []
  timeout = 10
  follow_location = true
  verify_host = false
  verify_peer = false
  ca_certificate = ""
  certificate = ""
  certificate_pass = ""
  private_key = ""
  private_key_pass = ""
} as stream1
ParameterPurposeExample
asStream identifier"data_stream", "response_stream"
urlRequest URL"https://api.example.com/stream"
methodHTTP method"GET", "POST", "PUT"
paramsRequest parameters{key: "value"}, {token: $auth.token}
headersRequest headers["Authorization: Bearer token"]
timeoutRequest timeout in seconds10, 30, 60
follow_locationFollow redirectstrue, false
verify_hostVerify SSL hosttrue, false
verify_peerVerify SSL peertrue, false
ca_certificateCA certificate for SSL"ca-cert.pem"
certificateClient certificate"client-cert.pem"
certificate_passCertificate password"certpass"
private_keyPrivate key file"private.key"
private_key_passPrivate key password"keypass"
asAlias for streamstream1, http_stream

Example

stream.from_request {
  as = "events"
  url = "https://api.service.com/stream"
  method = "GET"
  headers = [
    "Authorization: Bearer "|add:$token,
    "Accept: text/event-stream"
  ]
  timeout = 30
  follow_location = true
} as event_stream
  • Creates stream from HTTP request
  • Supports SSL/TLS configuration
  • Configurable timeout and redirects
  • Useful for consuming streaming APIs

/images/icons/xs_temp.svg Streaming API Response

api.stream {
  value = ""
}
ParameterPurposeExample
valueData to stream$stream_data, "chunk of data"

Example

api.stream {
  value = $processed_chunk
}
  • Streams data to client
  • Supports chunked transfer
  • Used in server-sent events
  • Maintains open connection

/images/icons/xs_temp.svg Realtime Event

api.realtime_event {
  channel = ""
  data = ""
  auth_table = ""
  auth_id = ""
}
ParameterPurposeExample
channelEvent channel name"notifications", "user_123"
dataEvent payload{type: "message", content: "Hello"}
auth_tableAuthorization table"users", "organizations"
auth_idAuthorized entity ID"123", $user.id

Example

api.realtime_event {
  channel = "user:"|add:$user.id
  data = {
    type: "notification",
    message: "New message received",
    timestamp: $now
  }
  auth_table = "users"
  auth_id = $user.id
}
  • Sends realtime events to clients
I