How reads work
Reading a flag serves the configuration from memory when it was fetched within the cache window, and goes to the API otherwise — so a read is usually free, and never more than one request per window no matter how often you call it.The SDK does not poll in the background. The refresh happens on the read
that finds the cache stale, and concurrent reads on a cold cache collapse onto
a single request.
Reading values
Typed readers
Each reader checks the flag’s declared type as well as its value, so asking for a number and getting a string is impossible.T | undefined; with one it is T.
isEnabled
The shorthand for boolean flags. Defaults tofalse rather than undefined.
Raw and bulk reads
Runtimes
Reads are made on behalf of a runtime, and default toshared. A server flag is invisible to a shared read — it behaves exactly like a flag that does not exist — so a value you are about to send to a player can never be a server-only one by accident.
Configuration control
getConfig
getConfig
Returns the flag configuration, from memory when it is still within the cache window and from the API otherwise. This is what every read calls under the hood.Returns
Promise<FlagConfigPayload>
NoCloudAPIError— only if the request fails and no configuration is held yet. When one is held, it is returned instead.
refresh
refresh
Fetches the configuration from the API, ignoring the cache window. Unlike Returns
getConfig this always surfaces a failure, so it is the right call when you want to know whether the API is reachable.Promise<FlagConfigPayload>
NoCloudAPIError— if the API request fails.
getCachedConfig
getCachedConfig
Returns the configuration currently held in memory without contacting the API. Synchronous.Returns
FlagConfigPayload | null
clearCache
clearCache
Discards the cached configuration so the next read goes back to the API.The management methods (
create, update, delete) call this for you, so a read straight after a write never serves the value you just replaced.Driving your own refresh loop
pollIntervalSeconds on the payload is what the API advises. The SDK does not act on it, so use it if you want a loop of your own:
Managing flags
These methods hit the management endpoints directly and requireFLAGS_WRITE (except list, get, getQuota and getAuditLog, which need only FLAGS_READ).
list
list
Lists the organization’s flags.Parameters
- options:
ListFlagsOptions—page,limit,search,includeArchived(all optional)
Promise<FeatureFlagListResponse>— a page of flags plus your flag allowance
create
create
Creates a flag. The type and value are paired in TypeScript, so the compiler rejects a Returns
number flag holding a string.Promise<FeatureFlag>
NoCloudAPIError— including when the organization is at its flag allowance, or the key is already taken.
get
get
Fetches a single flag by its ID.Returns
To read a flag’s value by key, use
getValue and the typed readers — they
serve from the cached configuration instead of making a request per flag.Promise<FeatureFlag>
update
update
Renames, archives, or sets a flag’s value.Returns
Promise<FeatureFlag>
NoCloudAPIError— including when the flag is locked by the organization’s allowance.
delete
delete
Permanently deletes a flag.Returns
Promise<void>
getQuota
getQuota
Fetches the organization’s flag allowance.Returns
Promise<FeatureFlagQuota>—max,used,subscribed,locked
getAuditLog
getAuditLog
Fetches the flag audit log — who changed what, and when.Returns
Promise<PaginatedResult<FeatureFlagAuditEntry>>— newest first
Types
Next Steps
Feature Flags
Types, runtimes, limits and the audit log
Error Handling
Handle
NoCloudAPIError gracefullyAPI Reference
The REST endpoints behind this module

