Arguments let a button accept input. You declare them at create time with a name, type, and whether they are required or optional. At press time you supply values withDocumentation Index
Fetch the complete documentation index at: https://docs.buttons.sh/llms.txt
Use this file to discover all available pages before exploring further.
--arg.
Declaring arguments
Pass--arg once per argument during buttons create:
name:type:required or name:type:optional.
Supported types
| Type | Accepted values |
|---|---|
string | Any text |
int | Integer (e.g. 42, -7) |
bool | true or false |
VALIDATION_ERROR if the value does not match.
Passing values at press time
Use--arg key=value for each argument:
--arg:
Required vs optional
Required arguments cause aMISSING_ARG error if omitted. Optional arguments are silently absent — the button must handle their absence gracefully.
How arguments reach code buttons
For code buttons and file buttons, each argument is injected as an environment variable namedBUTTONS_ARG_<NAME> where <NAME> is the argument name uppercased:
How arguments reach HTTP buttons
For HTTP buttons, argument values are substituted into{{name}} placeholders in the URL, headers, and body. The substitution is context-aware — path segments, query parameters, JSON bodies, and form bodies each encode values differently. See URL and body templates for details.
Related
- URL and body templates —
{{arg}}substitution and encoding - Code buttons —
BUTTONS_ARG_<NAME>environment variable convention - JSON output —
MISSING_ARGandVALIDATION_ERRORerror codes