Update Project Plan
Changes the project to a new plan.
Required permissions
Changing the plan requires project.plan.update on project:<project-id>. owner has full access; assistant, member, and organization API Keys need this grant. If the plan change involves billing data, also use project.billing.read when automation needs to read costs.
PATCH /v1/project/:id/planRate limit: 5 requests per minute (counted per source IP).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Project ID |
Headers
| Header | Required | Description |
|---|---|---|
x-api-key or Authorization | Yes | Organization API Key or user token |
x-organization-id | With a user token | Active project organization. Not needed with an organization API key |
Content-Type: application/json | Yes | Required because the request has a JSON body |
Body
| Field | Type | Required | Description |
|---|---|---|---|
plan | string | Yes | Plan identifier |
Available Plans
| Plan | Description |
|---|---|
static | Static plan |
basic | Basic plan |
premium | Premium plan |
premium_plus | Premium plus plan |
business | Business plan |
deep_learning_basic | Basic Deep Learning (with GPU) |
deep_learning_premium | Premium Deep Learning (with GPU) |
db-starter, db-basic, db-premium, db-enterprise | Database and Key-Value plans |
cache-starter, cache-basic, cache-premium, cache-enterprise | Cache plans |
queue-starter, queue-basic, queue-premium, queue-enterprise | Queue plans (Valkey and RabbitMQ) |
job-starter, job-basic, job-premium | Scheduled Job plans |
The legacy free plans (free, db-free, cache-free, and queue-free), available only to organizations that already received the free plans, are not accepted as a destination on this route. A free (HTTP) or db-free (PostgreSQL) project can change to a paid plan of its family in any billing mode: the project becomes hourly, compute and storage billing start at the change and the free period is never billed. Paid projects do not go back to a free plan. The new plan must belong to the family of the project type: HTTP plans for applications, db-* for PostgreSQL, MariaDB, and Key-Value, cache-* for Cache, queue-* for Queue, analytics-* for Analytics, and job-* for Scheduled Jobs. Analytics projects accept analytics-* plans (analytics-sandbox, analytics-starter, analytics-production, analytics-enterprise), both upgrading and downgrading; the plan defines the instances (1 on Sandbox and Starter, 3 on Production and Enterprise). For Key-Value, Cache, and Queue (Valkey or RabbitMQ), the change requires a running project with hourly billing and is only accepted between paid plans with the same number of instances and the same billed storage; otherwise the API responds 409. As a result, Cache changes among cache-starter, cache-basic, cache-premium, and cache-enterprise; Key-Value changes among db-basic, db-premium, and db-enterprise; and Queue changes among queue-basic, queue-premium, and queue-enterprise, because db-starter and queue-starter have one instance and the other plans have three. On Key-Value and Queue, the storage must meet the new plan's minimum; on Key-Value and Queue with Valkey, moving to a smaller plan also requires the stored data to fit the new plan's memory. The effects of the change on each service are in Valkey and Queues with RabbitMQ. Scheduled Jobs change among the job-* plans of the Job catalog, and the new plan applies from the next run; see Change the plan of a Job.
Plan change rules
- Plan changes are only accepted for projects with hourly billing, or per-minute billing on Scheduled Jobs; monthly and yearly contracts keep the plan for the contracted period.
- You can leave the
freeanddb-freeplans for a paid plan, but not go back to them. Free Key-Value, Cache, and Queue services do not change plans. - The project must be running (
running) or stopped (stopped), with no other operation in progress. Key-Value, Cache, and Queue only change plans while running. - A stopped project stays stopped after the change: it keeps 0 instances, with no compute charge, and comes back with the new plan on resume.
- If the organization has pending payments, moving to a larger plan or leaving a free plan returns
402; moving to a smaller plan remains available.
Example
{
"plan": "premium"
}Response
{
"status": "success",
"message": "updated with success"
}On Analytics projects, the 200 response above means the change is done. If the change continues in the background, the response is 202:
{
"status": "accepted",
"code": "PLAN_CHANGE_IN_PROGRESS",
"message": "The plan change has started and should finish in a few minutes."
}Follow it with GET /v1/project/:id (Project information). When downgrading to a one-instance plan, Zenifra confirms the remaining instance has all the data before removing the others. Billing changes when the change completes.
Errors
| Status | Code | When it happens |
|---|---|---|
400 | — | Invalid body (for example, plan missing, free, db-free, or not in the accepted list) |
402 | ORGANIZATION_BILLING_BLOCKED | The organization has pending payments and the new plan increases spending or the project leaves a free plan |
404 | — | Project not found (including preview environments and deleted projects) or plan does not exist |
409 | PROJECT_PLAN_ALREADY_SELECTED | The project already uses the requested plan (message: "The project already uses this plan.") |
409 | PLAN_TYPE_MISMATCH | The plan does not belong to the family of the project type (message: "The selected plan is not available for this project type.") |
409 | PROJECT_STATE_CONFLICT | The project is neither running nor stopped (for example, still being created or failed) |
409 | PROJECT_OPERATION_IN_PROGRESS | The project is being resumed or deleted, or another operation is in progress |
409 | — | The paid project has a monthly or yearly contract (cant change plan with contract) |
409 | INSUFFICIENT_PLAN_CAPACITY | There is no capacity available on the new plan |
409 | CLICKHOUSE_NON_REPLICATED_DATA | On Analytics: "Some tables use an engine without replication and hold data. Move that data to replicated tables before changing to a plan with one instance." Move the data to tables with the default engine |
409 | CLICKHOUSE_REPLICAS_NOT_IN_SYNC | On Analytics: "The instances are still synchronizing data. Try the plan change again in a few minutes." Try again in a few minutes |
409 | FREE_PLAN_CHANGE_UNAVAILABLE | On Key-Value, Cache, and Queue with Valkey: the project is on a free plan (message: "Changes to or from a free plan are not available.") |
409 | PROJECT_PLAN_CHANGE_UNAVAILABLE | On Key-Value, Cache, and Queue: the project is not running or does not use hourly billing; on Valkey, also during a credential rotation |
409 | PLAN_CHANGE_REQUIRES_INSTANCE_MIGRATION | On Key-Value and Queue: the new plan has a different number of instances (for example, from queue-starter to queue-basic) |
409 | STORAGE_BELOW_PLAN_MINIMUM | On Key-Value and Queue: the storage is below the new plan's minimum. Grow the storage (Storage) before changing |
409 | PLAN_CHANGE_REQUIRES_STORAGE_SETTLEMENT | On Key-Value and Queue: the change would alter the billed storage |
409 | PLAN_CHANGE_MEMORY_ABOVE_TARGET | On Key-Value and Queue with Valkey, when moving to a smaller plan: the stored data does not fit the new plan's memory. Remove data or choose a larger plan |
409 | PLAN_CHANGE_MEMORY_UNAVAILABLE | On Key-Value and Queue with Valkey, when moving to a smaller plan: the service's memory usage could not be confirmed. Try again in a few minutes |
409 | PROJECT_PLAN_STATE_UNAVAILABLE | On Key-Value, Cache, and Queue: the service is not ready for the change |
422 | PROJECT_OPERATION_NOT_SUPPORTED | The project type does not accept plan changes |
503 | PLAN_CAPACITY_TEMPORARILY_UNAVAILABLE | Plan capacity is temporarily unavailable; try again shortly |
The bodies of PROJECT_STATE_CONFLICT, PROJECT_OPERATION_IN_PROGRESS, and ORGANIZATION_BILLING_BLOCKED are in Conflicts and billing block.
Automatic contract renewal
Turns automatic renewal on or off for a project with a monthly or annual contract.
PATCH /v1/project/:id/renew-automatic-contractOnly the organization owner can change automatic renewal. assistant, member, and organization API Keys receive 403, even with project.plan.update. Rate limit: 5 requests per minute (counted per source IP).
Body
| Field | Type | Required | Description |
|---|---|---|---|
renew_automatic_contract | boolean | Yes | true to renew automatically at the end of the contract; false to not renew |
{
"renew_automatic_contract": false
}Response
{
"status": "success",
"message": "renew automatic contract updated with success"
}Errors
| Status | When it happens |
|---|---|
400 | Invalid body, or the project uses hourly or per-minute billing, which has no contract renewal |
403 | The credential is not the organization owner (owner role required) |
404 | Project not found |
Cancel renewal
DELETE /v1/project/:id/subscriptionTurns off automatic renewal of a monthly or yearly contract: the project stays active until the end of the contracted period and the contract is not renewed. It is also restricted to the organization owner. Rate limit: 5 requests per minute (counted per source IP).
{
"status": "success",
"message": "canceled the subscription of project with success"
}| Status | When it happens |
|---|---|
403 | The credential is not the organization owner |
404 | Project not found |
409 | The project uses hourly or per-minute billing, which has no contract (cant cancell subscription of payment mode hourly) |
Examples
curl -X PATCH "https://api.zenifra.com/v1/project/507f1f77bcf86cd799439011/plan" \
-H "x-api-key: your-api-key" \
-H "x-organization-id: your-organization-id" \
-H "Content-Type: application/json" \
-d '{"plan": "premium"}'Python
import requests
API_KEY = "your-api-key"
ORGANIZATION_ID = "your-organization-id"
PROJECT_ID = "507f1f77bcf86cd799439011"
response = requests.patch(
f"https://api.zenifra.com/v1/project/{PROJECT_ID}/plan",
headers={"x-api-key": API_KEY, "x-organization-id": ORGANIZATION_ID},
json={"plan": "premium"}
)
print(response.json())Notes
- Plan change may take a few minutes to be applied
- Plan changes are only accepted for projects with hourly billing, or per-minute billing on Scheduled Jobs; billing uses the new plan price from the change onward (on Scheduled Jobs, from the next run)
- When you move to a plan without auto-scaling or health check, those features are turned off automatically
- GPU plans (
deep_learning_basic,deep_learning_premium) have their own prices; seeGET /v1/project/plans
Last updated on
Project Lifecycle
Stop and resume your project through the Zenifra API, with the effect on hourly billing, asynchronous resume, restored instance count, and common errors.
Project Instances
List and change project instance count through the Zenifra API, including rules for manual scaling, hourly plans, active autoscaling, and invalid states.