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

import-datahub-provider-records

dci import-datahub-provider-records [body]

Sends provider-native records as JSON instead of a CSV file. The records use the same columns as the template's CSV (currently anthropic-spend-report@1 only) and are validated, normalized and booked on periodEnd exactly like a CSV upload. 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.

Request

Content-Type: application/json

FieldTypeRequiredDescription
providerstringyesExisting dataset (provider) name.
schemaTemplatestringyesVersioned schema template of the records.
periodStartstring (date)yes
periodEndstring (date)yes
replacebooleanSame semantics as the replace field of the CSV upload. Default: false.
recordsarray of objectyesOne object per source row; keys are the template's CSV column names. Decimals may be strings or numbers.
Raw JSON schema
{
"type": "object",
"required": [
"provider",
"schemaTemplate",
"periodStart",
"periodEnd",
"records"
],
"properties": {
"provider": {
"type": "string",
"description": "Existing dataset (provider) name.",
"example": "Anthropic Team"
},
"schemaTemplate": {
"type": "string",
"description": "Versioned schema template of the records.",
"example": "anthropic-spend-report@1"
},
"periodStart": {
"type": "string",
"format": "date",
"example": "2026-09-10"
},
"periodEnd": {
"type": "string",
"format": "date",
"example": "2026-09-10"
},
"replace": {
"type": "boolean",
"default": false,
"description": "Same semantics as the `replace` field of the CSV upload."
},
"records": {
"type": "array",
"description": "One object per source row; keys are the template's CSV column names. Decimals may be strings or numbers.",
"items": {
"type": "object",
"additionalProperties": true
},
"example": [
{
"user_email": "[email protected]",
"account_uuid": "00000000-0000-0000-0000-000000000000",
"product": "Claude Code",
"model": "claude-sonnet-4-6",
"total_requests": 1,
"total_prompt_tokens": 100,
"total_completion_tokens": 20,
"total_net_spend_usd": "1.20",
"total_gross_spend_usd": "1.50",
"total_uncached_input_tokens": 60,
"total_cache_read_tokens": 20,
"total_cache_write_5m_tokens": 10,
"total_cache_write_1h_tokens": 10,
"total_web_search_count": 0
}
]
}
}
}

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
batchstring
ingestedRowsinteger
schemaTemplatestring
sourceRecordsinteger
generatedEventsinteger
replacedBatchesarray of string
Raw JSON schema
{
"type": "object",
"properties": {
"batch": {
"type": "string",
"example": "api_1757894400000"
},
"ingestedRows": {
"type": "integer",
"example": 15
},
"schemaTemplate": {
"type": "string",
"example": "anthropic-spend-report@1"
},
"sourceRecords": {
"type": "integer",
"example": 5
},
"generatedEvents": {
"type": "integer",
"example": 15
},
"replacedBatches": {
"type": "array",
"items": {
"type": "string"
}
}
}
}

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.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.
40921RESOURCE_CONFLICTThe operation conflicts with the resource's current state.
50040API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: datahub-import-provider-records