Import CSV into a Source

POST https://api.chartmogul.com/v1/data_sources/{DATA_SOURCE_UUID}/uploads

Imports data such as customers, contacts, plans, invoices, and more into a source from a CSV file.

curl -X POST \
  "https://api.chartmogul.com/v1/data_sources/ds_ade45e52-47a4-231a-1ed2-eb6b9e541213/uploads/" \
  -u "YOUR_API_KEY:" \
  -F "file=@./customers.csv;type=text/csv" \
  -F "type=customer" \
  -F "batch_name=march_2026_import"
{
  "id": 12345,
  "status": "queued",
  "created_at": "2026-03-19T10:00:00Z",
  "updated_at": "2026-03-19T10:00:00Z",
  "error_count": 0,
  "processed_count": 0
}

This endpoint uses multipart/form-data instead of a JSON request body, allowing a CSV file to be sent alongside accompanying parameters. The CSV file must be UTF-8 encoded and match the type you specify. For example, if type is customer, the file should contain customer data.

Path parameters

DATA_SOURCE_UUID string required
The ChartMogul UUID of the source where you want to upload data.

Form parameters

file file required
The path to the UTF-8-encoded CSV file to import. When using curl, append ;type=text/csv to the file path to set the MIME type explicitly.
type string required
The type of data contained in the CSV file: customer, contact, plan, invoice, line_item, transaction, subscription_event, manual_subscription_event, customer_note, or customers_contacts_enrichment. See Supported types for required column headers per type.
batch_name string optional
An optional name for the upload batch, useful for organizing and tracking imports.

Supported types

The type parameter determines which dataset you’re uploading. Each type maps to a specific data table in ChartMogul and expects a CSV with specific column headers.

The datasets you need and the order in which to upload them depend on your use case. Learn more.

For column descriptions and valid values, see the CSV formatting guide.

Sample files are available for most types to use as templates.

customer

Companies or individuals with a current, past, or potential relationship with your business. Upload customers before uploading contacts, invoices, invoice line items, transactions, subscription events, or manual subscriptions.

Column Required?
NameRequired
EmailOptional
CompanyOptional
CountryOptional
StateOptional
CityOptional
ZipOptional
External IDRequired
Lead created atOptional
Free trial started atOptional
Website URLOptional

See the full column reference for field descriptions, valid values, and formatting requirements.

contact

Individuals whose contact details you want to store in ChartMogul.

Column Required?
Customer External IDRequired
External IDOptional
First NameOptional
Last NameOptional
EmailOptional
PositionOptional
TitleOptional
PhoneOptional
LinkedInOptional
TwitterOptional
NoteOptional
Last Active AtOptional

See the full column reference for field descriptions, valid values, and formatting requirements.

plan

Products or services you offer on a subscription basis. Upload plans before uploading invoices, invoice line items, subscription events, or manual subscriptions.

Column Required?
NameRequired
Interval countRequired
Interval unitRequired
Plan IDRequired

See the full column reference for field descriptions, valid values, and formatting requirements.

invoice

Documents that record the sale of products and services to a customer and are used to collect payment. Upload invoices before uploading invoice line items or transactions.

Column Required?
Customer external IDRequired
Invoice external IDRequired
Invoiced dateRequired
Due DateOptional
CurrencyRequired
StatusOptional
Collection MethodOptional

See the full column reference for field descriptions, valid values, and formatting requirements.

line_item

Individual charges within an invoice.

Column Required?
Invoice external IDRequired
External IDOptional
Subscription external IDConditional
Subscription set external IDOptional
TypeRequired
Amount in centsRequired
PlanConditional
Service period startConditional
Service period endConditional
QuantityOptional
ProrationRequired
Proration typeOptional
Discount codeOptional
Discount amountOptional
Tax amountOptional
DescriptionOptional
Discount descriptionOptional
Transaction feeOptional
Transaction fees currencyOptional
Account CodeOptional
Event orderOptional
Balance transferOptional

Conditional columns (Subscription external ID, Plan, Service period start, Service period end) are required for line items with Type set to Subscription or Trial.

See the full column reference for field descriptions, valid values, and formatting requirements.

transaction

Payment and refund records linked to invoices.

Column Required?
Invoice external IDRequired
External IDOptional
TypeRequired
ResultRequired
DateRequired
Amount in centsOptional
Exclude tax on refundOptional
Exclude discount on refundOptional
Exclude fees on refundOptional
Transaction feeOptional
Transaction fees currencyOptional
Attached refund invoice numberOptional

See the full column reference for field descriptions, valid values, and formatting requirements.

subscription_event

Events that record changes to subscriptions, such as starts, cancellations, and updates.

Column Required?
Customer external IDRequired
Subscription external IDConditional
Subscription set external IDOptional
External IDOptional
Event TypeRequired
Retracted event IDOptional
DateRequired
Effective DateRequired
Plan external IDConditional
CurrencyConditional
Amount in CentsConditional
QuantityConditional
Event OrderOptional

Subscription external ID is not required for subscription_event_retracted. Plan external ID, Currency, Amount in Cents, and Quantity are required for start and update event types.

See the full column reference for field descriptions, valid values, and formatting requirements.

manual_subscription_event

Direct subscription records for accounts that don’t use invoice data. Learn more.

Column Required?
External IDOptional
Subscription external IDRequired
Customer external IDRequired
Plan external IDConditional
DateRequired
Effective DateRequired
Event TypeRequired
CurrencyConditional
Amount in CentsConditional
QuantityConditional
Report Cash FlowRequired

Plan external ID, Currency, Amount in Cents, and Quantity are required for manual_subscription_started and manual_subscription_updated event types.

See the full column reference for field descriptions, valid values, and formatting requirements.

customer_note

Notes and call logs attached to a customer. Learn more.

Column Required?
Customer external IDRequired
External IDOptional
KindRequired
TextOptional
Call DurationOptional
Author NameOptional
Author EmailOptional

customers_contacts_enrichment

Upload customer and contact information simultaneously. Equivalent to flexible CSV import in the app.

Column headers are matched case-insensitively against a long alias list, so you can mix whatever aliases your source CRM produces. Header matching is also whitespace-insensitive, so " Customer external ID " is treated the same as "Customer external ID". Column order doesn’t matter.

Column Required?
Customer IDRequired
OrganizationOptional
CountryOptional
ZIPOptional
CityOptional
First NameOptional
Last NameOptional
EmailOptional
PhoneOptional
Job TitleOptional
WebsiteOptional
Lead StatusOptional
NotesOptional

Response

id
The unique identifier for the upload.
status
The current status of the upload (queued, processing, completed, or failed).
created_at
The date and time when the upload was created.
updated_at
The date and time when the upload was last updated.
error_count
The number of errors encountered during processing.
processed_count
The number of records successfully processed.

Sample files

Download sample CSV files to use as templates when building your import.

Download all files as a zip:

Or download individual files: