Create a database in an environment
const url = 'https://example.com/api/environments/example/databases';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","type":"example","databaseTypeId":"example","host":"example","port":1,"databaseName":"example","username":"example","password":"example","filePath":"example","useSsl":true,"serverId":"example","backupStorageType":"local","backupLocalPath":"example","backupSpacesBucket":"example","backupSpacesPrefix":"example","backupFormat":"plain","backupCompression":"none","backupCompressionLevel":1,"pgDumpOptions":{"noOwner":true,"clean":true,"ifExists":true,"schemaOnly":true,"dataOnly":true},"pgDumpTimeoutMs":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/environments/example/databases \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "type": "example", "databaseTypeId": "example", "host": "example", "port": 1, "databaseName": "example", "username": "example", "password": "example", "filePath": "example", "useSsl": true, "serverId": "example", "backupStorageType": "local", "backupLocalPath": "example", "backupSpacesBucket": "example", "backupSpacesPrefix": "example", "backupFormat": "plain", "backupCompression": "none", "backupCompressionLevel": 1, "pgDumpOptions": { "noOwner": true, "clean": true, "ifExists": true, "schemaOnly": true, "dataOnly": true }, "pgDumpTimeoutMs": 1 }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Responses
Section titled “Responses”Bad request — malformed input or failed validation.
object
Stable, machine-readable error code. Always present on the wire.
Human-readable error message. Always present on the wire.
Field name when the error is tied to a specific input (e.g. validation).
Optional, human-friendly hint for resolving the error.
Server-assigned request ID; quote this when reporting issues.
Example
{ "code": "READONLY_FIELD", "message": "Field \"exposedPorts\" is read-only and cannot be set via PATCH.", "field": "exposedPorts", "hint": "Exposed ports are discovered from the running container. Change the ports mapping in the compose file at composePath and redeploy.", "requestId": "req_01H0…"}Unauthorized — missing or invalid bearer token.
object
Stable, machine-readable error code. Always present on the wire.
Human-readable error message. Always present on the wire.
Field name when the error is tied to a specific input (e.g. validation).
Optional, human-friendly hint for resolving the error.
Server-assigned request ID; quote this when reporting issues.
Example
{ "code": "READONLY_FIELD", "message": "Field \"exposedPorts\" is read-only and cannot be set via PATCH.", "field": "exposedPorts", "hint": "Exposed ports are discovered from the running container. Change the ports mapping in the compose file at composePath and redeploy.", "requestId": "req_01H0…"}Forbidden — token scope or role does not permit this operation.
object
Stable, machine-readable error code. Always present on the wire.
Human-readable error message. Always present on the wire.
Field name when the error is tied to a specific input (e.g. validation).
Optional, human-friendly hint for resolving the error.
Server-assigned request ID; quote this when reporting issues.
Example
{ "code": "READONLY_FIELD", "message": "Field \"exposedPorts\" is read-only and cannot be set via PATCH.", "field": "exposedPorts", "hint": "Exposed ports are discovered from the running container. Change the ports mapping in the compose file at composePath and redeploy.", "requestId": "req_01H0…"}Conflict — e.g. a unique constraint violation.
object
Stable, machine-readable error code. Always present on the wire.
Human-readable error message. Always present on the wire.
Field name when the error is tied to a specific input (e.g. validation).
Optional, human-friendly hint for resolving the error.
Server-assigned request ID; quote this when reporting issues.
Example
{ "code": "READONLY_FIELD", "message": "Field \"exposedPorts\" is read-only and cannot be set via PATCH.", "field": "exposedPorts", "hint": "Exposed ports are discovered from the running container. Change the ports mapping in the compose file at composePath and redeploy.", "requestId": "req_01H0…"}