Runs examples for real against your account. Test keys only; kept in this tab, never stored on our side. Get a key
ZapSMTP / Docs / Variables

Set a global variable

PUT/v1/variables/global/{key}

Create or replace a global variable. Every template that uses it renders the new value from the next send on.

Requires a full-access live key; test keys get 403 test_key_restricted.

The response does not list the templates using the variable; GET /variables does.

Path parameters

keystringrequired
The key, used as {{global.key}}: letters, digits, _ and -, starting with a letter or _, up to 64; global is reserved. Limits: other keys → 422 invalid_parameter

Body parameters

valuestring
The value, always a string. Limits: at most 10 KB → 422 invalid_parameter Default "".
descriptionstring
What it is for. Limits: at most 500 bytes → 422 invalid_parameter

Errors

restricted_api_keyHTTP 403
test_key_restrictedHTTP 403
test-mode keys can send test email and read, not change the account: use a live key
invalid_parameterHTTP 422
bad key, value over 10 KB or description over 500 bytes
PUT/v1/variables/global/{key}
curl -X PUT 'https://zapsmtp.xyz/v1/variables/global/company_name' \
  -H "Authorization: Bearer $ZAP_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "value": "Acme Inc.",
  "description": "Legal name for footers"
}'
Set ZAP_API_KEY in your environment.
Response 200 OK
{
  "object": "variable",
  "name": "global.company_name",
  "kind": "global",
  "type": "string",
  "key": "company_name",
  "value": "Acme Inc.",
  "description": "Legal name for footers",
  "updated_at": "2026-10-27T10:30:00Z",
  "templates": []
}