POST Invoice

Insert an invoice.

Request Information

URI Parameters

Name Description Type Additional information
WsAccessKey The Web Service access key for this user and file which allows access to the API for the associated file (found in File - Settings). Using OAuth authentication mechanism is the preferred method to allow API access. string

Optional. Legacy authentication method and only required if not using OAuth. OAuth is preferred.

FileId Specifies the file id of the file to perform the operation upon. integer

Required

Body Parameters

Invoice details.

InvoiceTransactionDetail
Name Description Type Additional information
LineItems The line items associated with this invoice. Collection of InvoiceTransactionLineItem

Required

NotesInternal Textual notes set by the system. string

None.

NotesExternal Textual notes set by the user. string

None.

Terms The trading terms of the invoice. InvoiceTradingTerms

None.

Attachments List of attachments associated with this invoice. This data is returned only and cannot be added or updated when issuing a POST or PUT. Collection of FileAttachmentInfo

None.

TemplateId The Id/key of the template (if any) associated with this invoice. integer

None.

ForEntityTypeId The Id of EntityType to use for printing/sending (4 - Sale, 98 - Shipping Slip). integer

None.

SendEmailToContact Instruct the system to send an email to the contact as part of the insert/update. EmailMessage details, including 'From' and 'To', must also be specified. boolean

None.

EmailMessage The Email message to send to the contact if instructed. Note: This is only applicable when updating (PUT) or inserting (POST) a transaction and is not returned when making a GET request. Email

None.

QuickPayment Payment to be applied to this invoice. Quickpayments can only be inserted/added via a HTTP POST request. Updates via HTTP PUT are not support. Note: This is only applicable when updating (PUT) or inserting (POST) a transaction and is not returned when making a GET request. InvoiceQuickPaymentDetail

None.

TransactionId The Id/key of the invoice/transaction. This data is returned only and cannot be added or updated when issuing a POST or PUT. integer

None.

LastUpdatedId A data field used to check concurreny when performing updates. This data is returned only and used for concurrency checking when performing an update/PUT. string

None.

Currency The currrency code of the amounts. Eg. AUD. string

None.

InvoiceNumber Invoice number. Use a value of <Auto Number> to automatically generate an invoice number. string

None.

InvoiceType Available types are: "Pre-Quote Opportunity", "Quote" , "Purchase Order", "Sale Order", "Tax Invoice", "Adjustment Note", "RCT Invoice", "Money In (Income)", "Money Out (Expense)". string

Required

TransactionType The transaction type of the invoice. Supported types are: 'S' = sale, 'P' = purchase. string

Required

Layout The Layout of the invoice. I = Item Sale, S = Service Sale. string

Required

BrandId The id/key of brand for the invoice. 0 or null means default brand. Used for printing and emailing PDF invoice in new theme library. integer

None.

Summary Invoice summary. string

None.

TotalAmount Total amount of the invoice. decimal number

None.

TotalTaxAmount Total tax amount of the invoice. decimal number

None.

IsTaxInc Indicates if tax is included in the amounts. On an invoice insert or update, if this element is not included or specified, then false is assumed. boolean

None.

AmountPaid Total amount paid. decimal number

None.

AmountOwed Total amount owed. decimal number

None.

FxRate FXRate (Foreign exchange rate) applied to this invoice. decimal number

None.

AutoPopulateFxRate Determines whether the FxRate is automatically populated using the Fx feed. boolean

None.

RequiresFollowUp Indicates whether the invoice requires follow up. boolean

None.

SentToContact Indicates whether the invoice was sent to the contact. boolean

None.

TransactionDate Date of this transaction. date

Required

BillingContactId The Id/key of the billing contact. integer

None.

BillingContactFirstName Billing contact first name. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

BillingContactLastName Billing contact last name. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

BillingContactOrganisationName Billing contact organisation name. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

ShippingContactId The Id/key of the shipping contact. integer

None.

ShippingContactFirstName Shipping contact first name. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

ShippingContactLastName Shipping contact last name. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

ShippingContactOrganisationName Shipping contact organisation name. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

CreatedDateUtc The date and time this resource was created in UTC. This data is returned only and cannot be added or updated when issuing a POST or PUT. date

None.

LastModifiedDateUtc The date and time this resource was last modified in UTC. This data is returned only and cannot be added or updated when issuing a POST or PUT. date

None.

PaymentStatus The payment status of this invoice. Supported types are: 'A' = all, 'P' = paid, 'U' = unpaid. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

DueDate The date that this invoice is due. date

None.

InvoiceStatus Not required for inserting/adding an invoice as it is determined by the "InvoiceType'. Indicator specifying: Q = Quote, O = Order, I = Invoice. Note: This field is deprecated (is readonly) and is inferred from InvoiceType. It is here for backwards compatibility only. This data is returned only and cannot be added or updated when issuing a POST or PUT. string

None.

PurchaseOrderNumber The purchase order number. string

None.

PaymentCount The number of payments applied (if any). This data is returned only and cannot be added or updated when issuing a POST or PUT. integer

