List of available APIs
Supported methods for Basware API
Usage Scenario 1: Import master data
Usage Scenario 2: Import external purchase orders for Matching
Usage Scenario 3: Prebook and transfer invoices to accounting
Usage Scenario 4: Import and export procurement data
Usage scenario 5: Error handling and monitoring
Authentication and access rights
API response codes
Fair use practices
The purpose of this manual is to describe Basware API integration capabilities for Master data imports and Purchase-to-Pay integration scenarios. It contains process-level instructions, end-to-end data flows, as well as recommended practices for implementation and debugging.
Basware API is a REST API available through web service calls. JSON data format is used in the message payloads.
Basware API integrations are available for the following Basware end-systems.
- Basware Network
- Basware Purchase-to-Pay
- Basware Supplier Management
P2P APIs are available through the following regions: Europe (EU), USA (US) and Australia (AU). APIs will be set up in the same region as your P2P system. Separate environments are available for test and production systems.
List of available Purchase-to-Pay APIs
The following APIs are available for transferring invoices to accounting, importing master data, user data and external purchase orders for invoice matching, as well as for importing and exporting data to and from P2P Purchase.
|Importing master data||Available Basware systems
|AdvancedValidations||Import invoice coding row validation rules from ERP||P2P|
|Accounts||Import accounts from ERP||P2P|
|CostCenters||Import cost centers from ERP||P2P|
|ExchangeRates||Import exchange rates from ERP||P2P|
|GenericLists||Import additional coding dimensions from ERP||P2P|
|PaymentTerms||Import payment terms from ERP||P2P|
|Projects||Import projects from ERP||P2P|
|TaxCodes||Import tax codes from ERP||P2P|
|Vendors||Import vendors from ERP||P2P, Supplier Management|
|Importing user master data|
P2P, Supplier Portal, Supplier Management, Reporting [Q4/2020]
|AdvancedPermissions||Import user approval rights -information||P2P|
|Importing external purchase orders for invoice matching|
|MatchingOrders||Import order header data into matching||P2P (AP Automation)|
|MatchingOrderLines||Import and update order lines and goods receipts into matching||P2P (AP Automation)|
|Importing and exporting procurement data for P2P Purchase|
|PurchaseRequisitions||Import purchase requisitions to P2P Purchase from an external system||P2P (Purchase)|
|PurchaseOrders (Q3/2020)||Import Purchase Orders to P2P Purchase from an external system||P2P (Purchase)|
|Goodsreceipts (Q3/2020)||Import goods receipts to P2P Purchase from an external system||P2P (Purchase)|
|Contracts||Import contract metadata to P2P Purchase from an external system||P2P (Purchase)|
|ExportedPurchaseOrders||Export purchase orders and GR's from P2P Purchase||P2P (Purchase)|
|ExportedPurchaseRequisitions ( Q4/2020)||Export purchase requisitions from P2P Purchase||P2P (Purchase)|
|Transferring approved invoices to accounting|
|AcccountingDocuments||Prebook invoices or transfer approved invoices to accounting system||P2P (AP Automation)|
|Acknowledge||Mark invoice as fetched||P2P (AP Automation)|
|PrebookResponse||Mark invoice as prebooked in accounting system||P2P (AP Automation)|
|TransferResponses||Mark invoice as transferred to accounting system||P2P (AP Automation)|
|PaymentResponses||Update invoice payment date||P2P (AP Automation)|
|Retrieving error messages from target systems|
|ErrorFeedbacks||Error handling. Returns errors asynchronously from Basware receiving systems.||P2P|
Supported methods for Basware APIs
API methods and fields
Detailed documentation for available methods and field sets for each API are described in the P2P API reference documentation.
Basware APIs support the following methods.
POST - Adds or updates records. Clears existing data from omitted fields
POST method updates the record based on externalCode -field. If no record is found with given externalCode, a new record is created. All fields are updated within the record. Existing data in fields is cleared before the update.
PATCH - Updates records. Preserves existing data in omitted fields
PATCH method updates the record based on externalCode -field. Difference to POST is that only fields included in the JSON in the request are updated. Data fields not explicitly included in the JSON request are left unchanged.
GET - Gets records from Basware API
GET method lists the records for a particular interface. Returned data contains all JSON fields and their values for the returned records. An externalCode can be specified as parameter to return data for only the specified record.
DELETE - Deletes records from Basware API
DELETE method deletes records from Basware API. The records are deleted from API only. To delete the records also from the data receiving Basware systems, use the data deletion mechanisms provided by each of the Basware receiving systems.
Data update scenarios
Below is an illustration of system behaviour in various data update scenarios.
Usage scenario 1: Import master data
Basware solutions require a set of master data that replicate the Customer’s business model in Basware. This data is required to enhance the processing of business documents and makes it possible to bring all, or suitable parts of the validation logic to the Basware.
As best practice, master data should be maintained in one central place. This data nearly always sits in an organization’s main ERP system. Basware API is designed for importing master data to Basware services from your central master data store(s). Master data can be made available in all supported Basware services.
Posting and updating basic records
The following diagram illustrates data flow for posting master data, such as basic data records and user data, to Basware API.
This is applicable for the following entity types (APIs): Accounts, AdvancedPermissions, AdvancedValidations, Contracts, CostCenters, ExchangeRates, GenericLists, PaymentTerms, Projects, PurchaseRequisitions, PurchaseOrders [Q3/2020], GoodsReceipts [Q3/2020] TaxCodes, Users, Vendors.
POST operation must be used when first sending the record to Basware API. Records can be updated using both POST and PATCH operations. Basware recommends using POST operation to also update the records for most cases. PATCH may be more suitable when, for example, the sending system provides only the changed fields within the modified record.
Note that GenericLists API can be used to populate several different lists. The list key needs to be specified as additional parameter for this API.
Usage scenario 2: Import external purchase orders for Order Matching
In order matching a purchase order, purchase order line, or a goods receipt is linked to an invoice or invoice line. Basware API supports importing external Purchase orders from customer systems to order matching. Purchase orders, purchase order lines and goods receipts can be imported and updated using Basware API.
These orders need to be fully processed, approved, and marked received in external systems. These orders are called matching orders and they are used only for automatic matching to received invoices. Creating, approving and sending orders can be also done in Basware P2P using "Purchase" -module, which has another set of APIs to integrate the purchasing -process with external purchasing systems (see section "Importing and exporting procurement data").
Posting and updating matching orders
The following diagram illustrates data flow for transferring and updating order data for use in invoice matching. Purchase orders from external systems are received through the MatchingOrders (order headers) and MatchingOrderLines (order lines and goods receipts) API entity types.
Order header needs to be received before the order lines are sent. Both order headers and order lines can be updated through API when they are changed, for example when changing requested delivery date or when items have been received.
Usage scenario 3: Prebook and transfer invoice to Accounting
Once an invoice has been approved in P2P, it is routed to AP/finance users for transfer to accounting. In this phase, the invoice and its coding data are transferred to an ERP system for payment. This phase can be configured to be completed automatically.
Prebooking invoices and transferring approved invoices to accounting
Prebooking and transferring invoices from Basware P2P to accounting use AccountingDocuments API. The progress of both activities is shown in 'ProcessignStatus' field.
Invoice is made available for transfer to accounting when it has been approved in Basware P2P. When an invoice is transferred in Basware P2P it becomes available for a GET operation in AccountingDocuments API with status 'WaitingForTransfer'. When a transfer succeeded message is received, invoice status in P2P is changed from “Transfer in progress” to “Processed”.
Invoice prebooking is an optional feature that can be enabled if required. In prebooking invoice data can be made available AccountingDocuments API before the invoice is approved. Prebooked invoices require a prebookeResponse -message from ERP system. When a prebooked invoice is approved in P2P it will be made available in the accountingDocuments API as an invoice 'WaitingForTransfer'. Invoices can can be sent for prebooking automatically based on configurable rules. Manual selection of invoices to be prebooked is not yet supported.
Invoice transfer consists of the following steps
- Get invoice data from the API for prebooking (processing status: WaitingForPrebook)
- Post technical acknowledgement (optional, processing status changed to: PrebookInProgress)
- Post prebook succeeded / failed message (processing status changed to: Prebooked, PrebookFailed)
- Get invoice data from API for transfer (processing status: WaitingForTransfer)
- Post technical acknowledgement (optional, processing status changed to: TransferInProgress)
- Post transfer succeeded / failed message (processing status changed to: Transferred or TransferFailed)
- Post payment information (optional, processing status changed to: Paid)
The following diagram illustrates the data flow for retrieving prebooked or approved invoices (AccountingDocuments) from Basware P2P to accounting and handling related response messages.
Usage scenario 4: Import and export procurement data
This set of APIs is used to integrate Basware Purchase to external purchasing systems. These APIs are not used to import orders for matching. For matching please see Usage scenario 2: Import external purchase orders for Matching. Basware Purchase handles the procurement process, i.e. approving the order, sending it out to supplier, and creating the goods receipts. Orders created in Basware Purchase are automatically available for matching.
Procurement data integrations scenarios
- Purchase Requisitions can be created through several different methods in Basware Purchase. Basware API currently supports importing purchase requisition data as a draft to a specified owner. The imported data is prevalidated by Basware Purchase before the creation of the draft can start.
- Basware Purchase supports contract based purchasing. Contract metadata can be imported through Basware API.
- Orders and goods receipts can be exported from Basware Purchase. Whenever the order status changes, the data in API is also updated.
- Basware APIs for importing purchase orders, importing GRs and exporting purchase requisitions will be be released during 2020.
APIs for importing procurement data:
- purchaseOrders [Q3/2020]
- purchaseGoodsReceipts [Q3/2020]
Importing procurement data is done in similar manner as master data imports. See Usage scenario 1: Import Master data for more details.
APIs for exporting procurement data:
- exportedPurchaseRequisitions [Q4/2020]
Exporting procurement data is done in a similar manner to invoice transfer (Usage Scenario 3: Prebook and transfer invoices to Accounting). Exported data is made available in the exportedPurchaseOrders API from where it needs to be retrieved. Export is confirmed by sending an acknowledgement response. The acknowledgement response is mandatory. Orders which have been acknowledged are marked as 'Exported' and can be filtered out from the get next request.
Usage scenario 5: Error handling and monitoring
When using Basware API errors from data validation in are returned immediately in the API response. These are mainly errors resulting from data structure validation and simple validations on data values.
Sometimes errors may be occurring in the Basware receiving system that prevent data updates to the end system, Basware P2P for example. These are most commonly errors from additional validation performed in the receiving systems. These errors are not available immediately in the API response, due to asynchronous data distribution from API to Basware end system, but are made available in the Basware API through a separate ErrorFeedbacks API.
Retrieving error messages from errorFeedbacks API
In case an error occurs while using an API and error message is returned either in the API response message or through the ErrorFeedbacks API.
Errors from data validation in Basware API are returned immediately in the API response. These are mainly errors resulting from data structure validation and simple validations on data values.
Errors occurring when data is distributed from Basware API to the receiving Basware systems are returned asynchronously through the ErrorFeedbacks API. These include errors from validations performed in the receiving systems.
The following diagram illustrates data flow for receiving error messages.
Recommended practice is to query the errorFeedbacks -API using the timestamp of the last error that has been retrieved. This will return any new errors that have occurred since the last time errors have been fetched. Errors will become available in the API at the same time as the receiving Basware systems process data. Most requests will be processed within 30 seconds. If there is considerable load errorFeedbacks will be available only after the receiving Basware systems have finished processing the data.
Common considerations when using Basware API
Please take the following into account in order to achieve smoothly running integrations.
Records are identified for update based on ‘externalCode’ field value
ExternalCode field is present in all record types. This field is used to identify the record to be updated and must be unique per record within an interface (single Account, Cost Center, etc.). More specifically, if must be unique within an Entity Type (Accounts, CostCenters, etc).
Exception to this is GenericLists, where the externalCode must be unique within the target list (specified by the ‘listKey’ -parameter).
Maximum length of the externalCode is 36 characters – this needs to be maintained in cases where externalCode is concatenated from other key values, such as [companyCode]_[AccountCode]. The max length of these values combined must not exceed 36 characters.
Inactivating records is done by updating the record
Records are inactivated by updating the record with field ‘active’ = ‘false’. There is no explicit delete (or delete/insert) functionality.
Changed records are forwarded from Basware API to receiving Basware systems
To improve end-to-end integration throughput, received data is compared record-by-record to current data stored in the Basware API. Only records with changed data (compared to what is already in Basware API) are forwarded to receiving systems.
Basware API is primarily designed to receive incremental data changes. It is still possible to send a full data set (such as full list of suppliers) once per night.
GET method returns the latest version of data posted to Basware API
Changes made manually to master data, for example through user interfaces, are not reflected in returned results. GET is mainly intended as a tool to check what has been posted to Basware API.
Number of records per message is limited per API
Consecutive API calls are needed for processing large amounts of records. The record limit varies by endpoint. It is 100 for AccountingDocuments, MatchingOrderLines and PurchaseRequisitions, and 500 for everything else. Please distribute the payload over multiple requests to stay below the respective limits.
Please send the ‘x-amz-meta-continuationtoken’ parameter value returned in previous GET response header as parameter in the GET request header in order to retrieve the next batch of items.
API responses make use of HTTP redirects
Programs using Basware API need to handle redirects either at the application layer or the HTTP layer. Please verify all HTTP request headers are correctly included in the redirected request (the second request after receiving a redirect) including HTTP standards such as Authorization and Date.
JSON parsing requirements for API clients
Basware reserves the right to introduce new non-mandatory fields to existing API data schemas (new fields may be added to Accounts, Vendors, AccountingDocuments, etc). Please make sure your API client is configured to read data from records returned from API using named JSON fields and does not assume the fields come in a predefined sequence of elements.
Basware also reserves the right to send only those fields in API responses, where the field value is not null. Please make sure your API client checks whether the field exists in the received JSON before attempting to parse it’s contents.
The above kinds of changes are considered minor (non-breaking) changes and may be performed by Basware upon discretion at any time. Changes where, for example, a mandatory field is added or removed, or existing field names are changed, are considered major (breaking) changes and will be published under a new API version (‘v2/accounts’ instead of ‘v1/accounts’, etc)
Automatically populated fields in API
The following fields are automatically populated and should be omitted with POST and PATCH requests. They will be visible with GET requests and therefore are present in API schema definitions.
- LastUpdated (All APIs)
- Buvid (Vendors)
Authentication and access rights
Basware API uses basic HTTP authentication to authenticate API clients.
All communication is secured by using the HTTPS protocol (HTTP over TLS). You must make all API requests over HTTPS. API requests made without authentication will fail.
API user access rights can be set per API endpoint. This controls what the user can do when interacting with Basware API.
Common scenarios where access restrictions are needed are:
- Restricting access for technical partners, who GET/POST data only to one API , such as Contracts.
- Restricting access for reporting integration, which for example is only allowed to GET records
The available access rights are 1) "Read", 2) "Write" (=read+write), 3) "Delete" (read+write+delete). If no restrictions are specified API users will have full access (read+write+delete) to all APIs.
API response codes
The various response codes are outlined in the API definition per endpoint and method. Overall API response guideline:
- 200/OK: Credentials validated, task executed successfully
- 404/Not Found: Credentials validated, that particular data item does not exist (e.g. unknown Account)
- 403/Forbidden: Credentials invalid
- 405/Method Not Allowed: Typically occurs on POST Acknowledge, when the invoice has been already acknowledged. Each invoice can be acknowledged only once.
- 411/Length Required: URI is not correct, check for typos (case-sensitive). This usually occurs on POSTs.
- 502/Bad Gateway: URI or endpoint does not exist, check for typos (case-sensitive). This usually occurs on GETs
Every time there is a backwards-incompatible change to the API, a new major version will be released. This major version is part of the URL path. The current major version is v1.
Unless informed by our technical support department that we are discontinuing support for a particular API version, you do not need to switch API versions. We will let you know at least 12 months in advance if an old API version is to be deprecated.
Change that requires changes from the API consumer before the new version can be taken into use. This change would for example be a change to existing fields or adding new mandatory fields.
Minor change is a new version of the API that is backward compatible and does not require changes from the API consumer. Minor change would consist of for example adding a new non-mandatory field. Please make sure your API client accepts new non-mandatory fields.
Fair use practices
Data import API’s
Data import APIs are intended only for importing data from Customer systems to Basware systems. Data imports are one directional, APIs will not reflect any changes done in Basware P2P.
Main use cases
- Import new data entities (Method: POST)
- Update existing data entities (Method: PATCH/POST
Development phase / Supporting use cases
- Getting data entities by external code (Method: GET) – This use case is mainly intended for development phase usage. Not to be used as part of production usage
Posting all entities vs changed entities
Best practice is to update entities one by one as they change as opposed to batch operations. If batch operation (posting all entities, not only changed ones, every time) is used then that should be done infrequently. Optimal frequency depends on how many data entities there are in total and should be discussed with Basware especially if there are very high number of entities
Invoice transfer APIs
Invoice transfer APIs are meant for transferring invoice data to ERP system when an invoice is ready for payment. The process includes polling the AccountingDocuments API for new invoices, fetching invoices and posting transfer and payment responses.
Polling for invoices that are ready for transfer
- GET with status ‘ReadyForTransfer’ from AccountingDocuments API
- It is recommended to use one polling process only to avoid duplicate requests
- Polling frequency best practice is once per minute
Rate limits for APIs
The API platform has been built to scale up and down automatically. Sudden peaks in usage can potentially cause timeouts as it may take a moment for the platform to scale up. Please avoid very high concurrency especially when starting an integration flow. Please ensure you have retry mechanisms in place to handle any failed requests.
We may temporarily or permanently block access if you are calling the API too frequently or you are requesting an unreasonable amount of data in a short time period. The limits should only affect scripts that are malfunctioning or attempting to make too many requests in parallel.
Update frequency for Matching Order Lines
- Do not POST or PATCH updates to the same MatchingOrderLine more often than every 10 seconds.
Named structured types with a key. They define the named properties and relationships of a record. Examples: accounts, costCenters, matchingOrderLines.
Instances of entity types (e.g. account, opportunity).
Computer program used for keeping accounts. Commonly included in an ERP system as a module
Enterprise resource planning (ERP) is defined as the ability to deliver an integrated suite of business applications. ERP tools share a common process and data model, covering broad and deep operational end-to-end processes, such as those found in finance, HR, distribution, manufacturing, service and the supply chain.
Basware Purchase-to-Pay, in this manual refers to Basware Purchase-to-Pay solution.
Basware AP Automation
Accounts Payable Automation solution. Part of Basware P2P.
Basware Purchase solution. Part of Basware P2P.