Search code examples
jsonxero-api

Do ManualJournals LineAmounts have to equal to zero? Xero-API


I am having a look at the xero developer documentation for manual journal lines: https://developer.xero.com/documentation/api/manual-journals#LineItemsPOST. Forgive me for the simple question, but I have a question regarding the adding in 'journalLines' looking at the "Example of a new draft manual journal with optional elements" JSON sample on the xero developer website. Do the journal lines LineAmounts (credit and debit) have to add up to zero, such as in the case of the sample on the website, or is it acceptable to just add journalLines in as needed? The reason behind this is that a large list of 'journal lines' would need to be sent over. Below is a random example of what could be sent to the API. Thanks

{
  "Date": "2014-08-13",
  "Status": "DRAFT",
  "Narration": "This is some random text",
  "LineAmountTypes": "NoTax",
  "JournalLines": {
    "JournalLine": [
      {
        "Description": "Prepaid Annual Phone",
        "LineAmount": -1000.00,
        "AccountCode": "489",
        "TaxType": "NONE"        
        }
      },
      {
        "Description": "Prepayment",
        "LineAmount": 132.00,
        "AccountCode": "620",
        "TaxType": "NONE"        
        },
       {
        "Description": "Prepayment",
        "LineAmount": 31.00,
        "AccountCode": "620",
        "TaxType": "NONE"        
        },
       {
        "Description": "Prepayment",
        "LineAmount": 97.00,
        "AccountCode": "620",
        "TaxType": "NONE"        
        }
      }
    ]
  },
  "ShowOnCashBasisReports": "false"
}

Solution

  • I ended up finding Xero's API previewer, and yes it does need to balance or an error is returned.