Returns only fields marked for environment-variable export in one vault, with their latest stored encrypted payloads.
GET /api/v1/machine/vault/:vaultId/environment-fieldsUse this route when a runtime is building project environment JSON and does not need every field on every vault item. The CLI and Node SDK use this endpoint when available, then decrypt the returned field values locally.
| Header | Type | Required | Description |
|---|---|---|---|
X-API-Key | string | Yes | Your API key |
| Parameter | Type | Required | Description |
|---|---|---|---|
vaultId | string | Yes | The unique identifier of the vault |
Success (200 OK)
{
"vaultId": "507f1f77bcf86cd799439011",
"fields": [
{
"id": "507f1f77bcf86cd799439034",
"name": "Password",
"type": "PASSWORD",
"order": 3,
"fieldInstanceId": "507f1f77bcf86cd799439054",
"fieldInstanceIds": ["507f1f77bcf86cd799439054"],
"assetId": null,
"assetIds": [],
"isEnvironmentVariable": true,
"value": "{\"v\":3,\"iv\":\"...\",\"t\":\"...\",\"d\":\"...\"}",
"vaultId": "507f1f77bcf86cd799439011",
"vaultItemId": "507f1f77bcf86cd799439021",
"vaultItemName": "Production Database"
}
],
"count": 1
}| Field | Type | Description |
|---|---|---|
vaultId | string | Vault that owns the returned fields |
fields | array | Environment-exportable field values |
count | number | Total number of environment fields returned |
fields[].id | string | Field ID |
fields[].name | string | Field label. This metadata is not end-to-end encrypted. |
fields[].type | string | Field type |
fields[].order | number | Field display order |
fields[].fieldInstanceId | string | null | Latest active field-instance ID used for value |
fields[].fieldInstanceIds | string[] | Full active field-instance set for the field |
fields[].assetId | string | null | Latest active attached asset ID |
fields[].assetIds | string[] | Full active asset set for the field |
fields[].isEnvironmentVariable | boolean | null | Environment-variable export flag |
fields[].value | string | null | Field value as stored. In client-encrypted vaults, this is a v3 vault envelope string |
fields[].vaultItemId | string | Parent vault item ID |
fields[].vaultItemName | string | Parent vault item name. This metadata is not end-to-end encrypted. |
This endpoint records access in two places:
VAULT_FIELD_ACCESSED with environmentOnly: trueENVIRONMENT_FIELD_READ once for each parent vault item whose environment fields were returnedFor AGENT-scoped sessions, the vault activity is attributed to the agent.
value on the runtime host.GET /api/v1/machine/vault/:vaultId/items/:itemId if you need the full signed detail checkpoint for an item.GET /api/v1/machine/vault/:vaultId/fields/:fieldId if you already know a single field ID and need only that one value.404 Not Found - Vault not found or not accessible
{
"error": {
"code": "vault_not_found",
"message": "The vault with ID \"507f1f77bcf86cd799439011\" was not found or you do not have access to it."
}
}curl -X GET "https://r4.dev/api/v1/machine/vault/507f1f77bcf86cd799439011/environment-fields" \
-H "X-API-Key: rk_abc123def456.ghijklmnopqrstuvwxyz"