API - Sales Agreements


Overview

The table behind this API page is the one that contains the sales agreements in Wisefish, often called “Sales Orders” but are not the same as the Sales Orders in standard Business Central. The sales agreements are mainly used as Delivery Agreements. The endpoint also contains Blanket Sales Agreements.

There are 3 endpoints with same properties, but a different fixed filter on Status and can give access to different procedures:

  1. Endpoint salesAgreements shows both open and posted agreements.

  2. Agreements which are open for changes, because the posting document has not been created: openSalesAgreements

  3. Closed agreements. These are non-editable, because the posting document has been created: closedSalesAgreements

Endpoint names

salesAgreements

openSalesAgreements

closedSalesAgreements

Source table

"WiFi Sales Agreement Header"

Fixed view

salesAgreements: Document Type Delivery or Blanket, all statuses.

openSalesAgreements: Document Type Delivery or Blanket and Status Open, Released, Partly Delivered or Fully Delivered.

closedSalesAgreements: Document Type Delivery or Blanket and Status Posting or Closed.

All three endpoints are sorted by documentNo in descending order.

Requests allowed

GET, POST, PATCH, DELETE - for salesAgreements and openSalesAgreements

GET for closedSalesAgreements

Primary key

documentType, documentNo

Record ID

systemId

Child objects

Available with $expand: salesAgreementLines and extendedTexts (see Extended Texts under Data).

pdfDocument: not available (see PDF Document under Data).

salesAgreementLines:

API - Sales Agreement Lines

Procedures

salesAgreements: release, reOpen, createPostingDocument, setQuantityAsReserved, createPostingDocumentAndPostShipment, setReadyToBeInvoiced, AddNote, AddNoteFromUser

openSalesAgreements: release, reOpen, setQuantityAsReserved, createPostingDocument, createPostingDocumentAndPostShipment

closedSalesAgreements: none

Not available (there is no such procedure in the code): receiveItems

The three endpoints do not have exactly the same property list: shippingReferenceType and invoicingStatus are only on salesAgreements, and noOfTradeItemsReserved and noOfPalletsReserved are not on closedSalesAgreements. On closedSalesAgreements the lines (salesAgreementLines) are read-only. See the Field List below.


Data

Field List

The tags show which properties can be given in POST and PATCH requests on salesAgreements and openSalesAgreements. On closedSalesAgreements (GET only) all properties are read-only.

1

Property

Type

Format

Description


2

systemId

string

uuid

The record ID must be used when reading only one entry or when using procedures on the endpoint.

Record ID

non-editable

3

documentType

string

enum

Options are: Blanket, Delivery

Delivery is the default value when the property is skipped.

See Wisefish documentation to understand the difference.

primary key

optional

4

documentNo

string

max 20

The unique id within each documentType

This is the most commonly used reference for a sales document. It often starts with a “DA” to relate to a “Delivery Agreement”.

primary key

non-editable

5

orderDate

string

date

Order date, will be set by default but can be changed.

optional

6

salesPersonCode

string

max 20

The salesperson code.

optional

7

externalDocumentNo

string

max 35

Use to make a reference to external documents, such as the customer order.

optional

8

status

string

enum

Options: Open, Released, Pending Approval, Pending Prepayment, Proforma, Posting, Closed, Fully Delivered, Partly Delivered, Cancelled, Rejected, Pending Acceptance, Accepted. In JSON a space in the value is written as _x0020_, e.g. Partly_x0020_Delivered (in Business Central the captions of Fully Delivered and Partly Delivered are “Fully Finalized” and “Partly Finalized”). The endpoint decides which statuses are shown, see Fixed view.

Released documents are mostly un-editable. A procedure must be used to release a document.

non-editable

9

sellToCustomerNo

string

max 20

The number of the customer, this field has table relation to the Customer table.

mandatory

10

sellToCustomerName

string

max 100

Customer info, default value from the Customer

optional

11

sellToAddress

string

max 100

Customer info, default value from the Customer

optional

12

sellToPostCode

string

max 20

Customer info, default value from the Customer

optional

13

sellToCity

string

max 30

Customer info, default value from the Customer

optional

14

sellToCountryRegion

string

max 10

Customer info, default value from the Customer

optional

15

sellToContact

string

max 100

Customer info, default value from the Customer

optional

16

yourReference

string

max 35

Field used for some info that is relevant for the customer.

optional

17

languageCode

string

max 10

The language code of the customer. This can in some cases affect the language of printed documents.

optional

18

locationCode

string

max 10

From which Location the items will be taken.

optional

19

stockCenterCode

string

max 20

From which Stock Center the items will be taken.

optional

20

transportMethodCode

string

max 10

Shipping info

optional

21

shipmentMethod

string

