Create Invoice Record

POST /api/.../invoices

Create a new invoice record.

Request Information

Parameters
Name Type Required Description
dtoInvoiceUpdateInfo Invoice Yes Define this parameter in the request body.
action String No Not required. Define this parameter in the request query string. Value is 'createinvoice'.
DtoInvoiceUpdateInfo
Property Type Nullable Description
InvoiceID Int Yes The unique id assigned to the Invoice, ignored while creating invoice
SupplierID Int Yes The unique id assigned to the Supplier.
PaymentMethodID int Yes The unique id assigned to the Invoice Payment Method.
InvoiceTypeID int Yes The unique id assigned to the Invoice Type.
DiscRate Decimal Yes Discount Rate
InvClosingAlertDate Datetime Yes Invoice Closing Alert Date
InvDate Datetime Yes Invoice Date
InvNote String Yes Invoice Note
InvNumber String Yes Invoice number
InvNumberSuf String Yes Invoice number suffix
InvReceiptDate Datetime Yes Invoice Receipt Date
InvTxMeth String Yes Transmission method
ModificationDate DateTime Yes Modification date
OrganizationID Int Yes The unique id assigned to the Organization.
MofifierID Int Yes The unique id assigned to the Modifier.
PaymentDueDate Datetime Yes Payment Due date
PlanName string Yes Invoice Plan name
ShippedDate DateTime Yes Shipped Date
SalesTaxRate1 Decimal Yes Sales Tax
Example
application/json, text/json
 {
  "InvoiceID": 0,
  "SupplierID": 556,
  "PaymentMethodID": 8,
  "InvoiceTypeID": 5,
  "DiscRate": 0.11,
  "InvClosingAlertDate": null,
  "InvDate": "2021-07-19T18:03:58.967Z",
  "InvNote": "update invoice note",
  "InvNumber": "11111111",
  "InvNumberSuf": "",
  "InvReceiptDate": null,
  "InvTxMeth": "Electronic",
  "ModificationDate": "2021-07-19T18:03:58.967Z",
  "OrganizationID": 103,
  "ModifierID": 1,
  "PaymentDueDate": null,
  "PlanName": "string",
  "ShippedDate": null,
  "SalesTaxRate1": 0
}

Response Information

Id of the newly created invoice is returned upon success.

Example
application/json, text/json
25567

HTTP Response Codes

Code Description
200 OK. Success

Copy Purchase Order Line Items To A New Invoice

POST /api/.../invoices?action=createinvoicewithpolines

Create a new invoice and copy one or more purchase order line items to the newly created invoice.

Request Information

Parameters
Name Type Required Description
dtoPOLineItemCopyToCreateInvoice No Define this parameter in the request body
action String Yes Required. Define this parameter in the request query string. Value is 'createinvoicewithpolines'.
DtoPOLineItemCopyToCreateInvoice
Property Type Nullable Description
POLineItemIDs Array of integer No Array of purchase order line item identifiers represented as numbers.
DtoInvoiceUpdateInfo DtoInvoiceUpdateInfo No Invoice create Information
DtoInvoiceUpdateInfo
Property Type Nullable Description
InvoiceID Int Yes The unique id assigned to the Invoice, ignored while creating invoice
SupplierID Int Yes The unique id assigned to the Supplier.
PaymentMethodID int Yes The unique id assigned to the Invoice Payment Method.
InvoiceTypeID int Yes The unique id assigned to the Invoice Type.
DiscRate Decimal Yes Discount Rate
InvClosingAlertDate Datetime Yes Invoice Closing Alert Date
InvDate Datetime Yes Invoice Date
InvNote String Yes Invoice Note
InvNumber String No Invoice number
InvNumberSuf String Yes Invoice number suffix
InvReceiptDate Datetime Yes Invoice Receipt Date
InvTxMeth String Yes Transmission method
ModificationDate DateTime Yes Modification date
OrganizationID Int Yes The unique id assigned to the Organization.
MofifierID Int Yes The unique id assigned to the Modifier.
PaymentDueDate Datetime Yes Payment Due date
PlanName string Yes Invoice Plan name
ShippedDate DateTime Yes Shipped Date
SalesTaxRate1 Decimal Yes Sales Tax

A JSON array of purchase order line item identifiers represented as numbers.

Property Type Nullable Description
POLineItemIDs Integer No PO line item identifier.
Example
application/json, text/json
{
    "DtoInvoiceUpdateInfo": 
    {
        "InvoiceID":"1",
        "SupplierID":2,
        "PaymentMethodID":8,
        "InvoiceTypeID":1,
        "DiscRate":0,
        "InvClosingAlertDate":null,
        "InvDate":"2022-08-15",
        "InvNumber":"AMS29",
        "InvNumberSuf":"jlm",
        "InvReceiptDate":null,
        "OrganizationID":"3",
        "PaymentDueDate":null,
        "ShippedDate":null,
        "SalesTaxRate1":null,
        "InvTxMeth":null
    },
    "POLineItemIDs": [154476,154477]
}

