Semantic Layer APIs
Update Semantic Layer
Update the semantic layer for a datamart by modifying table descriptions, column metadata, or feedback.
PUT
Modify the semantic layer metadata for an existing datamart. You can update table descriptions, column metadata, and feedback in a single request. Only the fields you include are updated — omitted tables and columns retain their existing values.
The datamart must already have a semantic layer. If no semantic data exists, this endpoint returns
404 SEMANTIC_LAYER_NOT_FOUND. Use POST to create a semantic layer first.Authentication
This endpoint requires a service token in the Authorization header. Data app API tokens are not permitted and will be rejected with a403 error.
To access your service token:
- Go to your Databrain dashboard and open Settings.
- Navigate to Settings.
- Find the Service Tokens section.
- Click the “Generate Token” button to generate a new service token if you don’t have one already.
Headers
Bearer token for API authentication. Use your service token.
Must be set to
application/json for all requests.Request Body
Name of the existing datamart to update. Must match exactly (case-sensitive).
Array of table objects with updated semantic metadata. Only tables and columns included in the request are modified — others remain unchanged.
Table name from the datamart. Must match an existing table.
Updated description for the table. Maximum 500 characters.
Updated synonyms for the table. Maximum 10 synonyms, each up to 100 characters. Must be unique (case-insensitive).
Updated additional context. Maximum 1000 characters.
Array of column objects to update. Only listed columns are modified.
Column name from the table. Must match an existing column.
Updated description. Maximum 500 characters.
Updated synonyms. Maximum 10 synonyms, each up to 100 characters.
Updated additional context. Maximum 1000 characters.
Updated semantic column type. Must be one of:
String, Long String, String (Custom), ENUM, Mapper, Range, Expression, Identifier, Number, JSON. Must be compatible with the column’s underlying datatype.Updated configuration for the column type. Same shapes as create: object map for
String / String (Custom) / ENUM / Mapper; { lowerLimit, upperLimit } (numbers) for Range; string for Expression and JSON; null or omit for Identifier, Number, and Long String.Updated identifier flag.
Updated indexing exclusion flag.
Updated global feedback text. Maximum 2000 characters. When provided, replaces the existing feedback.
Response
On success, the response body contains only the datamart name. There is noerror field in the JSON body when the request succeeds.
The name of the updated datamart (same as the input
datamartName).Examples
HTTP Status Code Summary
| Status Code | Description |
|---|---|
200 | OK — Semantic layer updated successfully |
400 | Bad Request — Validation failed (see error codes below) |
401 | Unauthorized — Invalid or missing API token |
403 | Forbidden — Data app token used instead of service token |
404 | Not Found — No semantic layer exists for this datamart |
500 | Internal Server Error — Server error occurred |
Possible Errors
| Error Code | HTTP Status | Description |
|---|---|---|
INVALID_REQUEST_BODY | 400 | Missing required fields or validation failure |
INVALID_DATAMART | 400 | Datamart not found |
INVALID_TABLE | 400 | Table name doesn’t exist in the datamart |
INVALID_COLUMN | 400 | Column name doesn’t exist in the table |
INVALID_COLUMN_TYPE | 400 | Column type incompatible with the column’s datatype |
INVALID_COLUMN_TYPE_CONFIG | 400 | Column type config has wrong shape |
DUPLICATE_SYNONYM | 400 | Duplicate synonyms detected (case-insensitive) |
SEMANTIC_LAYER_NOT_FOUND | 404 | No semantic layer exists — use POST to create first |
AUTHENTICATION_ERROR | 403 | Data app token used instead of service token |
INTERNAL_SERVER_ERROR | 500 | Server error |
Quick Start Guide
Get current semantic layer
Retrieve the existing semantic layer before making changes:
Save this response in case you need to rollback your changes.
Prepare your update
Determine what you want to update:
- Tables/Columns: Include only the tables and columns you want to change
- Feedback: Provide the new text (replaces existing)
Next Steps
Get Semantic Layer
Retrieve and verify your changes
Create Semantic Layer
Create a semantic layer for a new datamart
Delete Semantic Layer
Remove semantic layer metadata entirely
Semantic Layer Guide
Configure the semantic layer in the Databrain UI

