Skip to main content

Import CSV data

POST 

/api/v1/import

The import endpoint executes the actual data import. Call this after /api/v1/preimport has returned the file hash, available fields, and column headers.

Using the data from the preimport response, construct a column_map that tells the system how each CSV column maps to a system field. The import runs asynchronously — you will receive an email notification once it completes.

Request body

  • hash — The unique file reference returned by /api/v1/preimport.
  • import_type — The source format (e.g. csv, freshbooks, invoice2go, invoicely).
  • skip_header — Set to true to skip the first row of the CSV (the header row).
  • column_map — An object keyed by entity type (e.g. invoice, client). Each entity contains:
    • mapping — An object where each key is the CSV column index (as a string) and each value is the target system field from the available array, or an empty string "" to skip that column.

Available mapping fields

Each mapping value uses the format entity.property. The tables below list every available field per entity type.

Data Matching:

Client Matching:

Matching a record to a client is performed by using the clients email address (first) or the clients (exact) name. If no match is found, a new client is created.

Multi line item invoice/quote/credits/recurring invoice Matching:

If you need to import multiple line items into an invoice (other other entity) you will want to assign the same (unique) invoice number to each row in the csv file, the system will group together lines where the invoice number is the same and create line items for each row.

Invoice fields (files[invoice])

FieldDescription
invoice.numberInvoice number
invoice.user_idAssigned user
invoice.amountInvoice amount
invoice.balanceOutstanding balance
invoice.discountDiscount value
invoice.po_numberPurchase order number
invoice.dateInvoice date
invoice.due_dateDue date
invoice.termsInvoice terms
invoice.statusInvoice status
invoice.public_notesPublic notes (visible to client)
invoice.is_sentWhether the invoice has been sent
invoice.private_notesPrivate notes (internal only)
invoice.uses_inclusive_taxesWhether tax amounts are inclusive
invoice.tax_name1Tax name (tier 1)
invoice.tax_rate1Tax rate (tier 1)
invoice.tax_name2Tax name (tier 2)
invoice.tax_rate2Tax rate (tier 2)
invoice.tax_name3Tax name (tier 3)
invoice.tax_rate3Tax rate (tier 3)
invoice.is_amount_discountWhether discount is a fixed amount
invoice.footerInvoice footer
invoice.partialPartial/deposit amount
invoice.partial_due_datePartial payment due date
invoice.custom_value1Custom field 1
invoice.custom_value2Custom field 2
invoice.custom_value3Custom field 3
invoice.custom_value4Custom field 4
invoice.custom_surcharge1Custom surcharge 1
invoice.custom_surcharge2Custom surcharge 2
invoice.custom_surcharge3Custom surcharge 3
invoice.custom_surcharge4Custom surcharge 4
invoice.exchange_rateCurrency exchange rate
client.nameClient name
client.emailClient email
payment.datePayment date
payment.amountPayment amount
payment.transaction_referencePayment transaction reference
item.quantityLine item quantity
item.costLine item unit cost
item.product_keyLine item product key
item.notesLine item description
item.discountLine item discount
item.is_amount_discountWhether line item discount is a fixed amount
item.tax_name1Line item tax name (tier 1)
item.tax_rate1Line item tax rate (tier 1)
item.tax_name2Line item tax name (tier 2)
item.tax_rate2Line item tax rate (tier 2)
item.tax_name3Line item tax name (tier 3)
item.tax_rate3Line item tax rate (tier 3)
item.custom_value1Line item custom field 1
item.custom_value2Line item custom field 2
item.custom_value3Line item custom field 3
item.custom_value4Line item custom field 4
item.type_idLine item type

Client fields (files[client])