max 10

Shipping info

optional

22

shipmentDate

string

date

Shipping info

optional

23

requestedDeliveryDate

string

date

Shipping info

optional

24

placeOfLoading

string

max 10

Shipping info - linked to table WiFi UN/LOCODE

optional

25

placeOfDischarge

string

max 10

Shipping info - linked to table WiFi UN/LOCODE

optional

26

placeOfDelivery

string

max 10

Shipping info - linked to table WiFi UN/LOCODE

optional

27

placeOfDestination

string

max 10

Shipping info - linked to table WiFi UN/LOCODE

optional

28

shippingAgent

string

max 10

Shipping info - field “Shipping Agent Code”

optional

29

shippingAgentService

string

max 10

Shipping info - field “Shipping Agent Service Code”

Note: on closedSalesAgreements this property shows the Shipping Agent Code (same value as shippingAgent), not the Shipping Agent Service Code.

optional

30

shippingReferenceType

string

enum

Shipping Reference Type. Options: (blank), AWB (Airway Bill), CONNOTE (Consignment Note).

Only on salesAgreements.

optional

31

shippingReferenceNo

string

max 20

Shipping info

optional

32

scheduledTripNo

string

max 20

The Scheduled Trip to use for this sales. Related to table “Scheduled Trip”.

optional

33

transportUnitId

number

integer

If only a specific transport has been designated for this sales. Related to table “Transport Unit”

optional

34

noOfTransportUnits

number

integer

Shows the number of transport units linked to the Scheduled Trip

non-editable

35

shipToCode

string

max 10

If the customer has multiple addresses, an address can be selected from that list and this field will contain the Code of that address entry in the Ship-to Address list.

optional

36

shipToName

string

max 100

Ship-to information

optional

37

shipToName2

string

max 50

Ship-to information

optional

38

shipToAddress

string

max 100

Ship-to information

optional

39

shipToAddress2

string

max 50

Ship-to information

optional

40

shipToPostCode

string

max 20

Ship-to information

optional

41

shipToCity

string

max 30

Ship-to information

optional

42

shipToCounty

string

max 30

Ship-to information

optional

43

shipToCountry

string

max 10

Ship-to information

optional

44

shipToContact

string

max 100

Ship-to information

optional

45

amount

number

decimal

The total amount of the order

non-editable

46

currencyCode

string

max 10

Currency for the total amount

optional

47

postingDate

string

date

On which posting date it will be posted.

optional

48

billToCustomerNo

string

max 20

If should be billed to another customer, i.e. can be different from the sellToCustomerNo.

optional

49

billToCountryRegion

string

max 10

Country or region.

optional

50

paymentBankAccount

string

max 20

Payment bank account, this can be set as mandatory with a setting.

optional

51

invoicingStatus

string


Invoicing and Documentation Status, returned as text: the option caption (e.g. “Ready for Invoicing and Documentation”) in the language of the API user.

Can only be changed with the procedure setReadyToBeInvoiced.

Only on salesAgreements.

non-editable

52

noOfLines

number

integer

No. of lines on this agreement. This will be the number of child entries in salesAgreementLines

non-editable

53

noOfTradeItems

number

decimal

Total number of trade items to be sold.

non-editable

54

noOfTradeItemsReserved

number

decimal

Total number of trade items already reserved.

Not on closedSalesAgreements.

non-editable

55

noOfTradeItemsShipped

number

decimal

Total number of trade items already shipped.

non-editable

56

noOfPalletsReserved

number

integer

Total number of pallets reserved. Trade items do not necessarily belong to a pallet.

Not on closedSalesAgreements.

non-editable

57

salesAgreementLines

array

json

The lines of the agreement. Can be added as a child array with ?$expand=salesAgreementLines. See API - Sales Agreement Lines


58

extendedTexts

array

json

Array of object extendedText (see Extended Texts below). Can be added as a child array with ?$expand=extendedTexts.


59

systemRowVersion

number

integer

System row version. Increments every time the record is modified.

non-editable

60

lastModified

string

date-time

SystemModifiedAt (date and time of last change)

non-editable

61

modifiedByUser

string

max 50

The user who last modified the record

non-editable

Object Example

