# POST /databases

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the databases group.

Create a MariaDB database

- Who may call it: administrator, reseller, customer
- Token scope, any of: databases, all
- Answers: 201 Created

UrbeStack creates the database, records its owner, and returns the database in database. Administrators must supply user to name the customer and can choose any valid name. Customers create databases for themselves. Resellers can create databases 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 an invalid name. A valid name contains 1 to 64 ASCII letters, digits, or underscores. If the name already exists in MariaDB without a recorded owner, creation is refused. An administrator can assign that database to a customer using POST /databases/{name}/adopt.

## As a command

- [urbestack-database-add](https://urbestack.com/docs/commands/urbestack-database-add.md): Creates a MariaDB database and records the customer named by --user as its owner.

## Request body

JSON.

- `name` (DatabaseName, required): 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.
- `user` (Username): A username consists of lowercase letters, digits and underscores. For the user role, it also serves as the system account name.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X POST "$API/databases" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "alice",
    "user": "alice"
  }'
```

Response, 201 Created:

```
{
  "database": {
    "created_at": "2026-09-09T10:15:00Z",
    "id": 1,
    "measured_at": "text",
    "name": "alice",
    "size_bytes": 1,
    "user": "alice",
    "user_id": 2
  }
}
```

## Errors

- 400: --name is required
- 400: A <what> name is 1 to 64 letters, digits or underscores
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Username '<value>' is reserved
- 400: user is required: the customer the database is for
- 401: Authentication required
- 404: MariaDB has no database named <name>
- 409: Database <name> already exists
- 409: Database <name> exists in MariaDB with no record of whose it is; an administrator can adopt it: urbestack-database-adopt --name <name> --user 
- 409: The disk allowance of <user.name> is used up: 
- 409: The package <p.name> allows <limit> 
