---
updatedAt: 2026-09-17T06:20:45.000Z
agentTools:
  projectIndex: https://developer.doit.com/llms.txt
---

# Import provider-native records

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.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "DoiT Cloud Intelligence",
    "description": "Programmatic access to DoiT Platform",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://api.doit.com"
    }
  ],
  "security": [
    {
      "api_key": []
    },
    {
      "tenantId": [],
      "api_key": []
    }
  ],
  "tags": [
    {
      "name": "DataHub",
      "description": "Ingest third-party cost, usage, and metric-based data for analysis."
    }
  ],
  "paths": {
    "/datahub/v1/import": {
      "post": {
        "tags": [
          "DataHub"
        ],
        "summary": "Import provider-native records",
        "description": "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.",
        "operationId": "datahubImportProviderRecords",
        "x-cli-name": "import-datahub-provider-records",
        "requestBody": {
          "required": true,
          "content": {
            "application/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": "user@example.com",
                        "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
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "OK - Ingestion succeeded.",
            "content": {
              "application/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"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/400"
          },
          "401": {
            "$ref": "#/components/responses/401"
          },
          "403": {
            "$ref": "#/components/responses/403"
          },
          "404": {
            "$ref": "#/components/responses/404"
          },
          "409": {
            "description": "Conflict - see the CSV upload endpoint; identical semantics for overlap, template mismatch and `replace`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/500"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": {
        "type": "object",
        "description": "Standard error response structure.",
        "properties": {
          "error": {
            "type": "string",
            "description": "Detailed error message."
          }
        },
        "example": {
          "error": "The request could not be completed."
        }
      }
    },
    "responses": {
      "400": {
        "description": "Bad Request - The server cannot process the request, often due to a malformed request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "401": {
        "description": "Unauthorized - Invalid API key.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "403": {
        "description": "Forbidden - The client is not authorized to perform the request.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "404": {
        "description": "Not Found - The requested resource does not exist.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "500": {
        "description": "Internal Server Error - Something went wrong with the DoiT API server.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "Authorization",
        "description": "Use the \"Bearer <API_KEY>\" format or sign in for autofill",
        "in": "header"
      },
      "tenantId": {
        "type": "apiKey",
        "name": "X-Tenant-Id",
        "description": "Customer (tenant) ID for the request. Separate from your API token: always authenticate with `Authorization: Bearer <token>` (personal or service account). See [Get Started](https://developer.doit.com/docs/start). Omit when your token is scoped to a single customer (resolved automatically). A service account can select an active direct or nested descendant of its home customer; the endpoint's normal permissions, entitlements, and resource-ownership checks still apply. A service-account target outside that customer subtree returns `403 Forbidden`. Prefer this header over the legacy `customerContext` query parameter, which only applies to legacy API keys and is ignored by personal and service account tokens.",
        "in": "header"
      }
    }
  },
  "x-samples-languages": [
    "curl",
    "go",
    "node",
    "python"
  ],
  "x-cli-config": {
    "security": "oauth2",
    "params": {
      "client_id": "cli"
    }
  }
}
```