Secrets
This endpoint group provides methods for managing secrets, including listing definitions, creating, updating, deleting, and retrieving secret values. Secrets are stored encrypted and managed per project and zone.
Endpoints
POST /api/rpc (Method: SecretsRpc.getData)
Description: Retrieves a list of secret definitions (keys, zones, descriptions) for management.
Request Body:
{ "method": "SecretsRpc.getData", "params": { "filter": { "zone": "String (optional)", "key": "String (optional)", "description": "String (optional)" }, "sort": { "fieldName": "Number (-1 for desc, 1 for asc) or String ('asc'/'desc') (optional)" }, "page": "Number (optional, default: 1)", "pageSize": "Number (optional, default: 25)" } }Parameters:
Name Type Required Description filterObjectNo An object to filter the secret definitions. Can include zone,key, anddescription.filter.zoneStringNo Filter secrets by their zone. filter.keyStringNo Filter secrets by their key (case-insensitive substring match). filter.descriptionStringNo Filter secrets by their description (case-insensitive substring match). sortObjectNo An object defining the sorting order. Key is the field name, value is the order ( -1or'desc'for descending,1or'asc'for ascending).pageNumberNo The page number for pagination (must be a positive integer). Defaults to 1. pageSizeNumberNo The number of items per page for pagination (must be a positive integer). Defaults to 25. Response:
{ "success": true, "data": { "data": [ { "_id": "String", "zone": "String", "key": "String", "description": "String" } ], "totalCount": "Number" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "SecretsRpc.getData", "params": { "filter": { "zone": "production", "key": "api" }, "page": 1, "pageSize": 10 } }'
POST /api/rpc (Method: SecretsRpc.create)
Description: Creates a new secret definition and stores the encrypted value.
Request Body:
{ "method": "SecretsRpc.create", "params": { "zone": "String", "key": "String", "value": "String", "description": "String (optional)" } }Parameters:
Name Type Required Description zoneStringYes The zone where the secret will be stored (e.g., 'common', 'development', 'production'). keyStringYes The unique key for the secret within the specified zone. valueStringYes The actual secret value to be encrypted and stored. descriptionStringNo An optional description for the secret. Response:
{ "success": true, "data": { "_id": "String", "zone": "String", "key": "String", "description": "String" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "SecretsRpc.create", "params": { "zone": "development", "key": "MY_API_KEY", "value": "sk_dev_12345", "description": "API key for development environment" } }'
POST /api/rpc (Method: SecretsRpc.update)
Description: Updates a secret's value and/or description.
Request Body:
{ "method": "SecretsRpc.update", "params": { "_id": "String", "value": "String (optional)", "description": "String (optional)" } }Parameters:
Name Type Required Description _idStringYes The unique identifier of the secret to update, in the format zone:key.valueStringNo The new value for the secret. If provided, the secret's value will be updated. If omitted or empty, the value remains unchanged. descriptionStringNo The new description for the secret. If provided, the secret's description will be updated. Response:
{ "success": true, "data": { "_id": "String", "zone": "String", "key": "String", "description": "String" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "SecretsRpc.update", "params": { "_id": "development:MY_API_KEY", "value": "sk_dev_67890", "description": "Updated API key for development" } }'
POST /api/rpc (Method: SecretsRpc.delete)
Description: Deletes a secret definition and its encrypted value.
Request Body:
{ "method": "SecretsRpc.delete", "params": { "_id": "String" } }Parameters:
Name Type Required Description _idStringYes The unique identifier of the secret to delete, in the format zone:key.Response:
{ "success": true, "data": { "success": "Boolean" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "SecretsRpc.delete", "params": { "_id": "development:MY_API_KEY" } }'
POST /api/rpc (Method: SecretsRpc.getSecretValue)
Description: Retrieves the decrypted value of a specific secret. Requires admin privileges.
Request Body:
{ "method": "SecretsRpc.getSecretValue", "params": { "key": "String", "zone": "String" } }Parameters:
Name Type Required Description keyStringYes The secret key. zoneStringYes The zone to retrieve the secret from. Response:
{ "success": true, "data": { "value": "String" } }Example (cURL):
curl -X POST https://api.example.com/api/rpc \ -H "Content-Type: application/json" \ -H "X-API-Key: YOUR_API_KEY" \ -d '{ "method": "SecretsRpc.getSecretValue", "params": { "key": "MY_API_KEY", "zone": "development" } }'