JSON
{
    "systemId": "db17585a-4eab-f011-b028-e5231dc67468",
    "documentType": "Delivery",
    "documentNo": "DS-034",
    "orderDate": "2026-01-22",
    "salesPersonCode": "JR",
    "externalDocumentNo": "",
    "status": "Open",
    "sellToCustomerNo": "01905899",
    "sellToCustomerName": "Elkhorn Airport",
    "sellToAddress": "105 Buffalo Dr.",
    "sellToPostCode": "CA-MB R0M 0N0",
    "sellToCity": "Elkhorn",
    "sellToCountryRegion": "CA",
    "sellToContact": "Mr. Ryan Danner",
    "yourReference": "",
    "languageCode": "ENC",
    "locationCode": "BLUE",
    "stockCenterCode": "OWN",
    "transportMethodCode": "",
    "shipmentMethod": "EXW",
    "shipmentDate": "2026-01-22",
    "requestedDeliveryDate": "2026-01-22",
    "placeOfLoading": "",
    "placeOfDischarge": "",
    "placeOfDelivery": "",
    "placeOfDestination": "",
    "shippingAgent": "",
    "shippingAgentService": "",
    "shippingReferenceType": "_x0020_",
    "shippingReferenceNo": "",
    "scheduledTripNo": "",
    "transportUnitId": 0,
    "noOfTransportUnits": 0,
    "shipToCode": "",
    "shipToName": "Elkhorn Airport",
    "shipToName2": "",
    "shipToAddress": "105 Buffalo Dr.",
    "shipToAddress2": "",
    "shipToPostCode": "CA-MB R0M 0N0",
    "shipToCity": "Elkhorn",
    "shipToCounty": "",
    "shipToCountry": "CA",
    "shipToContact": "Mr. Ryan Danner",
    "amount": 31351.86,
    "currencyCode": "CAD",
    "postingDate": "2026-01-22",
    "billToCustomerNo": "01905899",
    "billToCountryRegion": "CA",
    "paymentBankAccount": "",
    "invoicingStatus": "Unavailable for Invoicing and Documentation",
    "noOfLines": 0,
    "noOfTradeItems": 1706,
    "noOfTradeItemsReserved": 1726,
    "noOfTradeItemsShipped": 0,
    "noOfPalletsReserved": 12,
    "systemRowVersion": 2583127,
    "lastModified": "2025-10-29T11:55:38.107Z",
    "modifiedByUser": ""
}

Extended Texts

The child array extendedTexts (object extendedText, page WiFiAPIs ExtendedText) contains the extended texts of the agreement, from table WiFi Document Ext. Text. It has no page of its own in this space and is only available with $expand=extendedTexts on all three endpoints. Extended texts can be added and changed, but not deleted (DeleteAllowed = false).

The link to the agreement is only on documentNo (not on the document type), so extended texts of other document types with the same document no. are also shown.

Property

Type

Format

Description


systemId

string

uuid

SystemId. The Record ID of the extended text.

Record ID

non-editable

documentType

string

enum

Document Type. Options: Delivery_x0020_Agreement, Purchase_x0020_Agreement, Sales_x0020_Order, Sales_x0020_Invoice, Posted_x0020_Sales_x0020_Invoice, Purchase_x0020_Order, Purchase_x0020_Invoice, Posted_x0020_Purchase_x0020_Invoice, Export, Sales_x0020_Cr._x0020_Memo, Posted_x0020_Sales_x0020_Cr._x0020_Memo, Purchase_x0020_Cr._x0020_Memo, Posted_x0020_Purchase_x0020_Cr._x0020_Memo, Quote_x0020_Sales_x0020_Agreement, Quote_x0020_Purchase_x0020_Agreement. For a sales agreement it is Delivery_x0020_Agreement (the default).

primary key

optional

documentNo

string

max 20

Document No. (the documentNo of the agreement; set automatically from the agreement)

primary key

optional

lineNo

number

integer

Line No.

primary key

optional

extendedText

string

max 100

Extended Text

optional

concatenateLine

boolean


Concatenate Line (field 8, caption “Concatenate Lines”)

optional

concatenateLines

boolean


Concatenate Lines (field 7)

optional

systemRowVersion

number

integer

System row version. Increments every time the record is modified.

non-editable

lastModified

string

date-time

SystemModifiedAt (date and time of last change)

non-editable

modifiedByUser

string

max 50

The user who last modified the record

non-editable


PDF Document

The code of closedSalesAgreements contains a child object pdfDocument (page WiFiXX PDF Document, one PDF document per agreement, linked on the systemId of the agreement), but it is commented out, so pdfDocument is not available on any of the endpoints and $expand=pdfDocument returns an error. The page WiFiXX PDF Document does not exist in the Wisefish APIs code.


