Get your free beta license ↗
API operation · databases group
POST

/databases/users

First published 3 Oct 20260.1.0Unchanged since publication

Create a database user

Who may call it
AdministratorResellerCustomer
Token scope, any of
databasesall
Answers201 Created

MariaDB creates an account for localhost and another for 127.0.0.1. It also creates an account for ::1 when IPv6 loopback is available. All accounts use the supplied password and start with no grants. The response returns the created database user in user.

Administrators must supply user to name the customer and can choose any valid name. Customers create database users for themselves. Resellers can create database users for themselves or supply user to select one of their customers. For customers and resellers, name must start with the owner's username followed by an underscore, as in CUSTOMER_.

The API returns 400 for an administrator request without user or for a name outside the allowed format of 1 to 64 ASCII letters, digits, or underscores. UrbeStack refuses names already in use, including names created directly in MariaDB, and names reserved for phpMyAdmin sign-on.

As a command

Run as root on the server

Request body

JSON· 3 fields
nameDatabaseNameRequired
A database or database user name can contain up to 64 letters, digits, and underscores. For a customer, UrbeStack forms the name as <username>_<what they type> and converts it to lowercase, while an administrator specifies the full name.
passwordstring, up to 128 charactersRequired
A username consists of lowercase letters, digits and underscores. For the user role, it also serves as the system account name.

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/databases/users" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "alice",
    "password": "Sup3r-Secret-Passphrase",
    "user": "alice"
  }'
Response · 201 Created
{
  "user": {
    "created_at": "2026-09-09T10:15:00Z",
    "grants": [
      {
        "database": "alice_shop",
        "level": "full",
        "privileges": "text"
      }
    ],
    "id": 1,
    "name": "alice",
    "other_hosts": [
      "text"
    ],
    "updated_at": "text",
    "user": "alice",
    "user_id": 2
  }
}

Errors

11 errors, each a status and a sentence
400--name is required
400A <what> name is 1 to 64 letters, digits or underscores
400A name beginning with <SIGNON_PREFIX> is the panel's own: its phpMyAdmin users
400A password is required: --password-stdin or --password-hash
400Invalid password: 8 to 128 printable characters
400Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
400Username '<value>' is reserved
400user is required: the customer the database is for
401Authentication required
409Database user <name> already exists
409Database user <name> exists in MariaDB outside the panel; drop it at a shell, or name another
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.1.0 on 3 Oct 2026.
urbestack.com/docs/api/post-databases-users/