FieldDescription
client.nameClient name
client.user_idAssigned user
client.balanceAccount balance
client.paid_to_dateTotal paid to date
client.currency_idCurrency
client.websiteWebsite URL
client.private_notesPrivate notes
client.industry_idIndustry
client.size_idCompany size
client.address1Address line 1
client.address2Address line 2
client.cityCity
client.stateState/province
client.postal_codePostal code
client.country_idCountry
client.custom_value1Custom field 1
client.custom_value2Custom field 2
client.custom_value3Custom field 3
client.custom_value4Custom field 4
client.shipping_address1Shipping address line 1
client.shipping_address2Shipping address line 2
client.shipping_cityShipping city
client.shipping_stateShipping state/province
client.shipping_postal_codeShipping postal code
client.shipping_country_idShipping country
client.payment_termsDefault payment terms
client.vat_numberVAT/tax number
client.id_numberID number
client.public_notesPublic notes
client.phonePhone number
contact.first_nameContact first name
contact.last_nameContact last name
contact.emailContact email
contact.phoneContact phone
contact.custom_value1Contact custom field 1
contact.custom_value2Contact custom field 2
contact.custom_value3Contact custom field 3
contact.custom_value4Contact custom field 4

Product fields (files[product])

FieldDescription
product.product_keyProduct key/name
product.notesProduct description
product.costProduct cost
product.priceProduct price
product.quantityDefault quantity
product.tax_name1Tax name (tier 1)
product.tax_rate1Tax rate (tier 1)
product.tax_name2Tax name (tier 2)
product.tax_rate2Tax rate (tier 2)
product.tax_name3Tax name (tier 3)
product.tax_rate3Tax rate (tier 3)
product.custom_value1Custom field 1
product.custom_value2Custom field 2
product.custom_value3Custom field 3
product.custom_value4Custom field 4
product.image_urlProduct image URL
product.in_stock_quantityIn-stock quantity
product.tax_categoryTax category
product.max_quantityMaximum quantity

Payment fields (files[payment])

FieldDescription
payment.numberPayment number
payment.user_idAssigned user
payment.amountPayment amount
payment.refundedRefunded amount
payment.appliedApplied amount
payment.transaction_referenceTransaction reference
payment.private_notesPrivate notes
payment.custom_value1Custom field 1
payment.custom_value2Custom field 2
payment.custom_value3Custom field 3
payment.custom_value4Custom field 4
payment.client_idClient
payment.invoice_numberInvoice number
payment.datePayment date
payment.methodPayment method

Vendor fields (files[vendor])

FieldDescription
vendor.nameVendor name
vendor.phonePhone number
vendor.id_numberID number
vendor.vat_numberVAT/tax number
vendor.websiteWebsite URL
vendor.first_nameFirst name
vendor.last_nameLast name
vendor.emailEmail address
vendor.currency_idCurrency
vendor.public_notesPublic notes
vendor.private_notesPrivate notes
vendor.address1Address line 1
vendor.address2Address line 2
vendor.cityCity
vendor.stateState/province
vendor.postal_codePostal code
vendor.country_idCountry
vendor.custom_value1Custom field 1
vendor.custom_value2Custom field 2
vendor.custom_value3Custom field 3
vendor.custom_value4Custom field 4
contact.first_nameContact first name
contact.last_nameContact last name
contact.emailContact email
contact.phoneContact phone
contact.custom_value1Contact custom field 1
contact.custom_value2Contact custom field 2
contact.custom_value3Contact custom field 3
contact.custom_value4Contact custom field 4

Expense fields (files[expense])

FieldDescription
expense.vendorVendor name
expense.clientClient name
expense.projectProject name
expense.categoryExpense category
expense.amountExpense amount
expense.currencyCurrency
expense.dateExpense date
expense.payment_typePayment type
expense.payment_datePayment date
expense.transaction_referenceTransaction reference
expense.public_notesPublic notes
expense.private_notesPrivate notes
expense.tax_name1Tax name (tier 1)
expense.tax_rate1Tax rate (tier 1)
expense.tax_name2Tax name (tier 2)
expense.tax_rate2Tax rate (tier 2)
expense.tax_name3Tax name (tier 3)
expense.tax_rate3Tax rate (tier 3)
expense.uses_inclusive_taxesWhether tax amounts are inclusive
expense.custom_value1Custom field 1
expense.custom_value2Custom field 2
expense.custom_value3Custom field 3
expense.custom_value4Custom field 4

