curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tables": [
{
"name": "orders",
"description": "Updated: Customer purchase orders with status tracking",
"columns": [
{
"name": "status",
"description": "Order lifecycle status",
"synonyms": ["order status", "state", "order state"]
}
]
}
],
"feedback": "Updated context: All amounts in USD. Fiscal year starts April 1."
}'
{
"id": "sales-analytics"
}
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tables": [
{
"name": "orders",
"description": "Updated: Customer purchase orders with status tracking",
"columns": [
{
"name": "status",
"description": "Order lifecycle status",
"synonyms": ["order status", "state", "order state"]
}
]
}
],
"feedback": "Updated context: All amounts in USD. Fiscal year starts April 1."
}'
{
"id": "sales-analytics"
}
Update the semantic layer for a datamart by modifying table descriptions, column metadata, or feedback.
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tables": [
{
"name": "orders",
"description": "Updated: Customer purchase orders with status tracking",
"columns": [
{
"name": "status",
"description": "Order lifecycle status",
"synonyms": ["order status", "state", "order state"]
}
]
}
],
"feedback": "Updated context: All amounts in USD. Fiscal year starts April 1."
}'
{
"id": "sales-analytics"
}
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{
"datamartName": "sales-analytics",
"tables": [
{
"name": "orders",
"description": "Updated: Customer purchase orders with status tracking",
"columns": [
{
"name": "status",
"description": "Order lifecycle status",
"synonyms": ["order status", "state", "order state"]
}
]
}
],
"feedback": "Updated context: All amounts in USD. Fiscal year starts April 1."
}'
{
"id": "sales-analytics"
}
404 SEMANTIC_LAYER_NOT_FOUND. Use POST to create a semantic layer first.403 error.
To access your service token:
Authorization: Bearer dbn_live_abc123...
application/json for all requests.Content-Type: application/json
String, Long String, String (Custom), ENUM, Mapper, Range, Expression, Identifier, Number, JSON. Must be compatible with the column’s underlying datatype.String / String (Custom) / ENUM / Mapper; { lowerLimit, upperLimit } (numbers) for Range; string for Expression and JSON; null or omit for Identifier, Number, and Long String.error field in the JSON body when the request succeeds.
datamartName).| 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 |
| 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 |
Get current semantic layer
curl --request GET \
--url 'https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer?datamartName=sales-analytics' \
--header 'Authorization: Bearer dbn_live_abc123...'
Prepare your update
Update the semantic layer
curl --request PUT \
--url https://api.usedatabrain.com/api/v2/data-app/datamarts/semantic-layer \
--header 'Authorization: Bearer dbn_live_abc123...' \
--header 'Content-Type: application/json' \
--data '{ "datamartName": "sales-analytics", "feedback": "Updated context." }'