Procedures

  • Only the open sales agreements can be changed, so if trying to run some procedures on closed agreements an error will be returned which is correct.

  • The record Id of the entry must be known in order to use procedures

  • The URL will be: [server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.[procedureName]

  • Procedures are available on salesAgreements and openSalesAgreements. The endpoint closedSalesAgreements has no procedures.

In general, if the request is successful, the response is 200 OK and could also possibly contain something in the value property:

{
    "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/b33a6a3b-244c-4295-84b3-0ad90823c736/AB_Test_191125/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Success"
}

Procedure names and parameter names are case-sensitive (e.g. reOpen, AddNote). Each procedure returns a text message in the value property of the response on success. On failure it returns an error with a readable message.

Procedure

Parameters

Description

Details

release

none

Release the agreement, same as the Release button in Business Central. Also on openSalesAgreements.

Show more

reOpen

none

Reopen a released agreement so it can be changed. Also on openSalesAgreements.

Show more

createPostingDocument

none

Create the posting document (Sales Order or Sales Invoice) for the agreement. Also on openSalesAgreements.

Show more

setQuantityAsReserved

none

Set the quantity of all item lines to the reserved quantity. Also on openSalesAgreements.

Show more

createPostingDocumentAndPostShipment

none

Create a Sales Order for the agreement and post it. Also on openSalesAgreements.

Show more

setReadyToBeInvoiced

none

Set the invoicing status of a released agreement to Ready. Only on salesAgreements.

Show more

AddNote

noteText (text, max 250)

Add a note to the agreement. The note is registered as from the API user. Only on salesAgreements.

Show more

AddNoteFromUser

noteText (text, max 250), fromUser (code, max 50)

Add a note to the agreement, registered as from the given Business Central user. The user must exist in User Setup. Only on salesAgreements.

Show more


Procedures on salesAgreements

All procedures below are available on salesAgreements. The ones that are also available on openSalesAgreements are marked so in the table above. The URLs may use either of the two endpoints.

Release

This will release the agreement, same as clicking on the Release button within BC.

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.release

(no parameters)

After a successful request:

  • The Status becomes Released.

The value property of the response is Agreement has been released.

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • The status of the agreement is not Open (standard Business Central error from TestField: Status must be equal to Open).

  • Errors from the Wisefish release of the agreement, i.e. the same checks as when the agreement is released in Business Central.


Reopen

If an already released agreement needs to be reopened, in order to do some changes.

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.reOpen

(no parameters)

After a successful request:

  • The Status becomes Open.

The value property of the response is Agreement has been reopened.

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • The status of the agreement is not Released (standard Business Central error from TestField: Status must be equal to Released).

  • Errors from the Wisefish reopening of the agreement.

Behaviour notes:

  • The procedure name is reOpen (capital O). Microsoft.NAV.reopen is not found.


Create Posting Document

When all lines have been registered on the sales agreement, the posting document can be created, i.e. either a Sales Order or a Sales Invoice. Before this is run, the agreement must be released.

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])
  /openSalesAgreements([record-id])/Microsoft.NAV.createPostingDocument

(no parameters)

After a successful request:

  • A standard BC posting document (Sales Order or Sales Invoice, depends on settings) has been created for the agreement.

The value property of the response is Sales document <Document Type> <No.> created..

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • Sales document was not created (when no sales document was created, e.g. when the field Sales Document Type on the agreement is not Order or Invoice)

  • Errors from the Wisefish creation of the sales document.

Behaviour notes:

  • The field Sales Document Type on the agreement decides which document is created: Order creates a Sales Order, Invoice creates a Sales Invoice.

  • The API code does not check the status of the agreement before calling Wisefish; status requirements come from the Wisefish document creation.

  • The <Document Type> in the response is the caption of the document type (e.g. Order) in the language of the API user.


Set Quantity as Reserved

Sets the quantity on all item lines of the agreement to the quantity that has been reserved, e.g. after pallets or trade items have been reserved to the agreement.

JSON
POST
.../salesAgreements([record-id])/Microsoft.NAV.setQuantityAsReserved

(no parameters)

After a successful request:

  • The quantity on every line of type Item (with an item no.) has been synchronized to the reserved quantity.

The value property of the response is Quantity in all lines has been set the same as reserved quantity..

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • Cannot modify quantity for a closed sales agreement! (when the status is Closed; this can only happen on salesAgreements)

  • Errors from the Wisefish synchronization of the line quantity, or from modifying the lines.

Behaviour notes:

  • If the agreement is Released, the status is set to Open while the lines are changed and back to Released afterwards. This is done directly on the status field, the Wisefish release/reopen logic is not run.

  • Lines of other types than Item, and lines without an item no., are skipped.

  • Only the status Closed is rejected; agreements with status Posting are not blocked by the API code.


Create Posting Document and Post Shipment

This method can be used if the API user is allowed to both create the posting document and then immediately post the items out of inventory.

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])
  /openSalesAgreements([record-id])/Microsoft.NAV.createPostingDocumentAndPostShipment

(no parameters)

This method does both:

  • Creates a Sales Order for the agreement.

  • The sales order is posted with both the “Ship” and the “Invoice” options, which means that items are removed from stock and the invoice is posted at the same time.