Response Information

Returns a result object with how many records are succeeded (RecordsAffected), a success or failure message (Message) and list of JSON objects (Details)

Property Type Description
ID Integer PO line item identifier.
Succeeded Boolean Indicates if the item is copied successfully.
ErrorMessage String Description of error
ErrorCode Integer Error code
AdditionalInfo String PO line item's line number
Example
application/json, text/json
{
  "RecordsAffected": 2,
  "Message": "Copying was completed successfully.",
  "Details": [
    {
      "Id": 154476,
      "Succeeded": true,
      "ErrorMessage": null,
      "ErrorCode": 0,
      "AdditionalInfo": "33"
    },
    {
      "Id": 154478,
      "Succeeded": true,
      "ErrorMessage": null,
      "ErrorCode": 0,
      "AdditionalInfo": "31"
    }
  ]
}

Copy Purchase Order Line Segments To A New Invoice

POST /api/.../invoices?action=createinvoicewithpolinesegments

Create a new invoice and copy one or more purchase order line item segments to the newly created invoice.

Request Information

Parameters
Name Type Required Description
DtoPOLineSegmentCopyToCreateInvoice No Define this parameter in the request body
action String Yes Required. Define this parameter in the request query string. Value is 'createinvoicewithpolinesegments'.
DtoPOLineSegmentCopyToCreateInvoice
Property Type Nullable Description
POLineSegmentIDs Array of integer No Array of purchase order line item segment identifiers represented as numbers.
POLineItemID Integer No Purchase order line item identifier.
DtoInvoiceUpdateInfo DtoInvoiceUpdateInfo No Invoice create Information
DtoInvoiceUpdateInfo
Property Type Nullable Description
SupplierID Int Yes The unique id assigned to the Supplier.
PaymentMethodID int Yes The unique id assigned to the Invoice Payment Method.
InvoiceTypeID int Yes The unique id assigned to the Invoice Type.
DiscRate Decimal Yes Discount Rate
InvClosingAlertDate Datetime Yes Invoice Closing Alert Date
InvDate Datetime Yes Invoice Date
InvNote String Yes Invoice Note
InvNumber String No Invoice number
InvNumberSuf String Yes Invoice number suffix
InvReceiptDate Datetime Yes Invoice Receipt Date
InvTxMeth String Yes Transmission method
ModificationDate DateTime Yes Modification date
OrganizationID Int Yes The unique id assigned to the Organization.
MofifierID Int Yes The unique id assigned to the Modifier.
PaymentDueDate Datetime Yes Payment Due date
PlanName string Yes Invoice Plan name
ShippedDate DateTime Yes Shipped Date
SalesTaxRate1 Decimal Yes Sales Tax

A JSON array of purchase order line item segments identifiers represented as numbers.

Property Type Nullable Description
POLineSegmentIDs Integer No PO line item segment identifier.
Example
application/json, text/json
{
    "DtoInvoiceUpdateInfo": 
    {
        "SupplierID":2,
        "PaymentMethodID":8,
        "InvoiceTypeID":1,
        "DiscRate":0,
        "InvClosingAlertDate":null,
        "InvDate":"2022-08-15",
        "InvNumber":"AMS291",
        "InvNumberSuf":"jlm",
        "InvReceiptDate":null,
        "OrganizationID":"3",
        "PaymentDueDate":null,
        "ShippedDate":null,
        "SalesTaxRate1":null,
        "InvTxMeth":null
    },
    "POLineItemID":23161,
    "POLineSegmentIDs": [25160,154478]
}

Response Information

Returns a result object with how many records are succeeded (RecordsAffected), a success or failure message (Message) and list of JSON objects (Details)

Property Type Description
ID Integer PO line item segment identifier.
Succeeded Boolean Indicates if the item is copied successfully.
ErrorMessage String Description of error
ErrorCode Integer Error code
AdditionalInfo String PO line item's line number
Example
application/json, text/json
{
 "RecordsAffected": 1,
  "Message": "Copying was completed successfully.",
  "Details": [
    {
      "Id": 25160,
      "Succeeded": true,
      "ErrorMessage": null,
      "ErrorCode": 0,
      "AdditionalInfo": "1"
    },
    {
      "Id": 154478,
      "Succeeded": false,
      "ErrorMessage": "Copy failed. PO line segment 154478 does not belong to purchase order line 23161.",
      "ErrorCode": 60055,
      "AdditionalInfo": "1"
    }
  ]
}

HTTP Response Codes

Code Description
200 OK. Success
400 FAILURE.
  • Bad request
  • Failed to create invoice
  • Invalid invoice ID
  • Invalid poline item ID
404 FAILURE.
  • Invoice not found
  • Purchase order line item not found

Required Permissions

Permission IDs found here.

    CR_AccessAcquisitions_Allow (),
    CR_Invoices_Access (based on owner ID),
    CR_Invoices_Create (0),
    CR_Invoices_Modify ()