None.

Tags List of tags associated with this resource. Collection of string

None.

_links Hypermedia links. Contains contextual links to possible next actions related to this resource. Only present in responses. This data is not to be sent to the server. Collection of Link

None.

Request Formats

application/json, text/json

Sample:
{
  "LineItems": [
    {
      "Id": 30,
      "Description": "Sale Item",
      "AccountId": null,
      "TaxCode": "G1",
      "TotalAmount": 10.45,
      "Quantity": 3.0,
      "UnitPrice": 11.5,
      "PercentageDiscount": 0.0,
      "InventoryId": 30,
      "ItemCode": "CC123",
      "Tags": [],
      "Attributes": [],
      "_links": []
    }
  ],
  "NotesInternal": null,
  "NotesExternal": null,
  "Terms": {
    "Type": 1,
    "Interval": 3,
    "IntervalType": null,
    "TypeEnum": "DueIn",
    "IntervalTypeEnum": "Week"
  },
  "Attachments": [
    {
      "Id": 1,
      "Size": 0,
      "Name": "test.txt",
      "Description": "Test document",
      "ItemIdAttachedTo": 0,
      "_links": [
        {
          "rel": "detail",
          "href": "https://api.saasu.com/InvoiceAttachment/1?FileId=123",
          "method": "GET",
          "title": null
        }
      ]
    }
  ],
  "TemplateId": null,
  "ForEntityTypeId": null,
  "SendEmailToContact": null,
  "EmailMessage": null,
  "QuickPayment": null,
  "TransactionId": 5093684,
  "LastUpdatedId": "AAAAAAAKgc=",
  "Currency": "AUD",
  "InvoiceNumber": "INV-1123",
  "InvoiceType": "Tax Invoice",
  "TransactionType": "S",
  "Layout": "I",
  "BrandId": null,
  "Summary": "Invoice for order 1123",
  "TotalAmount": 10.45,
  "TotalTaxAmount": null,
  "IsTaxInc": true,
  "AmountPaid": 0.0,
  "AmountOwed": 11.5,
  "FxRate": 1.0,
  "AutoPopulateFxRate": false,
  "RequiresFollowUp": false,
  "SentToContact": true,
  "TransactionDate": "2015-01-24T00:00:00",
  "BillingContactId": 1568986,
  "BillingContactFirstName": "Freddy",
  "BillingContactLastName": "Fungus",
  "BillingContactOrganisationName": "Fungal Innovation",
  "ShippingContactId": 10,
  "ShippingContactFirstName": "Big",
  "ShippingContactLastName": "Bob",
  "ShippingContactOrganisationName": "Bobbby Inc",
  "CreatedDateUtc": "2024-10-12T18:00:06.7328189Z",
  "LastModifiedDateUtc": "2024-10-13T18:00:06.7328189Z",
  "PaymentStatus": "U",
  "DueDate": null,
  "InvoiceStatus": "I",
  "PurchaseOrderNumber": "PO-4456",
  "PaymentCount": 0,
  "Tags": [
    "Note",
    "Supplier",
    "Toys"
  ],
  "_links": []
}

application/xml, text/xml

