Skip to main content

ingest-datahub-events-csv

dci ingest-datahub-events-csv [body]

Sends a batch of events to DataHub using a CSV file, either uncompressed or compressed in ZIP or GZ format. It may take up to 15 minutes for the data to become available in the DoiT console.

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

Before you upload

provider is the dataset name (dci list-datahub-datasets); create it first with dci create-datahub-dataset name: <dataset> if it does not exist. The CSV must follow the dataset's schema template. For the Default template the header row is usage_date[,id],<dimension>...,<metric>... with RFC 3339 UTC timestamps; see CSV ingestion. Requires the DataHub Admin permission. Rows appear in Cloud Analytics within about 15 minutes.

Undo a bad upload

There is no delete-by-batch API. Remove the rows with dci delete-datahub-events-by-filter using the time range the file covered, then upload the corrected file.

Examples

# Upload a CSV into the dataset `litellm-usage`; the `@` attaches the file and keeps its name.
dci ingest-datahub-events-csv provider: litellm-usage, file: @events.csv
batch batchId generatedEvents ingestedRows provider
csv_events.csv_1756987200000 csv_events.csv_1756987200000 15 15 litellm-usage
# Upload a compressed export. Files over 30 MB must be gzipped or zipped first (one CSV per archive).
dci ingest-datahub-events-csv provider: litellm-usage, file: @events.csv.gz
# Script-friendly result, scoped to another customer's tenant.
dci ingest-datahub-events-csv provider: litellm-usage, file: @events.csv --output json -D acme.com
{"batch": "csv_events.csv_1756987200000", "ingestedRows": 15, "generatedEvents": 15, "sourceRecords": 15, "provider": "litellm-usage", "schemaTemplate": "default@1"}

Request

Content-Type: multipart/form-data

FieldTypeRequiredDescription
providerstringThe identifier of the data provider. Allowed characters: alphanumeric (0-9,a-z,A-Z), underscore (_), space, dash (-).
filestring (binary)The CSV file to upload, either uncompressed or compressed in ZIP or GZ format. The maximum file size is 30 MB.
Raw JSON schema
{
"type": "object",
"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"
},
"file": {
"type": "string",
"format": "binary",
"description": "The CSV file to upload, either uncompressed or compressed in ZIP or GZ format. The maximum file size is 30 MB."
}
}
}

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
batchstringbatch id, generated during ingestion
ingestedRowsintegerthe number of events that have been accepted for processing
Raw JSON schema
{
"type": "object",
"properties": {
"batch": {
"type": "string",
"description": "batch id, generated during ingestion",
"example": "your_file.csv.gz_1730972725212"
},
"ingestedRows": {
"type": "integer",
"description": "the number of events that have been accepted for processing",
"example": 15
}
}
}

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-csv-file, datahub-events-csvfile