DocsMessages & jobs
On this page

Outbound HTTP Requests

FRL v2 can contact approved outside services from rule code. Use outbound HTTP for tightly scoped workflows such as sending a notification, verifying a callback, creating a hosted upload token, or syncing a small event to a trusted service.

backend/index.frl
Rule input (JSON)

Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.

Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.

Calls finish before the next statement runs. FRL waits automatically, so write http.post(...) directly without await. An after hook also waits for its calls; it does not start a background job. Use notification.send(...) for queued notification delivery.

Helpers

HelperPurpose
http.get(url, options?)Send a GET request.
http.post(url, options?)Send a POST request.
http.put(url, options?)Send a PUT request.
http.patch(url, options?)Send a PATCH request.
http.delete(url, options?)Send a DELETE request.
http.request(method, url, options?)Send a request with a method chosen by the rule.
http.request({ method, url, ...options })Send a request from an options object.

Common options are headers, json, body, params, and timeout. When json is provided, Frontbacked sends it as JSON and sets a JSON content type if one was not already set.

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

Response Shape

HTTP helpers return a small response object:

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

data is parsed JSON when the response is JSON or looks like JSON. Otherwise, data and text are strings.

Approved Destinations

External destinations must be approved before production FRL can contact them.

When a theme version uses a literal host such as https://api.example.com/messages, Frontbacked checks that destination with the version. If the destination is not approved yet, the version waits for review before other users can install it.

Hosts coming from $secret are treated as admin-controlled dynamic hosts:

backend/index.frl
Rule input (JSON)

Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.

Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.

Dynamic hosts are still checked when the rule runs. If the resolved host is not approved, Frontbacked blocks that request. If a dynamic host is rejected, only that destination for that site/request is blocked; the whole theme version is not disabled because the value came from site data.

Site admins can also pause an individual request from their admin area. They can choose to make the request return a service error, or simulate a successful response while they investigate. Design integrations so a disabled request fails clearly and safely, and use simulated success only for responses the site admin intentionally controls.

Loop Protection

FRL v2 blocks request loops. A rule cannot call one of the same theme's endpoints through a relative path or /fb-endpoints/...; Frontbacked also blocks same-site full URLs and proxy loops.

backend/index.frl
Rule input (JSON)

Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.

Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.

Move shared logic into an FRL function instead of calling your own endpoint through HTTP.

Dynamic URL Safety

FRL v2 does not allow outbound request targets to be built from actor, request, post, payment, or other visitor-controlled data.

backend/index.frl
Rule input (JSON)

Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.

Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.

Use literal URLs for fixed services, or $secret for admin-configured services. This keeps site owners in control of where their data can be sent.

Good Practice

Keep outbound requests narrow and easy to explain. Send only the fields the service needs, put credentials in $secret, put configurable integration URLs in $secret, check $context.response.ok with must(...), and use endpoint dedupe when a repeated request could duplicate work.