Block Templates: Combinations That Work

Most flows are variations on a handful of shapes. These tables give you the exact blocks for an API endpoint, a form, validation, a file upload and an email, with their connections: search each name in the editor and adjust the details.

For broader recipes with notes and pitfalls, see Common Blueprint Patterns.

API endpoint: trigger, work, reply

Block Purpose Connects to
on_startup_register_uri_getRegisters GET /api/v1/<uri> and fires per request. Needs a scope, or the route stays locked.On Request to the handler function
trigger_custom_functionThe handler function entry point.flow to your work blocks
httpconnection_current_requestThe live request connection object.connection to every request or response block that needs it
Work blocks (for example function_search, object_new_fields)Read and write data, build the payload.Flow chain; data pins as needed
httpconnection_set_jsonReplies with JSON to the caller.flow (end of chain), connection, code from number_default (200/400/401), data from your payload

Variants: swap the trigger for on_startup_register_uri_post (body in, for example webhooks), add a branch for validation splits, or a second httpconnection_set_json on the error path. Full walkthrough: Build Your First API.

Form handling: a web action that writes to storage

Collect input on a web page and write it to storage on submit. The form lives in the page template, not in blocks.

In the page template
<form data-action="subscribe">
  <label>Email <input name="email" type="email" required></label>
  <div data-error-for="email"></div>
  <button type="submit">Subscribe</button>
</form>
Block Purpose Connects to
web_actionRuns when the form with its name in data-action is submitted. The form out-pin is an object of the posted fields.First block of the submit flow
mutations_set_bp_field_multipleMaps form values to document fields.mutations to the create or update block
function_create_document_from_mutationsWrites the document.flow from the action, storage from a storage block
web_template with web_insert, or web_redirectAnswers the browser: a new row in place, or another page.End of the flow

Step-by-step: Build Your First CRUD App and Forms and Validation.

Data validation: reject bad input with one check per field

Keep one check per field. The user learns exactly which field failed, instead of "something was wrong". On a web page, what the browser can judge never reaches the server: required, type="email", pattern, minlength, min and max are checked before sending.

Block Purpose Connects to
condition_not_empty_valuetrue when the checked field is filled.One per required field, fed from the action's form or the request's params
branchSplits the flow on a condition into true and false paths.condition from the validation blocks
web_errors (pages) or httpconnection_set_json (API)The rejection: messages next to the form's fields, or a 400 with an error object.false path; the true path continues to the save flow

File uploads: an endpoint that receives the file

Accept files through an API and store them as cluster assets. A web action takes form fields and JSON, not files, so a page uploads through an endpoint like this one.

Block Purpose Connects to
on_startup_register_uri_fileReceives a multipart/form-data POST and saves the file. The filesize pin caps the bytes, 5 MB by default.On Request to a function with connection, params, query, body and file
Files-group blocks (search file in the block library)Read the uploaded file, its name, type and size.Fed by the function's file pin
file_from_assetsReads a file from cluster assets (/public/... or /system_assets/...).asset path from a value; out file, size, success
Asset upload API (POST /api/v1/_system/assets/stream)Stores the file into public or system_assets.Alternative to a custom flow: often enough on its own

Everything about asset paths, public vs private, and the upload APIs: Assets.

Email sending: a trigger, your data and Postmark

Send transactional email through Postmark, driven by a flow.

Block Purpose Connects to
Any trigger (web_action, storage_event, schedule_repeating_event)Decides when an email goes out.Start of the flow
Data blocks (search, get)Collect recipient and content (user profile, order, template values).Value pins into the email fields
Postmark send blocks (search postmark in the block library)Send the message via the cluster's Postmark token.To, subject and body from your data; token from the postmark_token system setting
function_console_logRecord success or failure while developing.message from the send result or error pin
Set two settings first postmark_token (secure) and email_default_from must be set. See Email configuration. For heavy or batched mail, defer to the queue instead of sending inline.

Start from a template unless the job is truly yours

Use a template shape

When the job is a known pattern: endpoint, form write, validation, upload, notify. It saves wiring and keeps conventions uniform across your cluster.

Go from scratch

When the data model or the flow is genuinely yours: unusual branching or multi-storage orchestration. Start from the closest template and prune rather than starting empty.

And extract to a function once you paste the same three blocks twice. See Blueprint Best Practices.

Next steps

Common Blueprint Patterns Recipes with notes and pitfalls: validation, auth, transformation, errors, caching. Browse All Blocks The full block library by group. Build Your First API Apply the API endpoint template end to end.