Skip to main content
POST
/
payments
/
invoices
Create Invoice
curl --request POST \
  --url https://api.rootfi.dev/v4/payments/invoices \
  --header 'Content-Type: application/json' \
  --header 'api_key: <api-key>' \
  --data '
{
  "company_id": 123,
  "contact_id": "<string>",
  "currency_id": "<string>",
  "line_items": [
    {
      "description": "<string>",
      "quantity": 123,
      "unit_amount": 123,
      "item_id": "<string>",
      "tax_amount": 123,
      "discount_amount": 123
    }
  ],
  "document_number": "<string>",
  "posted_date": "<string>",
  "due_date": "<string>",
  "status": "DRAFT",
  "memo": "<string>",
  "subscription_id": "<string>"
}
'
{
  "rootfi_id": 157,
  "rootfi_created_at": "2024-01-22T05:07:31.465Z",
  "rootfi_updated_at": "2024-01-22T05:07:31.000Z",
  "rootfi_company_id": 1089,
  "platform_id": "123456",
  "rootfi_deleted_at": "2023-11-07T05:31:56Z",
  "platform_unique_id": "<string>",
  "raw_data": {},
  "data_hash": "<string>",
  "contact_id": "<string>",
  "currency_id": "<string>",
  "document_number": "<string>",
  "posted_date": "<string>",
  "due_date": "<string>",
  "status": "DRAFT",
  "sub_total": 123,
  "tax_amount": 123,
  "total_discount": 123,
  "shipping_amount": 123,
  "total_amount": 123,
  "amount_paid": 123,
  "amount_refunded": 123,
  "amount_credited": 123,
  "amount_due": 123,
  "memo": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "orders": [
    {
      "rootfi_id": 157,
      "rootfi_created_at": "2024-01-22T05:07:31.465Z",
      "rootfi_updated_at": "2024-01-22T05:07:31.000Z",
      "rootfi_company_id": 1089,
      "platform_id": "123456",
      "rootfi_deleted_at": "2023-11-07T05:31:56Z",
      "platform_unique_id": "<string>",
      "raw_data": {},
      "data_hash": "<string>",
      "contact_id": "<string>",
      "currency_id": "<string>",
      "status": "PENDING",
      "payment_status": "DRAFT",
      "total_amount": 123,
      "total_discount": 123,
      "total_tax": 123,
      "created_at": "<string>",
      "updated_at": "<string>",
      "invoice_id": "<string>",
      "invoice_ids": [
        "<string>"
      ],
      "line_items": [
        {
          "rootfi_id": 123,
          "item_id": "<string>",
          "description": "<string>",
          "quantity": 123,
          "unit_amount": 123,
          "tax_amount": 123,
          "discount_amount": 123,
          "total_amount": 123
        }
      ],
      "transactions": [
        {
          "rootfi_id": 123,
          "platform_id": "<string>",
          "type": "PAYMENT",
          "amount": 123,
          "currency_id": "<string>",
          "status": "DRAFT",
          "payment_method_type": "CARD",
          "gateway": "<string>",
          "description": "<string>",
          "created_at": "<string>"
        }
      ]
    }
  ],
  "subscription_id": "<string>",
  "payment_link": "<string>",
  "payment_link_expires_at": "<string>",
  "line_items": [
    {
      "rootfi_id": 123,
      "item_id": "<string>",
      "description": "<string>",
      "quantity": 123,
      "unit_amount": 123,
      "tax_amount": 123,
      "discount_amount": 123,
      "total_amount": 123
    }
  ],
  "transactions": [
    {
      "rootfi_id": 123,
      "platform_id": "<string>",
      "type": "PAYMENT",
      "amount": 123,
      "currency_id": "<string>",
      "status": "DRAFT",
      "payment_method_type": "CARD",
      "gateway": "<string>",
      "description": "<string>",
      "created_at": "<string>"
    }
  ]
}
Create a new invoice in the payment platform. Invoices represent bills issued to contacts for products or services.

Request Body