Quote fields (files[quote])

FieldDescription
quote.numberQuote number
quote.user_idAssigned user
quote.amountQuote amount
quote.balanceOutstanding balance
quote.discountDiscount value
quote.po_numberPurchase order number
quote.dateQuote date
quote.due_dateValid until date
quote.termsQuote terms
quote.statusQuote status
quote.public_notesPublic notes
quote.is_sentWhether the quote has been sent
quote.private_notesPrivate notes
quote.uses_inclusive_taxesWhether tax amounts are inclusive
quote.tax_name1Tax name (tier 1)
quote.tax_rate1Tax rate (tier 1)
quote.tax_name2Tax name (tier 2)
quote.tax_rate2Tax rate (tier 2)
quote.tax_name3Tax name (tier 3)
quote.tax_rate3Tax rate (tier 3)
quote.is_amount_discountWhether discount is a fixed amount
quote.footerQuote footer
quote.partialPartial/deposit amount
quote.partial_due_datePartial payment due date
quote.custom_value1Custom field 1
quote.custom_value2Custom field 2
quote.custom_value3Custom field 3
quote.custom_value4Custom field 4
quote.custom_surcharge1Custom surcharge 1
quote.custom_surcharge2Custom surcharge 2
quote.custom_surcharge3Custom surcharge 3
quote.custom_surcharge4Custom surcharge 4
quote.exchange_rateCurrency exchange rate
client.nameClient name
client.emailClient email
payment.datePayment date
payment.amountPayment amount
payment.transaction_referenceTransaction reference
item.*Same line item fields as invoices

Recurring invoice fields (files[recurring_invoice])

Supports all invoice fields above, plus:

FieldDescription
invoice.frequency_idRecurrence frequency
invoice.remaining_cyclesRemaining billing cycles
invoice.auto_billAuto-bill setting
invoice.next_send_dateNext send date (replaces invoice.date)

Task fields (files[task])

FieldDescription
task.numberTask number
task.user_idAssigned user
task.rateHourly rate
task.descriptionTask description
task.billableWhether the task is billable
task.statusTask status
task.start_dateStart date
task.end_dateEnd date
task.start_timeStart time
task.end_timeEnd time
task.durationDuration
task.custom_value1Custom field 1
task.custom_value2Custom field 2
task.custom_value3Custom field 3
task.custom_value4Custom field 4
task.notesTask notes
project.nameProject name
client.nameClient name
client.emailClient email

Bank transaction fields (files[bank_transaction])

FieldDescription
transaction.transaction_idTransaction ID
transaction.amountTransaction amount
transaction.currencyCurrency
transaction.account_typeAccount type
transaction.categoryCategory
transaction.category_typeCategory type
transaction.dateTransaction date
transaction.bank_accountBank account
transaction.descriptionDescription
transaction.base_typeBase type
transaction.payment_type_CreditCredit amount
transaction.payment_type_DebitDebit amount
transaction.participantParticipant reference
transaction.participant_nameParticipant name

Example

curl -X POST 'https://invoiceninja.com/api/v1/import' \
-H 'X-API-TOKEN: YOUR_API_TOKEN_HERE' \
-H 'Content-Type: application/json' \
-d '{
"hash": "MvKeSwMnhAfgkzdYKgxM5ummxGbLIdNm",
"import_type": "csv",
"skip_header": true,
"column_map": {
"invoice": {
"mapping": {
"0": "client.name",
"1": "client.email",
"2": "",
"3": "invoice.number",
"4": "invoice.amount"
}
}
}
}'

Request

Responses

The import has been queued. A notification email will be sent upon completion.

Response Headers
    X-MINIMUM-CLIENT-VERSION

    The API version

    X-RateLimit-Remaining

    The number of requests left for the time window.

    X-RateLimit-Limit

    The total number of requests in a given time window.