The value property of the response is Sales order <No.> created and shipment posted successfully..

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • Sales document was not created (when no sales document was created)

  • This function only supports Sales Orders! (when the field Sales Document Type on the agreement is Invoice, i.e. a Sales Invoice would be created)

  • Errors from the Wisefish creation of the sales document.

  • Errors from the standard Business Central posting of the sales order (Sales-Post).

Behaviour notes:

  • The whole request is one transaction: if an error occurs, nothing is created or posted (the created sales document is rolled back).

  • The <No.> in the response is the number of the sales order that was created and posted.


Set Ready to Be Invoiced

Sets the invoicing status (invoicingStatus) of a released agreement to Ready. This must be done after the agreement has been released. Only available on salesAgreements.

JSON
POST
.../salesAgreements([record-id])/Microsoft.NAV.setReadyToBeInvoiced

(no parameters)

After a successful request:

  • The Invoicing Status becomes Ready (invoicingStatus shows “Ready for Invoicing and Documentation”).

The value property of the response is Invoicing status set to Ready.

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • The status of the agreement is not Released (standard Business Central error from TestField: Status must be equal to Released).

Behaviour notes:

  • The current invoicing status is not checked, the status is set to Ready whatever it was before.

  • The field is changed directly, without running the validation or modify triggers.


Add Note

The procedure AddNote adds a note to the sales agreement. The note is a Business Central Note record link with the description “Sent through API”, and it is registered as from the API user (the user making the call). Only available on salesAgreements.

JSON
POST
.../salesAgreements([record-id])/Microsoft.NAV.AddNote

Body:
{
    "noteText": [the text of the note]
}

Parameters

Type

Max Len

Description


noteText

string

250

The text of the note.

mandatory

A note is added to the sales agreement, and the value property of the response is Note successfully added.

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • noteText is longer than 250 characters (standard Business Central error, the text exceeds the parameter length).

Behaviour notes:

  • The note text is not validated: an empty noteText is not rejected, an empty note is added.

  • The note is a Note type record link with the description “Sent through API”, created with the current date and time.

Notes can be read with the Record Notes API, see API - Record Notes in this space.


Add Note from a User

The procedure AddNoteFromUser works the same way as AddNote, but the note is registered as from the given Business Central user instead of the API user. Only available on salesAgreements.

JSON
POST
.../salesAgreements([record-id])/Microsoft.NAV.AddNoteFromUser

Body:
{
    "noteText": [the text of the note],
    "fromUser": [the BC user ID the note is registered from]
}

Parameters

Type

Max Len

Description


noteText

string

250

The text of the note.

mandatory

fromUser

string

50

The BC user ID the note is registered from. The user must exist in User Setup, otherwise the call fails with the error “User with ID X does not exist”.

mandatory

A note is added to the sales agreement, and the value property of the response is Note successfully added and registered from user <fromUser>.

Possible errors:

  • The agreement does not exist (standard Business Central error, record not found).

  • A parameter is longer than its maximum length (standard Business Central error, the text exceeds the parameter length).

  • User with ID <fromUser> does not exist (when fromUser is not found in User Setup)

Behaviour notes:

  • fromUser is a code parameter, so the value is converted to upper case: "john" is registered and returned as JOHN.

  • If fromUser is empty, no user check is made and the note is registered as from the API user (same as AddNote), but the response text then ends with an empty user ID: Note successfully added and registered from user .

  • The note text is not validated: an empty noteText is not rejected.


Procedures on openSalesAgreements

The endpoint openSalesAgreements has the procedures release, reOpen, setQuantityAsReserved, createPostingDocument and createPostingDocumentAndPostShipment. They run exactly the same code as on salesAgreements, see Release, Reopen, Set Quantity as Reserved, Create Posting Document and Create Posting Document and Post Shipment above. Only the endpoint in the URL differs:

JSON
POST
[server]/api/wisefish/base/v1.0/companies([CompanyGUID])/openSalesAgreements([record-id])/Microsoft.NAV.[procedureName]

Because of the fixed filter on Status, the procedures can only be called on agreements with the status Open, Released, Partly Delivered or Fully Delivered; other agreements are not found. setReadyToBeInvoiced, AddNote and AddNoteFromUser are not available on this endpoint.


Procedures on closedSalesAgreements

The endpoint closedSalesAgreements is read-only and has no procedures.


Examples

Read sales agreements

Read the open agreements of a customer

Reads all open agreements (status Open, Released, Partly Delivered or Fully Delivered) for customer 01905899. The response is a list of agreement objects, as shown in Object Example.

JSON
GET .../openSalesAgreements?$filter=sellToCustomerNo eq '01905899'

Read released agreements with selected properties

Reads the released agreements, and returns only a few properties with $select.

