POST
/
accounting
/
invoices
import { Panora } from "@panora/sdk";

const panora = new Panora({
  apiKey: "<YOUR_API_KEY_HERE>",
});

async function run() {
  const result = await panora.accounting.invoices.create({
    xConnectionToken: "<value>",
    remoteData: false,
    unifiedAccountingInvoiceInput: {
      type: "Sales",
      number: "INV-001",
      issueDate: new Date("2024-06-15T12:00:00Z"),
      dueDate: new Date("2024-07-15T12:00:00Z"),
      paidOnDate: new Date("2024-07-10T12:00:00Z"),
      memo: "Payment for services rendered",
      currency: "USD",
      exchangeRate: "1.2",
      totalDiscount: 1000,
      subTotal: 10000,
      status: "Paid",
      totalTaxAmount: 1000,
      totalAmount: 11000,
      balance: 0,
      contactId: "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
      accountingPeriodId: "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
      trackingCategories: [
        "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
        "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
      ],
      lineItems: [
        {
          name: "Net Income",
          value: 100000,
          type: "Operating Activities",
          parentItem: "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
          remoteId: "report_item_1234",
          remoteGeneratedAt: new Date("2024-07-01T12:00:00Z"),
          companyInfoId: "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
          createdAt: new Date("2024-06-15T12:00:00Z"),
          modifiedAt: new Date("2024-06-15T12:00:00Z"),
        },
      ],
      fieldMappings: {},
    },
  });
  
  // Handle the result
  console.log(result)
}

run();
{
  "type": "Sales",
  "number": "INV-001",
  "issue_date": "2024-06-15T12:00:00Z",
  "due_date": "2024-07-15T12:00:00Z",
  "paid_on_date": "2024-07-10T12:00:00Z",
  "memo": "Payment for services rendered",
  "currency": "USD",
  "exchange_rate": "1.2",
  "total_discount": 1000,
  "sub_total": 10000,
  "status": "Paid",
  "total_tax_amount": 1000,
  "total_amount": 11000,
  "balance": 0,
  "contact_id": "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
  "accounting_period_id": "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
  "tracking_categories": [
    "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
    "801f9ede-c698-4e66-a7fc-48d19eebaa4f"
  ],
  "line_items": [
    {
      "name": "Net Income",
      "value": 100000,
      "type": "Operating Activities",
      "parent_item": "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
      "remote_id": "report_item_1234",
      "remote_generated_at": "2024-07-01T12:00:00Z",
      "company_info_id": "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
      "created_at": "2024-06-15T12:00:00Z",
      "modified_at": "2024-06-15T12:00:00Z"
    }
  ],
  "field_mappings": {
    "custom_field_1": "value1",
    "custom_field_2": "value2"
  },
  "id": "801f9ede-c698-4e66-a7fc-48d19eebaa4f",
  "remote_id": "invoice_1234",
  "remote_data": {
    "raw_data": {
      "additional_field": "some value"
    }
  },
  "remote_updated_at": "2024-06-15T12:00:00Z",
  "created_at": "2024-06-15T12:00:00Z",
  "modified_at": "2024-06-15T12:00:00Z"
}

Authorizations

x-api-key
string
header
required

Headers

x-connection-token
string
required

The connection token

Query Parameters

remote_data
boolean

Set to true to include data from the original Accounting software.

Body

application/json

Response

201 - application/json

The response is of type object.