Databases

Create a database (optionally attaching DATABASE_URL to a project)

post/databases

Request

  • Base URL: https://hostingsurge.com/api/v1
  • URL: https://hostingsurge.com/api/v1/databases
  • Auth: one of:
    • HTTP bearer
    • API key in cookie __Host-hs_session

Query parameters

orgIdstring

Organization id (required when you belong to several)

Request body

namestring required
engine'postgresql' | 'mysql' | 'mariadb' | 'redis' | 'mongodb' required
projectIdstring uuid

connect the new database to this project: its connection string becomes a secret variable (DATABASE_URL; MongoDB: MONGODB_URI and DATABASE_URL; Redis: REDIS_URL), each only where the project has no variable of that name yet

envKeystring

with projectId: the name of the connection string variable instead (like attach)

conventionsboolean

with projectId: also every name the usual frameworks read, like attach and Vercel's integrations; a name of your own (envKey) puts them under its prefix. Names that exist already are a 409 before anything is created, unless overwrite

overwriteboolean

with projectId and envKey or conventions: replace variables of the same names

isPublicboolean
backupsboolean

daily backups at 03:00 UTC, kept 30 days (change or remove them under /databases/{id}/backups). false creates the database without a backup schedule: nothing is backed up. Ignored for Redis (no scheduled backups).

Response

Created

idstring uuid required
organizationIdstring uuid required
projectIdstring uuid nullable required
namestring required
engine'postgresql' | 'mysql' | 'mariadb' | 'redis' | 'mongodb' required
versionstring nullable required
status'provisioning' | 'running' | 'stopped' | 'error' | 'deleting' required
isPublicboolean required
internalHoststring nullable required

reachable from the organization's projects

portinteger nullable required
publicHoststring nullable required
publicPortinteger nullable required
databaseNamestring nullable required
usernamestring nullable required
passwordstring nullable required

only with databases:reveal and ?reveal=true

connectionUrlstring nullable required

masked unless revealed

backupScheduledboolean

false: the database has no backup schedule, so nothing is backed up (absent for Redis, which has no scheduled backups). PUT /databases/{id}/backups {"frequency": "0 3 * * *", "retentionDays": 30} turns on daily backups.

createdAtstring required

ISO-8601 timestamp

Changes

No recorded changes to this operation across all 1 revision of this API.