Request:

JSON
GET .../salesAgreements?$filter=status eq 'Released'&$select=documentNo,sellToCustomerNo,shipmentDate,amount

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/salesAgreements(documentNo,sellToCustomerNo,shipmentDate,amount)",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzE0Njc0NjI1MTg3MTc1MjQzNTY1MTswMDsn\"",
            "documentNo": "DS-035",
            "sellToCustomerNo": "01905899",
            "shipmentDate": "2026-01-29",
            "amount": 18240.5
        }
    ]
}

Read one agreement with lines

Reading one entry of this table must be done with the record Id which is in this case the systemId.

Lines are shown by adding to the URL $expand=salesAgreementLines

GET ... salesAgreements([system-id])?$expand=salesAgreementLines


Expand to see the example json

An example of a response:

JSON
GET ... salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)?$expand=salesAgreementLines

{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/salesAgreements",
    "value": [
        {
            "@odata.etag": "W/\"JzIwOzE0Njc0NjI1MTg3MTc1MjQzNTY1MTswMDsn\"",
            "systemId": "db17585a-4eab-f011-b028-e5231dc67468",
            "documentType": "Delivery",
            "documentNo": "DS-034",
            "orderDate": "2026-01-22",
            "salesPersonCode": "JR",
            "externalDocumentNo": "",
            "status": "Open",
            "sellToCustomerNo": "01905899",
            "sellToCustomerName": "Elkhorn Airport",
            "sellToAddress": "105 Buffalo Dr.",
            "sellToPostCode": "CA-MB R0M 0N0",
            "sellToCity": "Elkhorn",
            "sellToCountryRegion": "CA",
            "sellToContact": "Mr. Ryan Danner",
            "yourReference": "",
            "languageCode": "ENC",
            "locationCode": "BLUE",
            "stockCenterCode": "OWN",
            "transportMethodCode": "",
            "shipmentMethod": "EXW",
            "shipmentDate": "2026-01-22",
            "requestedDeliveryDate": "2026-01-22",
            "placeOfLoading": "",
            "placeOfDischarge": "",
            "placeOfDelivery": "",
            "placeOfDestination": "",
            "shippingAgent": "",
            "shippingAgentService": "",
            "shippingReferenceType": "_x0020_",
            "shippingReferenceNo": "",
            "scheduledTripNo": "",
            "transportUnitId": 0,
            "noOfTransportUnits": 0,
            "shipToCode": "",
            "shipToName": "Elkhorn Airport",
            "shipToName2": "",
            "shipToAddress": "105 Buffalo Dr.",
            "shipToAddress2": "",
            "shipToPostCode": "CA-MB R0M 0N0",
            "shipToCity": "Elkhorn",
            "shipToCounty": "",
            "shipToCountry": "CA",
            "shipToContact": "Mr. Ryan Danner",
            "amount": 31351.86,
            "currencyCode": "CAD",
            "postingDate": "2026-01-22",
            "billToCustomerNo": "01905899",
            "billToCountryRegion": "CA",
            "paymentBankAccount": "",
            "invoicingStatus": "Unavailable for Invoicing and Documentation",
            "noOfLines": 0,
            "noOfTradeItems": 1706,
            "noOfTradeItemsReserved": 1726,
            "noOfTradeItemsShipped": 0,
            "noOfPalletsReserved": 12,
            "systemRowVersion": 2583127,
            "lastModified": "2025-10-29T11:55:38.107Z",
            "modifiedByUser": "",
            "salesAgreementLines": [
                {
                    "@odata.etag": "W/\"JzE5OzUzOTcwNzA0OTkxNTcwMDI1ODIxOzAwOyc=\"",
                    "systemId": "6cdaab72-80af-f011-b028-99c8bc4e8b83",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 50000,
                    "type": "Item",
                    "itemNo": "70064",
                    "description": "Cod - raw material",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 1100,
                    "tradeItemUnit": "KG",
                    "quantity": 1100,
                    "unitOfMeasureCode": "KG",
                    "quantityBase": 1100,
                    "noOfPallets": 4.4,
                    "unitPrice": 12,
                    "purchPriceToVendor": 0,
                    "lineAmount": 13200,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 13200,
                    "vat": 0,
                    "amountIncludingVAT": 13200,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 1,
                    "netWeightBWU": 1100,
                    "lastModified": "2025-12-07T09:14:20.323Z"
                },
                {
                    "@odata.etag": "W/\"JzIwOzE0NTI4MDI2MDc2NzYyMzU0Mjc0MTswMDsn\"",
                    "systemId": "de661423-7eaf-f011-b028-99c8bc4e8b83",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 40000,
                    "type": "Item",
                    "itemNo": "70065",
                    "description": "Fiskinaggar ",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 60,
                    "tradeItemUnit": "PACK",
                    "quantity": 600,
                    "unitOfMeasureCode": "PCS",
                    "quantityBase": 600,
                    "noOfPallets": 0,
                    "unitPrice": 23.153,
                    "purchPriceToVendor": 0,
                    "lineAmount": 13891.8,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 13891.8,
                    "vat": 0,
                    "amountIncludingVAT": 13891.8,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 5,
                    "netWeightBWU": 3000,
                    "lastModified": "2025-10-28T09:30:22.037Z"
                },
                {
                    "@odata.etag": "W/\"JzIwOzEzMDk3OTUxNTU1NTc2NTExMzM4MTswMDsn\"",
                    "systemId": "ee6619e4-66af-f011-b028-99c8bc4e8b83",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 30000,
                    "type": "Item",
                    "itemNo": "0900",
                    "description": "Þorskflök",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 0,
                    "tradeItemUnit": "BOX",
                    "quantity": 0,
                    "unitOfMeasureCode": "KG",
                    "quantityBase": 0,
                    "noOfPallets": 0,
                    "unitPrice": 17.365,
                    "purchPriceToVendor": 0,
                    "lineAmount": 0,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 0,
                    "vat": 0,
                    "amountIncludingVAT": 0,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 1,
                    "netWeightBWU": 0,
                    "lastModified": "2025-10-28T09:30:22.033Z"
                },
                {
                    "@odata.etag": "W/\"JzE5Ozk1MDA1MzM4ODI5MTk0NTk3NzQxOzAwOyc=\"",
                    "systemId": "dcdc0f4c-a1ad-f011-b028-a35a9231a4e1",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 20000,
                    "type": "Item",
                    "itemNo": "70079",
                    "description": "Cod fillets (3 kg box)",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 86,
                    "tradeItemUnit": "BOX",
                    "quantity": 86,
                    "unitOfMeasureCode": "BOX",
                    "quantityBase": 258,
                    "noOfPallets": 3.58333333333333333,
                    "unitPrice": 0,
                    "purchPriceToVendor": 0,
                    "lineAmount": 0,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 0,
                    "vat": 0,
                    "amountIncludingVAT": 0,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 3,
                    "netWeightBWU": 258,
                    "lastModified": "2025-10-29T13:57:59.087Z"
                },
                {
                    "@odata.etag": "W/\"JzE5OzQ1ODI2MDIxNDExNjU2NzQ1NDAxOzAwOyc=\"",
                    "systemId": "03591d61-4eab-f011-b028-e5231dc67468",
                    "documentType": "Delivery",
                    "documentNo": "DS-034",
                    "lineNo": 10000,
                    "type": "Item",
                    "itemNo": "70066",
                    "description": "Fish junk (fiskimauk í nagga)",
                    "locationCode": "BLUE",
                    "stockCenterCode": "",
                    "lotFilter": "",
                    "lotFilterOriginal": "",
                    "noOfTradeItems": 460,
                    "tradeItemUnit": "KG",
                    "quantity": 460,
                    "unitOfMeasureCode": "KG",
                    "quantityBase": 460,
                    "noOfPallets": 1.84,
                    "unitPrice": 9.261,
                    "purchPriceToVendor": 0,
                    "lineAmount": 4260.06,
                    "lineDiscount": 0,
                    "lineDiscountAmount": 0,
                    "amount": 4260.06,
                    "vat": 0,
                    "amountIncludingVAT": 4260.06,
                    "vendorNo": "",
                    "externalProducer": "",
                    "netWeight": 1,
                    "netWeightBWU": 460,
                    "lastModified": "2025-10-20T10:41:05.663Z"
                }
            ]
        }
    ]
}


