Managed services API
These routes let you inspect the catalog and operate an existing managed project, Valkey or RabbitMQ. Creation still uses the public project route with config.type_project: "valkey" (and config.profile) or "rabbitmq" and the matching plan.
Authentication and permissions
Send a session token with the organization context:
Authorization: Bearer <token>
x-organization-id: <organization-id>For automation, use an organization API Key (x-api-key: znf_... or Authorization: Bearer znf_...); in that case x-organization-id is not needed, because the organization comes from the key itself. The public catalog does not require these headers.
With a session token, the organization header selects the billing and authorization context when a user belongs to more than one organization. Keep the API key in a secret manager, never in a versioned file. For reads, treat 404 as an inaccessible or missing project without guessing IDs. For rotation, show the response only to the authorized operator, update the application secret, and discard the password from memory as soon as clients restart.
Project operations require the matching permissions for the managed_service resource. To create Key-Value, Cache, or Queue through the project route, grant managed_service.create on organization:*; to operate a specific service, use its project ID:
| Operation | Permission |
|---|---|
| Create Key-Value, Cache, or Queue | managed_service.create on organization:* |
| Read status | managed_service.status.read on managed_service:<project-id> |
| Read masked connection | managed_service.connection.read on managed_service:<project-id> |
| Rotate credentials and list linked applications | managed_service.credentials.rotate on managed_service:<project-id> |
| Turn public access on or off | managed_service.exposure.update on managed_service:<project-id> |
An owner has full access in a user session. assistant, member, and organization API Keys need the specific grant. The scopes managed_service.read, managed_service.version.update, managed_service.metrics.read, managed_service.lifecycle.update, and managed_service.delete are in the catalog but do not currently have an organization API Key route exposed.
Catalog
GET /v1/managed-services/catalogAuthentication is not required. Without an identified organization, the catalog lists only paid plans. The legacy cache-free and queue-free plans only appear when the request carries the session (or API Key) and the x-organization-id of an organization that already received the free plans; the Key-Value db-free plan appears only for organizations created before the free offer update. The catalog reports the Valkey version, the engines available for Queues (queue_engines), currency, public access modes (exposure_modes), profiles, plans, hourly/monthly/yearly prices, benefits, included storage, and public high-availability availability.
{
"status": "success",
"data": {
"engine": "valkey",
"version": "9.1.1",
"currency": "brl",
"exposure_modes": ["public", "private"],
"queue_engines": [
{ "id": "valkey", "version": "9.1.1" },
{
"id": "rabbitmq",
"version": "4.4.0",
"topology": {
"queue-basic": { "nodes": 3, "default_queue_type": "quorum" }
}
}
],
"profiles": [
{ "id": "key_value", "persistence": true },
{ "id": "cache", "persistence": false },
{ "id": "queue", "persistence": true }
],
"plans": [
{
"id": "queue-basic",
"profile": "queue",
"prices": { "hourly": 13, "monthly": 7490, "yearly": 74990 },
"features": ["1 vCPU", "1 GiB de RAM", "Alta disponibilidade com uma primária e duas réplicas"],
"included_storage_gb": 5,
"min_storage_gb": 3,
"high_availability": { "key_value": true, "cache": false, "queue": true }
}
]
}
}Reduced example. queue_engines lists the Queues engines with the version of each; for RabbitMQ, topology reports, per plan, the number of nodes (nodes) and the default queue type (default_queue_type: classic or quorum). Queues plan prices are the same for both engines. min_storage_gb is the plan's minimum storage for Key‑Value and Queues (null for Cache); creating below it returns 400 STORAGE_BELOW_PLAN_MINIMUM. high_availability shows, per profile, whether the plan has high availability. Values are BRL cents. Read the catalog at execution time; do not hardcode prices in automations.
Read status
GET /v1/managed-services/:id/statusReduced response:
{
"status": "success",
"data": {
"id": "<project-id>",
"status": "running",
"engine": "valkey",
"profile": "queue",
"version": "9.1.1",
"persistence": true,
"instances": 3,
"exposure": "public"
}
}Read the connection
GET /v1/managed-services/:id/connectionThe password cannot be recovered through this route:
{
"status": "success",
"data": {
"host": "valkey-<project-id>.managed.zenifra.com",
"port": "<port>",
"username": "default",
"tls": true,
"connection_string": "valkeys://default:********@valkey-<project-id>.managed.zenifra.com:<port>/0",
"exposure": "public"
}
}For a RabbitMQ service, the response carries engine: "rabbitmq", the app user, and an amqps:// URL, without the 0 database:
{
"status": "success",
"data": {
"engine": "rabbitmq",
"host": "rabbitmq-<project-id>.managed.zenifra.com",
"port": "<port>",
"username": "app",
"tls": true,
"connection_string": "amqps://app:********@rabbitmq-<project-id>.managed.zenifra.com:<port>/",
"exposure": "public"
}
}exposure shows whether the public host and port accept connections (public) or the service is reachable only through private connections (private). The same field appears in GET /v1/managed-services/:id/status. The host, port, and username stay the same in both states.
List linked applications
GET /v1/managed-services/:id/linked-applicationsLists the applications that use the service and the names of the environment variables that received the connection. Check it before rotating the credential to know which applications will need the new secret. The via field shows where the link comes from: template (created together in a template) or connection (internal connection). Only applications the credential can read are listed; deleted applications are not listed. Requires managed_service.credentials.rotate on the service.
{
"status": "success",
"data": {
"linked_applications": [
{ "project_id": "6650f1a2b3c4d5e6f7a8b9c0", "variable_names": ["VALKEY_URL"], "via": ["connection"] }
]
}
}Rotate the credential
Rotation is asynchronous and idempotent. First request the rotation; then follow the operation until it completes, when the new connection is returned.
1. Request the rotation
PATCH /v1/managed-services/:id/credentials
Idempotency-Key: <unique-key-of-16-to-200-characters>The Idempotency-Key header is required and accepts 16 to 200 characters (A-Z, a-z, 0-9, ., _, and -). The service must be running, with no other operation in progress. The API responds 202:
{
"status": "accepted",
"data": {
"operation_id": "<operation-id>",
"state": "accepted"
}
}Repeating the request with the same Idempotency-Key does not start another rotation: the API responds 202 with the same operation, in whatever state it is.
2. Follow the operation
GET /v1/managed-services/:id/credential-rotations/:operationIdPoll at bounded intervals until state reaches a final state. While the rotation has not finished, the response contains only operation_id, state, and credential_version. When the rotation completes (state: completed), the response includes the new connection, with the password, and you must update the application secret before discarding the previous value:
{
"status": "success",
"data": {
"operation_id": "<operation-id>",
"state": "completed",
"credential_version": 2,
"username": "default",
"host": "valkey-<project-id>.managed.zenifra.com",
"port": "<port>",
"tls": true,
"connection_string": "valkeys://default:<new-password>@valkey-<project-id>.managed.zenifra.com:<port>/0"
}
}The states are accepted, running, completed, and failed. The operation is attempted at most 5 times, within a 1-hour deadline, and always ends in completed or failed. A failed state may be followed by an automatic retry within that deadline; meanwhile, a new request receives 409. After the deadline, request a new rotation with another Idempotency-Key.
Show the response only to the authorized operator; it is sent with Cache-Control: no-store. If the query does not yet include the connection, repeat the call.
Turn public access on or off
PATCH /v1/managed-services/:id/exposureTurns public access on or off for a Valkey service (Key-Value, Cache, or Queue) or a RabbitMQ service. Requires managed_service.exposure.update on the service.
| Field | Type | Required | Description |
|---|---|---|---|
exposure | string | Yes | public to accept TLS connections on the public host and port; private so the public address stops accepting connections |
{
"exposure": "private"
}{
"status": "success",
"message": "public access updated with success",
"exposure": "private"
}With private, the service is reachable only through private connections between applications or from inside the platform. With public, it accepts connections again on the same host and the same port, and the external connection_string stays the same. Private connections and credential rotation work in both states. The service must be running; if the change cannot be completed, Zenifra keeps the previous state.
| Code | Situation |
|---|---|
400 | exposure missing or different from public and private, or invalid :id |
403 | Missing the managed_service.exposure.update permission on the service (insufficient organization permission) |
404 | Service does not exist, belongs to another organization, or is being deleted (project not found) |
409 | PROJECT_STATE_CONFLICT: the service is not running |
409 | PROJECT_OPERATION_IN_PROGRESS: another operation is in progress on the service |
422 | PROJECT_OPERATION_NOT_SUPPORTED: the service does not support this operation |
429 | Rate limit exceeded |
503 | DATABASE_EXPOSURE_UPDATE_FAILED: public access could not be updated and the previous state was kept; try again |
Common errors
| Code | Situation |
|---|---|
400 | Invalid or missing ID, parameters, or Idempotency-Key |
401 | Missing or invalid session/API Key |
403 | Insufficient organization permission (insufficient organization permission) |
404 | Managed service that does not exist or belongs to another organization (managed service not found), or rotation operation not found (credential rotation not found) |
409 | PROJECT_OPERATION_IN_PROGRESS: a rotation or another operation is already in progress |
409 | PROJECT_STATE_CONFLICT: the service is not running (for example, stopped) |
409 | The service is being deleted (managed service is being deleted) |
503 | Commercial catalog or managed service operations temporarily unavailable |
Rate limits (counted per source IP): catalog 60 per minute; status 60 per minute; connection 30 per minute; linked applications 50 per minute; rotation request 5 every 5 minutes; rotation query 60 per minute; public access change 5 every 5 minutes per service.
Next steps
Last updated on
Databases through the API
Read the state and connection of PostgreSQL, MariaDB, and ClickHouse, renew the password, update the version, control public access, and list linked apps.
Metrics and Logs
Retrieve resource metrics and native snapshots for PostgreSQL, MariaDB, Analytics, and Valkey, availability states, and project logs through the Zenifra API.