🔌 Consumer API
All consumer endpoints require X-Api-Key: <key>. The key is scoped to a single application — it can only access that application’s own secrets and configurations, plus any global values the application inherits.
The header takes either the application’s API key (grm_…), which reads every environment, or an access token (grm_tok_…), which reads only the environments and kinds of data it was created for:
| Token scope | Endpoints |
|---|---|
secrets |
/consumer/secrets… |
configurations |
/consumer/configurations… |
feature-flags |
/consumer/feature-flags… |
An export needs every scope it includes: secrets and configurations by default, or only configurations with include=configurations.
A token used for another environment or scope gets 403 (and the attempt is audited as access-token.denied); a revoked or expired token gets 401.
GitHub OIDC exchange
1
POST /consumer/oidc/github
Needs no X-Api-Key: the body carries a GitHub Actions OIDC token, which is validated (GitHub’s signature, issuer, the configured audience, expiry) and matched against the application’s trust policies.
1
{ "application": "my-app", "token": "<GitHub OIDC JWT>" }
Response 200:
1
2
3
4
5
6
7
{
"token": "grm_tok_…",
"expiresAt": "2026-11-23T16:45:00+00:00",
"environments": ["staging"],
"scopes": ["secrets"],
"policy": "deploy main"
}
Use token in X-Api-Key until it expires. Any failure (invalid token, unknown application, no matching policy) is a plain 401, audited as access-token.oidc-exchange by github:<owner/repo> (or anonymous when the token itself is invalid). See Authentication for a workflow example.
Table of contents
Secrets
List secrets
1
GET /consumer/secrets?environment={envSlug}
Lists the secrets the application can read in the environment (its own and inherited global secrets) with the active version’s metadata. Values are never returned; use Get secret or Export for those.
Response 200:
1
2
3
4
5
6
7
{
"items": [
{ "name": "smtp-host", "source": "application", "active": true, "version": 3, "expiresOn": null },
{ "name": "old-key", "source": "application", "active": false, "version": null, "expiresOn": null },
{ "name": "shared-id", "source": "global", "active": true, "version": 1, "expiresOn": "2027-01-01T00:00:00+00:00" }
]
}
active is false when no version is active right now (never set, disabled, expired or not yet valid); version and expiresOn are then null. Listing is audited as secret.list and sent with Cache-Control: no-store.
Response 404: Environment not found.
Get secret
1
GET /consumer/secrets/{name}?environment={envSlug}
Returns the latest active version of the named secret in the given environment.
A version is active when:
IsEnabled = trueNotBefore IS NULL OR NotBefore <= nowExpiresAt IS NULL OR ExpiresAt >= now
Headers:
1
X-Api-Key: grm_your_api_key_here
Query parameters:
| Parameter | Required | Description |
|---|---|---|
environment |
âś… | Environment slug (e.g. local, production) |
Response 200:
1
2
3
4
5
6
7
8
9
10
11
12
{
"name": "database-password",
"value": "super-secret-db-pass",
"properties": {
"enabled": true,
"expiresOn": null,
"notBefore": null,
"version": 2,
"createdOn": "2025-01-01T00:00:00Z",
"updatedOn": null
}
}
The response shape matches Azure Key Vault secret responses to allow transparent migration.
Response 404: Returned when:
- The secret name does not exist (neither on the application nor, for applications that inherit globals, as a global secret)
- The environment does not exist
- No active version exists for this secret/environment combination (disabled, expired, or not yet active)
A 404 on a version-level issue (disabled/expired) is intentional — the consumer should treat a missing active version as “secret unavailable” rather than exposing version state.
Configurations
Get all configurations
1
GET /consumer/configurations?environment={envSlug}
Returns all configuration entries for the current application in the given environment, merged with any inherited global entries (application values win on the same key).
Response 200:
1
2
3
4
5
6
7
{
"items": [
{ "key": "Feature:DarkMode", "value": "true", "label": "local", "valueType": "string" },
{ "key": "MaxRetries", "value": "3", "label": "local", "valueType": "string" },
{ "key": "AllowedIps", "value": "[\"10.0.0.1\",\"10.0.0.2\"]", "label": "local", "valueType": "array" }
]
}
The label field contains the environment slug. This matches the Azure App Configuration response shape.
The sentinel keys Sentinel and Global:Sentinel are left out of this list. Read them by key (below).
Conditional requests: the response has an ETag. Send it back as If-None-Match to get 304 Not Modified (no body) while nothing changed.
valueType is string, multiline, array (a JSON array of strings) or json (a JSON object or array). value is always a string; for array and json it holds the JSON text, so parse it when valueType says so. Clients written before value types existed ignore the field and keep working.
Response 404: Environment not found.
Get configuration by key
1
GET /consumer/configurations/{key}?environment={envSlug}
Returns a single configuration entry, falling back to an inherited global entry when the application doesn’t define the key.
Response 200:
1
2
3
4
5
6
{
"key": "Feature:DarkMode",
"value": "true",
"label": "local",
"valueType": "string"
}
Response 404: Key or environment not found.
Also sends an ETag and supports If-None-Match → 304. Clients poll the sentinel keys this way to know when to reload:
| Key | Changes when |
|---|---|
Sentinel |
This application’s configuration or secrets in the environment are published (on every change while auto-publish is on) |
Global:Sentinel |
Global configuration or secrets are published. 404 if the application doesn’t inherit globals |
See the refresh spec.
Feature flags
Flag definitions for local evaluation: the API never evaluates for you and never sees your users’ attributes. Evaluate with the evaluation spec.
Get all feature flags
1
GET /consumer/feature-flags?environment=production
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"environment": "production",
"flags": [
{
"key": "checkout-redesign",
"type": "multivariate",
"variants": [ { "key": "control", "value": { "layout": "classic" } }, { "key": "treatment", "value": { "layout": "one-page" } } ],
"defaultVariant": "control",
"salt": "9f2c4e1a7b3d5f60",
"enabled": true,
"offVariant": "control",
"rules": [ { "conditions": [ { "attribute": "userId", "operator": "in", "values": ["u-123"] } ], "serve": { "variant": "treatment" } } ],
"fallthrough": { "rollout": [ { "variant": "control", "weight": 80 }, { "variant": "treatment", "weight": 20 } ], "bucketBy": "userId" },
"version": 4,
"source": "application"
}
]
}
A flag never configured in the environment comes back disabled with version 0.
Global flags are included when the application inherits globals, unless the application has a flag with the same key. They come with "source": "global" (application flags: "application"), and their state is the one for this environment’s slug, else the global * state. GET /consumer/feature-flags/{key} falls back to a global flag the same way.
Caching: responses carry a strong ETag. Send it back in If-None-Match and the answer is 304 Not Modified with no body until a flag changes. Polling clients should always do this. A 304 still counts as consumer activity.
Get feature flag by key
1
GET /consumer/feature-flags/{key}?environment=production
One definition, same shape and ETag behaviour. 404: unknown flag or environment.
Export
1
GET /consumer/export?environment={envSlug}&format=json|env|dotnet&include=secrets,configurations&prefix=
Everything the application can read in one environment, in one call: for the GitHub Action, non-.NET clients, the CLI, or writing a .env file. Values are the effective (merged) ones, so globals apply exactly as in single reads.
Query parameters:
| Parameter | Required | Description |
|---|---|---|
environment |
âś… | Environment slug |
format |
 | json (default), env or dotnet |
