Language examples
These examples send one request to your assigned production model. Set
HUMANBRACKET_BASE_URL and HUMANBRACKET_MODEL_SLUG to your assigned values.
Load HUMANBRACKET_WORKSPACE_KEY from your application’s secret store. Run the
code on a server or from a trusted terminal and keep the key out of browser code.
Replace the example inputs object with fields from your model’s input schema.
Here, sealed is a boolean input for a returns model. See Authenticate
and the API reference for the request envelope and response fields.
#!/usr/bin/env bashset -euo pipefail
: "${HUMANBRACKET_BASE_URL:?Set your assigned production API URL}": "${HUMANBRACKET_MODEL_SLUG:?Set your assigned model slug}": "${HUMANBRACKET_WORKSPACE_KEY:?Load your workspace key from your secret store}"
printf 'Authorization: Bearer %s\n' "$HUMANBRACKET_WORKSPACE_KEY" | curl --silent --show-error --fail-with-body --max-time 30 \ --header @- --header 'Content-Type: application/json' \ --data '{"inputs":{"sealed":true}}' \ "${HUMANBRACKET_BASE_URL%/}/v1/models/$HUMANBRACKET_MODEL_SLUG/execute"Python
Section titled “Python”import jsonimport osfrom urllib.error import HTTPErrorfrom urllib.parse import quotefrom urllib.request import Request, urlopen
base_url = os.environ["HUMANBRACKET_BASE_URL"].rstrip("/")slug = quote(os.environ["HUMANBRACKET_MODEL_SLUG"], safe="")key = os.environ["HUMANBRACKET_WORKSPACE_KEY"]
request = Request( f"{base_url}/v1/models/{slug}/execute", data=json.dumps({"inputs": {"sealed": True}}).encode(), headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"}, method="POST",)
try: with urlopen(request, timeout=30) as response: print(json.dumps(json.load(response), indent=2))except HTTPError as error: raise SystemExit(f"HumanBracket returned HTTP {error.code}: {error.read().decode()}") from NoneJavaScript
Section titled “JavaScript”Run this example with Node.js 22 or later.
const { HUMANBRACKET_BASE_URL, HUMANBRACKET_MODEL_SLUG, HUMANBRACKET_WORKSPACE_KEY } = process.env;
if (!HUMANBRACKET_BASE_URL || !HUMANBRACKET_MODEL_SLUG || !HUMANBRACKET_WORKSPACE_KEY) { throw new Error('Set the assigned API URL, model slug, and workspace key.');}
const baseUrl = HUMANBRACKET_BASE_URL.replace(/\/+$/, '');const slug = encodeURIComponent(HUMANBRACKET_MODEL_SLUG);const response = await fetch(`${baseUrl}/v1/models/${slug}/execute`, { method: 'POST', headers: { Authorization: `Bearer ${HUMANBRACKET_WORKSPACE_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ inputs: { sealed: true } }), signal: AbortSignal.timeout(30_000),});
const body = await response.text();if (!response.ok) { throw new Error(`HumanBracket returned HTTP ${response.status}: ${body}`);}console.log(JSON.stringify(JSON.parse(body), null, 2));