Database endpoints
Create user
Creates a database user that authenticates with either a password or a generated API key.
POST /v1/tenants/{tenant}/db/users
- Choose the user's accessSelect its roles and authentication method.
- Create the userSupply a password or request a generated API key.
- Store the credential securelyCapture a returned API key without exposing it.
Before you start
Use your database bearer token.
Use an identity authorized to manage access. Create the roles you will assign, and store a returned API key securely.
Path parameters
| Field | Type | Required |
|---|---|---|
tenant | string | Required |
Headers
| Field | Type | Required | Description |
|---|---|---|---|
x-oc-db-user | string | Optional | Acting database user (role, grant and row-policy checks). Send with x-oc-db-key. |
x-oc-db-key | string | Optional | API key of the x-oc-db-user user. |
Request body
application/json
Limits and accepted values
- auth is one of: password, api_key.
- password is required (non-empty) when auth is password and must use the portable character set accepted by every wire protocol.
- roles defaults to [].
- An existing username is a 400.
| Field | Type | Required |
|---|---|---|
auth | string | Required |
password | string | Optional |
roles | string[] | Optional |
Fields in roles
| Field | Type | Required |
|---|---|---|
roles | string | Optional |
| Field | Type | Required |
|---|---|---|
username | string | Required |
Read the result
For auth: api_key, capture the returned api_key securely. The assigned roles determine access. This database-user API key is not an organization-management credential or a promise that a PostgreSQL listener exists.
Response statuses
HTTP status reference
| Status | What to do |
|---|---|
| 200 | OK |
| 400 | Correct the request before retrying. |
| 401 | Check the credential and Authorization header. |
| 402 | Check feature access or available credits. |
| 403 | Check tenant access, roles and permissions. |
| 409 | Resolve the conflict before retrying. |
| 413 | Split or reduce the request body. |
| 415 | Send the required Content-Type. |
| 422 | Correct the values or unsupported combination. |
| 429 | Honor Retry-After when present; back off. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 503 | Honor Retry-After when present; check write outcomes. |