on api file upload
This block is part of the http connection group and was last modified in core v15.0.0.
on api file upload v15.0.0 Exposes URI on /api/. Accepts a multipart/form-data POST request and saves the attached file. Also accepts resumable (tus 1.0.0) uploads, so a client on a flaky connection continues where it stopped instead of starting over; the function runs once, when the whole file has arrived. Supports its own rate limit and lock (serialisation) through the pins below.
- file size limit
numberthe file size limit in bytes
- rate limit
numberv15.0.0Maximum number of uploads allowed per timeframe. Leave empty for the cluster default. Must be a fixed value on this block.
- rate limit timeframe
numberv15.0.0Length of the rate-limit window in seconds.
- rate limit per
valuev15.0.0What the limit is counted per:
url,url_user,method_urlormethod_url_user. • Suggestions:urlurl_usermethod_urlmethod_url_user - lock
conditionv15.0.0Serialise this endpoint: while one upload is running, another caller with the same lock key waits (or gets a 429 when the timeout is 0).
- lock timeout
numberv15.0.0How many seconds a waiting caller may queue for the lock before it gets a 429.
0fails immediately. Clamped to 30. - lock per
valuev15.0.0What the lock is claimed per:
url,url_user,method_urlormethod_url_user. • Suggestions:urlurl_usermethod_urlmethod_url_user
- On Request
execute_function
Startup registration block, not a flow executor: registers a POST /api/{version}/{uri} endpoint that accepts multipart/form-data uploads, saves each file under the entity's temp directory and calls the On Request function with connection, params, query, body and file pins (file entries are {filename, path, type} ready for file_* blocks; JSON-looking form fields are parsed into the body). The same endpoint also takes a resumable tus 1.0.0 upload (a POST with Tus-Resumable and Upload-Length opens a session at /api/v1/_system/upload/{id}; PATCHes append; HEAD reports the offset). The function then runs once, after the last byte, with the same pins a multipart POST would give it, so the blueprint needs no change. The filesize pin caps upload bytes (default 5 MB); the rate_limit and lock pins add per-endpoint throttling and serialization and must be fixed values on the block, not wired chains. A route without any scope is LOCKED with 403 : not public; use *public to expose it. An *ip:<entry> scope admits callers by client address: a CIDR (*ip:203.0.113.0/24), an IP (*ip:203.0.113.3) or a hostname whose A/AAAA records list the allowed addresses (*ip:gateways.example.com, re-resolved hourly; a name that never resolved admits nobody).
register file |
A typical wiring for on api file upload: number feeds the filesize pin; x feeds the rate_limit pin; the function out pin wires to an execute block.
Commonly used with
In production blueprints, this block is most often wired together with:
- execute: this block feeds into it. Executes the given funcion and waits for it to be executed.
- number: feeds into this block. Generates a valid number from the filled custom value in the blueprint.
- x: feeds into this block. Multiplication operator produces the product of the operands.
Used in these guides
These documentation pages use or explain this block:
Version history
Introduced in v15.0.0.
v15.0.1: block documentation updated
Back to
http connection Return to the main group to view all sub-groups Back to api Return to the group to view all blocks within this group 