Read an agreement with its extended texts

Adds the extended texts of agreement DS-034 to the response with $expand=extendedTexts (the agreement properties are shortened here).

Request:

JSON
GET .../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)?$expand=extendedTexts

Response (shortened):

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/salesAgreements(extendedTexts())/$entity",
    "systemId": "db17585a-4eab-f011-b028-e5231dc67468",
    "documentType": "Delivery",
    "documentNo": "DS-034",
    "extendedTexts": [
        {
            "@odata.etag": "W/\"JzE5OzEyMzQ1Njc4OTAxMjM0NTY3ODkwOzAwOyc=\"",
            "systemId": "5e0c7a21-4fb0-f011-b028-99c8bc4e8b83",
            "documentType": "Delivery_x0020_Agreement",
            "documentNo": "DS-034",
            "lineNo": 10000,
            "extendedText": "Deliver to gate 4, call before arrival",
            "concatenateLine": false,
            "concatenateLines": false,
            "systemRowVersion": 2583140,
            "lastModified": "2025-10-29T12:02:11.250Z",
            "modifiedByUser": ""
        }
    ]
}

Read closed agreements

Reads the closed agreements (status Posting or Closed) with posting date from 1 January 2026.

JSON
GET .../closedSalesAgreements?$filter=postingDate ge 2026-01-01