FieldTypeRequiredDescription
contact_idstringYesReference to the Contact who will be billed
currency_idstringYesISO 4217 currency code (e.g., USD, EUR)
document_numberstringNoHuman-readable invoice number (auto-generated if not provided)
posted_datestringNoDate when invoice is issued (ISO 8601). Defaults to current date
due_datestringNoPayment due date (ISO 8601)
statusstringNoInvoice status (draft, open). Defaults to draft
line_itemsarrayYesArray of line item objects
memostringNoAdditional notes for the invoice
subscription_idstringNoLink to subscription (for recurring invoices)

Line Item Fields

FieldTypeRequiredDescription
item_idstringNoReference to an Item/Product
descriptionstringYesDescription of the product or service
quantityintegerYesNumber of units
unit_amountnumberYesPrice per unit
tax_amountnumberNoTax for this line item
discount_amountnumberNoDiscount applied
See Invoice Overview for complete field details.

Authorizations

api_key
string
header
required

Body

application/json
company_id
integer
required

The Commenda company ID.

contact_id
string
required

Reference to the Contact.

currency_id
string
required

ISO 4217 currency code.

line_items
paymentsV4LineItemCreate · object[]
required
document_number
string | null
posted_date
string | null
due_date
string | null
status
enum<string> | null
Available options:
DRAFT,
SUBMITTED,
PARTIALLY_PAID,
PAID,
OVERDUE,
VOID,
UNKNOWN
memo
string | null
subscription_id
string | null

Response

Invoice created successfully

rootfi_id
number<double>
required

The unique ID we assign for that data's information

Example:

157

rootfi_created_at
string<date-time>
required

The date at which RootFi first synced this data

Example:

"2024-01-22T05:07:31.465Z"

rootfi_updated_at
string<date-time>
required

The latest date at which RootFi updated this data

Example:

"2024-01-22T05:07:31.000Z"

rootfi_company_id
number<double>
required

The ID of the company in the accounting platform

Example:

1089

platform_id
string
required

An unique custom RootFi ID made from platform's unique_id.

Example:

"123456"

rootfi_deleted_at
string<date-time> | null

The date at which the data was deleted in the accounting platform

platform_unique_id
string | null

The ID of the data in the accounting platform.

raw_data
object

A JSON containing fields that you can directly get from the accounting platform.

data_hash
string | null

The hash of the data

contact_id
string | null

Reference to the Contact who is billed.

currency_id
string | null

ISO 4217 currency code for all amounts on this invoice (e.g., USD, EUR, GBP).

document_number
string | null

Human-readable invoice number (e.g., INV-2025-001).

posted_date
string | null

The ISO 8601 date when this invoice was issued.

due_date
string | null

The ISO 8601 date by which payment is due.

status
enum<string> | null

Current payment status of the invoice (DRAFT, SUBMITTED, PARTIALLY_PAID, PAID, OVERDUE, VOID, UNKNOWN).

Available options:
DRAFT,
SUBMITTED,
PARTIALLY_PAID,
PAID,
OVERDUE,
VOID,
UNKNOWN
sub_total
number<double> | null

Total amount before tax, discounts, and shipping.

tax_amount
number<double> | null

Total tax charged on this invoice.

total_discount
number<double> | null

Total discount amount applied.

shipping_amount
number<double> | null

Shipping and handling charges.

total_amount
number<double> | null

Final total amount due (sub_total + tax - discount + shipping).

amount_paid
number<double> | null

Total amount paid by the contact.

amount_refunded
number<double> | null

Total amount refunded to the contact.

amount_credited
number<double> | null

Total credit notes applied to this invoice.

amount_due
number<double> | null

Remaining balance due (total_amount - amount_paid + amount_refunded + amount_credited).

memo
string | null

Additional notes or description for this invoice.

created_at
string | null

Original creation timestamp from platform (ISO 8601).

updated_at
string | null

Last update timestamp from platform (ISO 8601).

orders
paymentsOrderObject · object[] | null

Associated Orders (for consolidated invoices). Expandable attribute.

subscription_id
string | null

Reference to the Subscription (for recurring invoices).

URL where contact can pay this invoice online.

Expiration date for the payment link (ISO 8601).

line_items
paymentsV4LineItem · object[] | null

Individual items/services billed on this invoice.

transactions
paymentsV4TransactionEmbedded · object[] | null

Complete history of payments, refunds, and credits for this invoice.