palbaseDocs

Palbase Flags · API

PUT/flags/system/{key}

Define a flag

Defines a flag, or changes one (a deleted one comes back): its type, its default, the choices a string flag allows, and the conditions — first match wins — that give another value. Refused while publishing is on (templates), when it would change the type under users' values or leave a user's value outside the choices, past 200 flags, and when it would change the type or choices under the experiment running on the flag. Every reader is told (flags:<ref>).

Called by your server, with the project's secret key.

Path

keystring · requiredThe flag's key: dot-separated segments of a letter then letters, digits and underscores; 128 characters at most.

Request body

conditionsobject[] · optionalTargeting, in order, first match wins (8 at most).
descriptionstring · optionalWhat the flag is for.
valueany · requiredThe default: what every reader gets when no condition matches and they have no value of their own (8 KB at most).
value_type"bool" | "number" | "string" | "object" · requiredWhat the flag's values are.
variantsstring[] · optionalA string flag's allowed choices; every value — the default, the conditions', the users' — is one of them.
curl
curl -X PUT "https://<your-ref>.palbase.studio/flags/system/<key>" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"value":null,"value_type":"bool"}'

Responses

200The flag

400The request is malformed, or a definition or a value breaks a flag's rules (the error names which)

401No key, or not a key of this project, or a token that is not valid (the edge's answer)

403Not the project's secret key

409The project's state refuses it: publishing is on, users' values stand in the way, a managed flag's rule, a draft already exists, an experiment runs on the flag

429The project's request rate, or its flag reads for the period under its quota, are used up; Retry-After says when to try again

503The platform could not answer now; retrying is safe (Retry-After)

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation PutDefinition of flags's contract.