Docs Home Return to Homepage
Get Started Login

Create Database User

Last updated Changelog

On this page
http
POST /cranebase/services/{serviceId}/users

Creates a user on every host. 400 when the name is taken, 404 when database doesn’t exist.

Parameters

Field Type Required Default Description
username string Yes Name without the prefix: letters, numbers, dashes and underscores (max 60)
password string Yes Password (min 8 chars)
permissions array Yes Privileges on each database the user can reach: ALL, or any of SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX, SHOW VIEW, CREATE VIEW, CREATE TEMPORARY TABLES, CREATE ROUTINE, ALTER ROUTINE, EXECUTE, EVENT
webadmin boolean No false Allow phpMyAdmin sign-in
active boolean No true false creates the user locked
database string No Full name of a database to give the user access to right away

Response (201)

json
{ "username": "sql1042_app", "message": "User created." }

Errors

Besides the errors any endpoint can return:

Status Code When
400 operation_rejected The server behind the API (mail, database, storage) or the registrar refused the operation. error says why.
403 scope_denied This API key does not have CraneBase write access for this service.
403 service_inactive This CraneBase service is not active.
404 not_found Database not found. Service not found.
500 server_error Failed to create user.

Snagged on something?

Our sysadmins answer tickets around the clock.