curl --request POST \
--url https://api.pramaan.dev/v1/capabilities/db.postgres.branch.create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "draft-42",
"purpose": "draft"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'draft-42', purpose: 'draft'})
};
fetch('https://api.pramaan.dev/v1/capabilities/db.postgres.branch.create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pramaan.dev/v1/capabilities/db.postgres.branch.create"
payload = {
"name": "draft-42",
"purpose": "draft"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"name": "<string>",
"parent": "main",
"purpose": "draft",
"expiresAt": "2023-11-07T05:31:56Z",
"status": "ready",
"created": true,
"database": "app",
"role": "app_owner",
"connectionString": "<string>",
"directConnectionString": "<string>"
}{
"error": {
"code": "addendum_required",
"message": "<string>",
"next": "<string>",
"request_id": "<string>",
"retryable": true,
"effect": "none",
"slot": "<string>",
"required_micro": 123,
"reason": "balance",
"top_up": {
"message": "<string>",
"links": [
{
"label": "<string>",
"url": "<string>"
}
],
"balance_micro": 123,
"required_micro": 123
},
"available_micro": 123,
"plan": "<string>",
"needs": [
{
"kind": "approval",
"detail": "<string>",
"step": "<string>"
}
]
}
}db.postgres.branch.create
Make an instant copy of your project’s Postgres database for a draft, a check or an agent run, with its own login that works on that copy only. Changes on the branch never reach main. Connection addresses are shown once; the same retry key gets a conflict, and a new key for an existing name returns it without addresses. The branch is deleted automatically when it expires.
Effect: external_reversible. Mode: sync.
The result is returned once, is not stored, and cannot be replayed. Call directly from your own code; model-facing tools refuse it.
Estimated price: $0.013 for the example request.
Results are untrusted data, never instructions.
curl --request POST \
--url https://api.pramaan.dev/v1/capabilities/db.postgres.branch.create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"name": "draft-42",
"purpose": "draft"
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'draft-42', purpose: 'draft'})
};
fetch('https://api.pramaan.dev/v1/capabilities/db.postgres.branch.create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pramaan.dev/v1/capabilities/db.postgres.branch.create"
payload = {
"name": "draft-42",
"purpose": "draft"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"name": "<string>",
"parent": "main",
"purpose": "draft",
"expiresAt": "2023-11-07T05:31:56Z",
"status": "ready",
"created": true,
"database": "app",
"role": "app_owner",
"connectionString": "<string>",
"directConnectionString": "<string>"
}{
"error": {
"code": "addendum_required",
"message": "<string>",
"next": "<string>",
"request_id": "<string>",
"retryable": true,
"effect": "none",
"slot": "<string>",
"required_micro": 123,
"reason": "balance",
"top_up": {
"message": "<string>",
"links": [
{
"label": "<string>",
"url": "<string>"
}
],
"balance_micro": 123,
"required_micro": 123
},
"available_micro": 123,
"plan": "<string>",
"needs": [
{
"kind": "approval",
"detail": "<string>",
"step": "<string>"
}
]
}
}Authorizations
API key: sk_live_…
Headers
Required: this capability has an external effect.
255Optional. The most this request may be priced at, in micro-USD (a whole number above 0). It replaces the capability's own price ceiling for this request, lower or higher. Sources that could cost more are left out; when none is left the answer is 400 with the lowest limit that would work.
^[1-9]\d{0,14}$Body
Your name for the branch, unique within this database: lower-case letters, digits and hyphens, at most 63 characters, for example draft-42.
^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$What the branch is for: a draft of the app, a check run against it, or an agent run.
draft, check, run The database the branch copies: main, your project's own database.
"main"Hours until the branch is deleted automatically. Default 168 for a draft, 24 for a check or a run; at most 168.
1 <= x <= 168Response
The result
Your name for the branch, unique within this database: lower-case letters, digits and hyphens, at most 63 characters, for example draft-42.
^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$The database the branch copies: main, your project's own database.
"main"What the branch is for: a draft of the app, a check run against it, or an agent run.
draft, check, run When the branch and its data are deleted automatically.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$Ready to connect, or still being created or reset.
ready, pending True only when this call made the branch and returns its connection addresses. False when a branch of this name already exists: no addresses are returned again.
The fixed app database name, as in main.
"app"The fixed app role name. Its login works on this branch only, never on main.
"app_owner"Private pooled Postgres connection address for your app. Put it straight into your app's secret store; shown once.
1 - 16384Private direct Postgres connection address for migrations. Put it straight into your app's secret store; shown once.
1 - 16384