include |
 | secrets, configurations or both, comma-separated (default both) |
prefix |
 | Only keys and secret names starting with this, ignoring case |
format=json (application/json):
1
2
3
4
5
{
"secrets": { "smtp-host": "mail.example.com" },
"configurations": { "Feature:DarkMode": "true", "MaxRetries": "3" },
"skipped": ["old-key"]
}
Secrets with no active version are left out and named in skipped.
format=env (text/plain), one line per value, sorted:
1
2
3
FEATURE__DARKMODE='true'
MAXRETRIES='3'
SMTP_HOST='mail.example.com'
- Names are upper-cased;
:becomes__(as .NET reads environment variables) and any other character that isn’t a letter, digit or_becomes_(db-host→DB_HOST). A name starting with a digit gets a leading_. - Values are single-quoted, which dotenv readers take literally. A value containing
'or a line break is double-quoted instead, with\,",$and line breaks escaped.
format=dotnet (application/json): a flat object keyed as IConfiguration reads it:
1
{ "Feature:DarkMode": "true", "MaxRetries": "3", "smtp-host": "mail.example.com" }
In env and dotnet, a secret and a configuration entry that end up with the same name produce one value: the secret’s.
Every export is sent with Cache-Control: no-store and audited as export.read (target is the format; values are never recorded). Exported secrets count as reads for the secret’s last-read time.
Polling: a configuration-only export (include=configurations) carries an ETag; send it back in If-None-Match to get 304 Not Modified when nothing changed. Exports that include secrets have no ETag.
Response 400: Unknown format or include.
Response 404: Environment not found.
Using colon-delimited keys
Configuration keys support colon (:) delimiters, which map directly to the .NET IConfiguration key hierarchy:
| Grimoire key | IConfiguration access |
|---|---|
Feature:DarkMode |
config["Feature:DarkMode"] |
Database:Host |
config["Database:Host"] or config.GetSection("Database")["Host"] |
MaxRetries |
config["MaxRetries"] |
This allows using IOptions<T> and GetSection() just as you would with appsettings.json.
Global secrets and configuration
Administrators can define global configuration and secrets once for all applications. Consumers don’t need to change anything: the same endpoints, API key and response shapes return the merged result, so existing clients (including Grimoire.Consumer) keep working.
For applications with inheritGlobals: true (the default), values resolve in this order, highest first:
- The application’s own value for the environment
- A global value for the environment’s slug (e.g.
production) - A global value for
*(all environments)
Applications with inheritGlobals: false only see their own values.
Secret fallback rule: a global secret is returned only when the application has no secret with that name. If the application defines the secret but has no active version for the environment (disabled, expired, not yet valid, or never set), the response is 404. An explicit application-level disable is never silently replaced by a global value.
The label of a configuration item is always the requested environment slug, whether the value came from the application or a global entry.
Error scenarios
| Scenario | Status |
|---|---|
Missing X-Api-Key header |
401 |
| Invalid API key or access token | 401 |
| Revoked or expired access token | 401 |
| Access token used for an environment or scope it doesn’t cover | 403 |
| Secret does not exist | 404 |
| Environment does not exist | 404 |
| Secret exists but no active version | 404 |
| Application secret has no active version, but a global secret with the same name does | 404 (no fallback) |
| Secret version is disabled | 404 |
| Secret version is expired | 404 |
Secret version is not yet active (NotBefore) |
404 |
Grimoire deliberately returns 404 (not 410 Gone or a status-specific code) for expired/disabled versions to avoid leaking information about the secret’s lifecycle state.