Skip to main content
curl --request PUT \
  --url https://api.usedatabrain.com/api/v2/data-app/metrics/publish \
  --header 'Authorization: Bearer dbn_live_abc123...' \
  --header 'Content-Type: application/json' \
  --data '{
    "embedId": "embed_abc123",
    "metricId": "metric_xyz789",
    "isPublished": true
  }'
{
  "id": "metric_xyz789"
}
PUT
/
api
/
v2
/
data-app
/
metrics
/
publish
curl --request PUT \
  --url https://api.usedatabrain.com/api/v2/data-app/metrics/publish \
  --header 'Authorization: Bearer dbn_live_abc123...' \
  --header 'Content-Type: application/json' \
  --data '{
    "embedId": "embed_abc123",
    "metricId": "metric_xyz789",
    "isPublished": true
  }'
{
  "id": "metric_xyz789"
}
Control the visibility of metrics within an embed by publishing or unpublishing them. Published metrics are visible to end users, while unpublished metrics remain hidden but can be published later.
This endpoint allows you to dynamically control metric visibility without deleting metrics or modifying embed configurations. Useful for staged rollouts, A/B testing, or hiding metrics temporarily.

Authentication

All API requests must include your API key in the Authorization header. Get your API token when creating a data app - see our data app creation guide for details. Finding your API token: For detailed instructions, see the API Token guide.

Headers

Authorization
string
required
Bearer token for API authentication. Use your API key from the data app.
Authorization: Bearer dbn_live_abc123...
Content-Type
string
required
Must be set to application/json for all requests.
Content-Type: application/json

Request Body

embedId
string
required
The embed configuration ID where the metric is located.
metricId
string
required
The ID of the metric to publish or unpublish.
isPublished
boolean
required
Set the publication status of the metric.
  • true: Publish the metric (make it visible to end users)
  • false: Unpublish the metric (hide it from end users)

Response

id
string
The metric ID that was successfully updated on success.
error
object
Error object returned only when the request fails. Not included in successful responses.

Examples

HTTP Status Code Summary

Status CodeDescription
200OK - Metric publication status updated
400Bad Request - Invalid request parameters
401Unauthorized - Invalid or missing API key
500Internal Server Error - Server error or invalid IDs

Possible Errors

Error CodeHTTP StatusDescription
INVALID_REQUEST_BODY400Missing or invalid parameters
INVALID_DATA_APP_API_KEY401Invalid API key
INVALID_METRIC_ID500Invalid metric or embed ID
INTERNAL_SERVER_ERROR500Server error