Bills

Create Bills in batch

Changed on

Create multiple bills in a single request. Each item is processed independently, so some may be created while others fail; the response returns 200 with one result per item, in the order the items were sent. The maximum number of items accepted per request depends on the connector.

post/accounting/bills/batch

Request

  • Base URL: https://unify.apideck.com
  • URL: https://unify.apideck.com/accounting/bills/batch
  • Auth: API key in header Authorization

Query parameters

rawboolean

Include raw response. Mostly used for debugging purposes

Headers

x-apideck-consumer-idstring required

ID of the consumer which you want to get or push data from

x-apideck-app-idstring required

The ID of your Unify application

x-apideck-service-idstring

Provide the service id you want to call (e.g., pipedrive). Only needed when a consumer has activated multiple integrations for a Unified API.

x-apideck-company-idstring

The ID of the company to scope requests to. For connectors that support multi-company, this overrides the default company configured in connection settings.

Request body

Example request

{
  "items": [
    {
      "_ref": "item-1",
      "data": {
        "display_id": "123456",
        "bill_number": "10001",
        "supplier": {
          "id": "12345",
          "display_id": "SUPP00101",
          "display_name": "Windsurf Shop",
          "company_name": "The boring company",
          "address": {
            "id": "123",
            "type": "primary",
            "string": "25 Spring Street, Blackburn, VIC 3130",
            "name": "HQ US",
            "line1": "Main street",
            "line2": "apt #",
            "line3": "Suite #",
            "line4": "delivery instructions",
            "line5": "Attention: Finance Dept",
            "street_number": "25",
            "city": "San Francisco",
            "state": "CA",
            "postal_code": "94104",
            "country": "US",
            "latitude": "40.759211",
            "longitude": "-73.984638",
            "county": "Santa Clara",
            "contact_name": "Elon Musk",
            "salutation": "Mr",
            "phone_number": "111-111-1111",
            "fax": "122-111-1111",
            "email": "elon@musk.com",
            "website": "https://elonmusk.com",
            "notes": "Address notes or delivery instructions.",
            "row_version": "1-12345"
          }
        },
        "company_id": "12345",
        "subsidiary": {
          "id": "12345",
          "display_id": "123456",
          "name": "Acme Inc."
        },
        "location_id": "12345",
        "department_id": "12345",
        "currency": "USD",
        "currency_rate": 0.69,
        "tax_inclusive": true,
        "bill_date": "2020-09-30",
        "due_date": "2020-10-30",
        "paid_date": "2020-10-30",
        "po_number": "90000117",
        "reference": "INV-2024-001",
        "line_items": [
          {
            "id": "12345",
            "row_id": "12345",
            "code": "120-C",
            "line_number": 1,
            "description": "Model Y is a fully electric, mid-size SUV, with seating for up to seven, dual motor AWD and unparalleled protection.",
            "type": "expense_account",
            "tax_amount": 27.5,
            "total_amount": 27500,
            "quantity": 1,
            "unit_price": 27500.5,
            "unit_of_measure": "pc.",
            "discount_percentage": 0.01,
            "discount_amount": 19.99,
            "location_id": "12345",
            "department_id": "12345",
            "subsidiary_id": "12345",
            "category_id": "12345",
            "shipping_id": "12345",
            "memo": "Some memo",
            "prepaid": true,
            "tax_applicable_on": "Domestic_Purchase_of_Goods_and_Services",
            "tax_recoverability": "Fully_Recoverable",
            "tax_method": "Due_to_Supplier",
            "retention_amount": 1000,
            "payment_amount": 1000,
            "item": {
              "id": "12344",
              "code": "120-C",
              "name": "Model Y"
            },
            "tax_rate": {
              "id": "123456",
              "code": "N-T",
              "name": "GST on Purchases",
              "rate": 10
            },
            "ledger_account": {
              "id": "123456",
              "name": "Bank account",
              "nominal_code": "N091",
              "code": "453",
              "parent_id": "123456",
              "display_id": "123456"
            },
            "purchase_order": {
              "id": "123456",
              "line_id": "123456",
              "line_number": "1"
            },
            "tracking_categories": [
              {
                "id": "123456",
                "code": "100",
                "name": "New York",
                "parent_id": "123456",
                "parent_name": "New York"
              }
            ],
            "customer": {
              "id": "12345",
              "display_id": "CUST00101",
              "display_name": "Windsurf Shop",
              "name": "Windsurf Shop",
              "company_name": "The boring company",
              "email": "boring@boring.com"
            },
            "rebilling": {
              "rebillable": true,
              "rebill_status": "billed",
              "linked_transaction_id": "txn_abc123",
              "linked_transaction_line_id": "line_xyz789"
            },
            "row_version": "1-12345",
            "updated_by": "12345",
            "created_by": "12345",
            "created_at": "2020-09-30T07:43:32.000Z",
            "updated_at": "2020-09-30T07:43:32.000Z",
            "worktags": [
              {
                "id": "123456",
                "value": "New York"
              }
            ]
          }
        ],
        "terms": "Net 30 days",
        "terms_id": "12345",
        "balance": 27500,
        "sub_total": 250,
        "total_tax": 25,
        "total": 27500,
        "tax_code": "1234",
        "notes": "Some notes about this bill.",
        "status": "draft",
        "ledger_account": {
          "id": "123456",
          "name": "Bank account",
          "nominal_code": "N091",
          "code": "453",
          "parent_id": "123456",
          "display_id": "123456"
        },
        "payment_method": "cash",
        "channel": "email",
        "language": "EN",
        "bank_account": {
          "bank_name": "Chase Bank",
          "account_number": "123465",
          "account_name": "Main Operating Account",
          "account_type": "credit_card",
          "iban": "GB33BUKB20201555555555",
          "bic": "CHASUS33",
          "routing_number": "021000021",
          "bsb_number": "062-001",
          "branch_identifier": "001",
          "bank_code": "BNH",
          "currency": "USD",
          "country": "US"
        },
        "discount_percentage": 5.5,
        "template_id": "123456",
        "approved_by": "John Doe",
        "tax_method": "Due to supplier",
        "document_received": true,
        "source_document_url": "https://www.invoicesolution.com/bill/123456",
        "payment_allocations": [
          {
            "id": "123456",
            "allocated_amount": 1000,
            "date": "2020-09-30T07:43:32.000Z"
          }
        ],
        "tracking_categories": [
          {
            "id": "123456",
            "code": "100",
            "name": "New York",
            "parent_id": "123456",
            "parent_name": "New York"
          }
        ],
        "row_version": "1-12345",
        "custom_fields": [
          {
            "id": "2389328923893298",
            "name": "employee_level",
            "ref_name": "Marketing",
            "description": "Employee Level",
            "value": "Uses Salesforce and Marketo"
          }
        ],
        "pass_through": [
          {
            "extend_paths": [
              {
                "path": "$.nested.property",
                "value": {
                  "TaxClassificationRef": {
                    "value": "EUC-99990201-V1-00020000"
                  }
                }
              }
            ]
          }
        ],
        "accounting_period": "01-24",
        "attachments": [
          {
            "name": "sample.jpg",
            "mime_type": "image/jpeg",
            "encoding": "base64",
            "content": "data:image/jpeg;base64,...",
            "notes": "A sample image"
          }
        ]
      }
    }
  ]
}

Response

Bills batch processed

status_codeinteger required

HTTP Response Status Code

statusstring required

HTTP Response Status

servicestring required

Apideck ID of service provider

resourcestring required

Unified API resource name

operationstring required

Operation performed

_rawRaw nullable

Raw response from the integration when raw=true query param is provided

Example response

{
  "status_code": 200,
  "status": "OK",
  "service": "quickbooks",
  "resource": "bills",
  "operation": "add",
  "data": [
    {
      "_ref": "item-1",
      "id": "12345",
      "downstream_id": "12345",
      "status": "created",
      "error": {
        "status_code": 502,
        "error": "Bad Gateway",
        "type_name": "PostWriteProcessingError",
        "message": "The record was written, but processing its response failed.",
        "ref": "https://developers.apideck.com/errors#postwriteprocessingerror"
      },
      "warnings": [
        {
          "type": "currency_not_configured",
          "operation": "invoicesAdd",
          "message": "Currency \"CAD\" is not configured for this organization -- the request was sent without currency_id.",
          "status_code": 200
        }
      ]
    }
  ]
}

Changes