メインコンテンツへスキップ

ingest-datahub-events

dci ingest-datahub-events [body]

Sends a batch of events to DataHub.

Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.

Examples

# Send one cost event to a dataset (`provider` is the dataset name; `time` is RFC 3339).
dci ingest-datahub-events events: [{provider: litellm-usage, time: "2026-09-01T00:00:00Z", metrics: [{type: cost, value: 42.5}]}]
# Send a batch with dimensions and your own event IDs, from a file.
dci ingest-datahub-events < events.json
# events.json
{"events": [{
"provider": "litellm-usage", "time": "2026-09-01T00:00:00Z",
"id": "2026-09-01-team-backyard",
"dimensions": [{"key": "project_id", "type": "fixed", "value": "backyard-prod"},
{"key": "team", "type": "label", "value": "backyard"}],
"metrics": [{"type": "cost", "value": 42.5}, {"type": "tokens", "value": 1250000}]
}]}
# Print the ingestion response as JSON, for a pipeline log.
dci ingest-datahub-events --output json < events.json

Request

Content-Type: application/json

FieldTypeRequiredDescription
eventsarray of object
events[].providerstringyesThe identifier of the data provider. Allowed characters: alphanumeric (0-9,a-z,A-Z), underscore (_), space, dash (-).
events[].idstringThe event id. Must be unique within the dataset. If not set, a UUIDv4 will be generated at ingestion time.
events[].dimensionsarray of object
events[].dimensions[].keystringIf the type is fixed, the key must be a valid fixed value. See the DataHub API Guide for more information.
events[].dimensions[].typestringThe dimension type. One of: "fixed", "label", "project_label", "system_label".
events[].dimensions[].valuestring or boolean
events[].timestring (date-time)yesThe timestamp of the event in RFC3339 format.
events[].metricsarray of object
events[].metrics[].valuenumber (double)The value of the metric.
events[].metrics[].typestringThe type of the metric. If you choose "cost" or "usage", it will map to the basic "Cost" or "Usage" metric in Cloud Analytics reports. You can also use this field to define custom metric types, such as "working_hours", "ride", etc.
Raw JSON schema
{
"type": "object",
"properties": {
"events": {
"type": "array",
"minItems": 1,
"maxItems": 50000,
"items": {
"type": "object",
"required": [
"provider",
"time"
],
"properties": {
"provider": {
"type": "string",
"description": "The identifier of the data provider. Allowed characters: alphanumeric (0-9,a-z,A-Z), underscore (_), space, dash (-).",
"example": "Datadog"
},
"id": {
"type": "string",
"description": "The event id. Must be unique within the dataset. If not set, a UUIDv4 will be generated at ingestion time.",
"example": "beb21d99-a8c9-4dc0-8a69-5d684cc41e6c"
},
"dimensions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string",
"example": "project_id",
"description": "If the type is `fixed`, the key must be a valid fixed value. See the [DataHub API Guide](https://developer.doit.com/docs/datahub-api) for more information."
},
"type": {
"type": "string",
"description": "The dimension type.",
"x-type": "string",
"enum": [
"fixed",
"label",
"project_label",
"system_label"
]
},
"value": {
"oneOf": [
{
"type": "string"
},
{
"type": "boolean"
}
],
"example": "production-project"
}
}
}
},
"time": {
"type": "string",
"format": "date-time",
"description": "The timestamp of the event in RFC3339 format.",
"example": "2024-03-10T23:00:00Z"
},
"metrics": {
"type": "array",
"items": {
"type": "object",
"properties": {
"value": {
"type": "number",
"format": "double",
"description": "The value of the metric.",
"example": 10.5
},
"type": {
"type": "string",
"description": "The type of the metric. If you choose \"cost\" or \"usage\", it will map to the basic \"Cost\" or \"Usage\" metric in Cloud Analytics reports. You can also use this field to define custom metric types, such as \"working_hours\", \"ride\", etc.",
"example": "cost"
}
}
}
}
}
}
}
}
}

Output

OK - Ingestion succeeded.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
messagestring
Raw JSON schema
{
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Ingestion success"
}
}
}

Errors

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: datahub-events