Database endpoints
Register a schema
Registers a new table from a TOML manifest.
POST /v1/tenants/{tenant}/schemas
- Prepare the TOML manifestDefine namespace, table, primary key and columns.
- Register the tableValidate and store its new schema.
- Keep the returned IDUse it to insert records and run queries.
Before you start
Use your database bearer token.
Choose a new table ID and prepare its TOML manifest. The example creates demo.people; an existing ID returns 409.
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
text/plain; charset=utf-8
Limits and accepted values
- A TOML table manifest;
- the Content-Type header is not checked.
- Registering an id that already exists answers 409 (class schema_already_exists).
- Honors Idempotency-Key.
| Field | Type | Required | Description |
|---|---|---|---|
Fields | string | Optional | A TOML table manifest; the Content-Type header is not checked. Registering an id that already exists answers 409 (class schema_already_exists). Honors Idempotency-Key. |
Read the result
Save the returned id for row and query requests. Registration defines the table but does not insert rows. An existing ID returns 409; use a migration to change a table already in use.
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. |
| 429 | Honor Retry-After when present; back off. |
| 500 | Check the outcome before retrying a write. |
| 501 | Check deployment support for this operation. |
| 502 | Check service availability and the write outcome. |
| 503 | Honor Retry-After when present; check write outcomes. |