Examples: curl

Stable

Practical curl scenarios for API v2: create, describe, and read the new database autoscaler fields.

Updated: March 21, 2026

Below are several useful user scenarios for API v2.

Preparation

export CP_URL="https://<cp-host>"
export SPG99_TOKEN="<api-key>"

1. Create a tenant

curl -sS -X POST "$CP_URL/v2/tenants"       -H "Authorization: Bearer $SPG99_TOKEN"       -H "Content-Type: application/json"       -d '{"name":"acme"}'

2. Create a database inside a tenant

curl -sS -X POST "$CP_URL/v2/tenants/acme/dbs"       -H "Authorization: Bearer $SPG99_TOKEN"       -H "Content-Type: application/json"       -d '{"name":"app","size":"L1"}'

In the current managed scenario, do not pass start_immediately=true or initial_scale=1: the public Control Plane disables them.

3. Retrieve tenant credentials again

curl -sS "$CP_URL/v2/tenants/acme/credentials"       -H "Authorization: Bearer $SPG99_TOKEN"

4. Get the list of tenant databases

curl -sS "$CP_URL/v2/tenants/acme/dbs?state=ready&limit=20&offset=0"       -H "Authorization: Bearer $SPG99_TOKEN"

5. Read a database and inspect the autoscaler fields

curl -sS "$CP_URL/v2/tenants/acme/dbs/app"       -H "Authorization: Bearer $SPG99_TOKEN"

What is especially useful to look at in the response:

  • state
  • current_scale
  • target_scale
  • current_profile
  • target_profile
  • candidate_profile
  • scale_state
  • freeze_new_checkouts
  • scale_failure_reason

6. Extract the profile handoff with jq

curl -sS "$CP_URL/v2/tenants/acme/dbs/app"       -H "Authorization: Bearer $SPG99_TOKEN"       | jq '{state,current_scale,target_scale,current_profile,target_profile,scale_state,freeze_new_checkouts,scale_failure_reason}'

7. Update the account contact profile

curl -sS -X POST "$CP_URL/v2/account/contact"       -H "Authorization: Bearer $SPG99_TOKEN"       -H "Content-Type: application/json"       -d '{"email":"you@company.com","name":"Ivan Ivanov","company":"Acme"}'

8. Delete a tenant with all databases

curl -sS -X DELETE "$CP_URL/v2/tenants/acme?cascade=true"       -H "Authorization: Bearer $SPG99_TOKEN"

Deletion is asynchronous, so immediately after the call the resource may still remain in deleting.

What you should not do

Do not build the following calls into a normal user workflow:

  • POST /v2/tenants/:tenant/dbs/:db/start
  • POST /v2/tenants/:tenant/dbs/:db/stop
  • POST /v2/tenants/:tenant/dbs/:db/scale

In the current public managed contract, these operations are intentionally disabled.