Create, change and delete agreements

Create an agreement with lines

JSON
POST .../openSalesAgreements?$expand=salesAgreementLines

Body:

{
    "orderDate": "2025-12-07",
    "sellToCustomerNo": "4203690429",
    "locationCode": "001",
    "externalDocumentNo": "ORD-0123",
    "salesAgreementLines": [
        {
            "itemNo": "ZZZ1003",
            "noOfTradeItems": 2,
            "tradeItemUnitOfMeasure": "kassi",
            "unitPrice": 10.0
        }
    ]
}

The response contains the new entry, both header and lines.

Change an agreement

Changes the external document no. and the requested delivery date of agreement DS-034. A PATCH request needs the If-Match header with the @odata.etag of the record (or *).

Request:

JSON
PATCH .../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)
If-Match: *

Body:
{
    "externalDocumentNo": "ORD-0124",
    "requestedDeliveryDate": "2026-01-25"
}

Response (shortened):

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#companies(cf9f7b85-dd11-ef11-9f8b-6045bde9cc61)/openSalesAgreements/$entity",
    "@odata.etag": "W/\"JzIwOzE1MDE4MjM0NTY3ODkwMTIzNDU2MTswMDsn\"",
    "systemId": "db17585a-4eab-f011-b028-e5231dc67468",
    "documentType": "Delivery",
    "documentNo": "DS-034",
    "externalDocumentNo": "ORD-0124",
    "status": "Open",
    "requestedDeliveryDate": "2026-01-25",
    "systemRowVersion": 2583201,
    "lastModified": "2025-10-30T08:14:52.410Z",
    "modifiedByUser": ""
}

Delete an agreement

Deletes agreement DS-034. The same checks apply as when an agreement is deleted in Business Central. On success the response is empty (HTTP status 204 No Content).

JSON
DELETE .../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)


Change the status

Release an agreement

Releases agreement DS-034 using release.

Request:

JSON
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.release

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Agreement has been released"
}

Reopen an agreement

Reopens the released agreement DS-034 using reOpen.

Request:

JSON
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.reOpen

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Agreement has been reopened"
}

Set an agreement ready to be invoiced

Sets the invoicing status of the released agreement DS-034 to Ready using setReadyToBeInvoiced (only on salesAgreements).

Request:

JSON
POST
.../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.setReadyToBeInvoiced

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Invoicing status set to Ready"
}

Release an agreement that is already released

Calls release on an agreement that is already released; the call fails (the error message is shortened).

Response:

JSON
{
    "error": {
        "code": "Internal_TestFieldError",
        "message": "Status must be equal to 'Open'  in Sales Agreement Header: Document Type=Delivery, No.=DS-034. Current value is 'Released'."
    }
}


Reservation and posting

Set the quantity of all lines as reserved

Sets the quantity on all item lines of agreement DS-034 to the reserved quantity using setQuantityAsReserved.

Request:

JSON
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.setQuantityAsReserved

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Quantity in all lines has been set the same as reserved quantity."
}

Create the posting document for an agreement

Creates the posting document for the released agreement DS-034 using createPostingDocument; here the agreement creates a Sales Order.

Request:

JSON
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.createPostingDocument

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Sales document Order 101005 created."
}

Create the sales order and post it

Creates a Sales Order for agreement DS-034 and posts it using createPostingDocumentAndPostShipment.

Request:

JSON
POST
.../openSalesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.createPostingDocumentAndPostShipment

(no parameters)

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Sales order 101006 created and shipment posted successfully."
}


Add notes

Add a Note to a Sales Agreement

Adds the note “Customer asked for early delivery” to agreement DS-034 with AddNote; the note is registered as from the API user.

Request:

JSON
POST
.../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.AddNote

{
    "noteText": "Customer asked for early delivery"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Note successfully added"
}

Add a Note to a Sales Agreement from a specific User

Adds the same note to agreement DS-034 with AddNoteFromUser, registered as from user JOHN.

Request:

JSON
POST
.../salesAgreements(db17585a-4eab-f011-b028-e5231dc67468)/Microsoft.NAV.AddNoteFromUser

{
    "noteText": "Customer asked for early delivery",
    "fromUser": "JOHN"
}

Response:

JSON
{
    "@odata.context": "https://containers.wisefish.com/BC/api/wisefish/base/v1.0/$metadata#Edm.String",
    "value": "Note successfully added and registered from user JOHN"
}