Sample:
<InvoiceTransactionDetail xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <_links />
  <TransactionId>5093684</TransactionId>
  <LastUpdatedId>AAAAAAAKgc=</LastUpdatedId>
  <Currency>AUD</Currency>
  <InvoiceNumber>INV-1123</InvoiceNumber>
  <InvoiceType>Tax Invoice</InvoiceType>
  <TransactionType>S</TransactionType>
  <Layout>I</Layout>
  <BrandId xsi:nil="true" />
  <Summary>Invoice for order 1123</Summary>
  <TotalAmount>10.45</TotalAmount>
  <TotalTaxAmount xsi:nil="true" />
  <IsTaxInc>true</IsTaxInc>
  <AmountPaid>0.00</AmountPaid>
  <AmountOwed>11.50</AmountOwed>
  <FxRate>1</FxRate>
  <AutoPopulateFxRate>false</AutoPopulateFxRate>
  <RequiresFollowUp>false</RequiresFollowUp>
  <SentToContact>true</SentToContact>
  <TransactionDate>2015-01-24T00:00:00</TransactionDate>
  <BillingContactId>1568986</BillingContactId>
  <BillingContactFirstName>Freddy</BillingContactFirstName>
  <BillingContactLastName>Fungus</BillingContactLastName>
  <BillingContactOrganisationName>Fungal Innovation</BillingContactOrganisationName>
  <ShippingContactId>10</ShippingContactId>
  <ShippingContactFirstName>Big</ShippingContactFirstName>
  <ShippingContactLastName>Bob</ShippingContactLastName>
  <ShippingContactOrganisationName>Bobbby Inc</ShippingContactOrganisationName>
  <CreatedDateUtc>2024-10-12T18:00:06.7328189Z</CreatedDateUtc>
  <LastModifiedDateUtc>2024-10-13T18:00:06.7328189Z</LastModifiedDateUtc>
  <PaymentStatus>U</PaymentStatus>
  <DueDate xsi:nil="true" />
  <InvoiceStatus>I</InvoiceStatus>
  <PurchaseOrderNumber>PO-4456</PurchaseOrderNumber>
  <PaymentCount>0</PaymentCount>
  <Tags>
    <string>Note</string>
    <string>Supplier</string>
    <string>Toys</string>
  </Tags>
  <LineItems>
    <InvoiceTransactionLineItem>
      <_links />
      <Id>30</Id>
      <Description>Sale Item</Description>
      <AccountId xsi:nil="true" />
      <TaxCode>G1</TaxCode>
      <TotalAmount>10.45</TotalAmount>
      <Quantity>3</Quantity>
      <UnitPrice>11.50</UnitPrice>
      <PercentageDiscount>0.00</PercentageDiscount>
      <InventoryId>30</InventoryId>
      <ItemCode>CC123</ItemCode>
      <Tags />
      <Attributes />
    </InvoiceTransactionLineItem>
  </LineItems>
  <NotesInternal xsi:nil="true" />
  <NotesExternal xsi:nil="true" />
  <Terms>
    <Type>1</Type>
    <Interval>3</Interval>
    <IntervalType xsi:nil="true" />
    <TypeEnum>DueIn</TypeEnum>
    <IntervalTypeEnum>Week</IntervalTypeEnum>
  </Terms>
  <Attachments>
    <FileAttachmentInfo>
      <_links>
        <Link>
          <rel>detail</rel>
          <href>https://api.saasu.com/InvoiceAttachment/1?FileId=123</href>
          <method>GET</method>
        </Link>
      </_links>
      <Name>test.txt</Name>
      <Description>Test document</Description>
      <ItemIdAttachedTo>0</ItemIdAttachedTo>
      <Id>1</Id>
      <Size>0</Size>
    </FileAttachmentInfo>
  </Attachments>
  <TemplateId xsi:nil="true" />
  <ForEntityTypeId xsi:nil="true" />
  <SendEmailToContact xsi:nil="true" />
  <EmailMessage xsi:nil="true" />
  <QuickPayment xsi:nil="true" />
</InvoiceTransactionDetail>

Response Information

Resource Description

InsertInvoiceResult
Name Description Type Additional information
InsertedEntityId The Id of the inserted invoice. integer

None.

GeneratedInvoiceNumber The invoice number that was generated for the invoice. string

None.

Id Updated invoice id integer

None.

SentToContact Indicates whether this was sent to the contact. boolean

None.

LastUpdatedId The unique identifier generated as part of the update. This value is required when submitting subsequent update to prevent concurrency errors. string

None.

UtcLastModified The date and time this resource was modified in UTC. date

None.

_links Hypermedia links. Contains contextual links to possible next actions related to this resource. Only present in responses. This data is not to be sent to the server. Collection of Link

None.

Response Formats

application/json, text/json

Sample:
{
  "InsertedEntityId": 321,
  "GeneratedInvoiceNumber": "987",
  "Id": 0,
  "SentToContact": false,
  "LastUpdatedId": "AAAAKlh=",
  "UtcLastModified": "2024-10-08T18:00:06.9401263Z",
  "_links": [
    {
      "rel": "self",
      "href": "https://api.saasu.com/Invoice/321?FileId=123",
      "method": "POST",
      "title": null
    },
    {
      "rel": "list",
      "href": "https://api.saasu.com/Invoices?FileId=123",
      "method": "GET",
      "title": null
    },
    {
      "rel": "update",
      "href": "https://api.saasu.com/Invoice/321?FileId=123",
      "method": "PUT",
      "title": null
    },
    {
      "rel": "delete",
      "href": "https://api.saasu.com/Invoice/321?FileId=123",
      "method": "DELETE",
      "title": null
    }
  ]
}

application/xml, text/xml

Sample:
<InsertInvoiceResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <_links>
    <Link>
      <rel>self</rel>
      <href>https://api.saasu.com/Invoice/321?FileId=123</href>
      <method>POST</method>
    </Link>
    <Link>
      <rel>list</rel>
      <href>https://api.saasu.com/Invoices?FileId=123</href>
      <method>GET</method>
    </Link>
    <Link>
      <rel>update</rel>
      <href>https://api.saasu.com/Invoice/321?FileId=123</href>
      <method>PUT</method>
    </Link>
    <Link>
      <rel>delete</rel>
      <href>https://api.saasu.com/Invoice/321?FileId=123</href>
      <method>DELETE</method>
    </Link>
  </_links>
  <LastUpdatedId>AAAAKlh=</LastUpdatedId>
  <UtcLastModified>2024-10-08T18:00:06.9401263Z</UtcLastModified>
  <Id>0</Id>
  <SentToContact>false</SentToContact>
  <InsertedEntityId>321</InsertedEntityId>
  <GeneratedInvoiceNumber>987</GeneratedInvoiceNumber>
</InsertInvoiceResult>