Examples

HTTP Enrichment

Breyta HTTP enrichment example for fetching external API data inside a flow step.

Quick Answer

Bind an HTTP connection in :requires, call it via flow/step :http, and return normalized payload fields.
Keep normalization in top-level :functions, not inline in orchestration, and label branch logic with metadata.

Use Case

Fetch external data and return transformed output.

Full Definition

{:slug :http-enrichment
 :name "HTTP Enrichment"
 :concurrency {:type :singleton :on-new-version :supersede}
 :requires [{:slot :public-api
             :type :http-api
             :label "Public API"
             :base-url "https://jsonplaceholder.typicode.com"
             :auth {:type :none}}]
 :functions [{:id :normalize-user
              :language :clojure
              :code "(fn [input] {:lookup-user-id (:user-id input) :user (:user input)})"}]
 :triggers [{:type :manual :label "Run" :enabled true :config {}}]
 :flow
 '(let [input (flow/input)
        user-id ^{:label "Resolve user id"
                  :yes "Use provided user-id"
                  :no "Fallback to default user"}
                (if (:user-id input) (:user-id input) 1)
        user (flow/step :http :fetch-user
               {:connection :public-api
                :path (str "/users/" user-id)})
        normalized (flow/step :function :normalize-response
                     {:ref :normalize-user
                      :input {:user-id user-id
                              :user user}})]
    normalized)}

Run It

breyta flows push --file ./tmp/flows/http-enrichment.clj
breyta flows validate http-enrichment
breyta flows run http-enrichment --wait --input '{"user-id":2}'

Expected Output

Returned payload includes external user data under :user.

Failure Modes

  • missing/incorrect connection binding
  • upstream API errors or timeouts
  • transform output in a :function step when shaping logic grows or is reused across steps

Try Next

As of Feb 16, 2026