# POST /databases/{name}/adopt

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

UrbeStack release 0.2.35 API operation in the databases group.

Assign an unowned MariaDB database to a customer

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

Only administrators can call this operation. Set user to the customer who will own an existing MariaDB database with no recorded owner. The API returns 400 if user is missing or empty, or if name falls outside the allowed format of 1 to 64 ASCII letters, digits, or underscores.

UrbeStack adopts the database in place and returns it in database. It then lists the database and manages access, exports, and deletion under the customer's ownership. If MariaDB is installed and database.enabled is on, adoption also updates the grants for the customer's phpMyAdmin database user.

## As a command

- [urbestack-database-adopt](https://urbestack.com/docs/commands/urbestack-database-adopt.md): Assigns an existing MariaDB database with no recorded owner to the customer named by --user.

## Parameters

- `name` (path, DatabaseName, required)

## Request body

JSON.

- `user` (Username, required): 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/alice/adopt" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "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 given to
- 401: Authentication required
