Send sales invoices
In Banqup, any uploaded file undergoes a process where invoice data is extracted and checked for sanity and accuracy. After a successful validation process, the document will be sent automatically to the customer.
Prerequisites
- The invoice is a valid UBL, XML or PDF.
- The resource IDs necessary to perform the API calls below are:
Step 1: Create file
Endpoint: /datastore/documents/transaction/v1/spaces/{spaceId}/files
Request body: View documentation
Path parameter:
spaceId
curl -L 'https://{{serverURL}}/datastore/documents/transaction/v1/spaces/:spaceId/files' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{
"filename": "S_BE0479909676_999.xml",
"description": "XML upload for document FAC-001",
"retentionTime": "2029-09-30T08:30:08.424Z",
"fileSize": 57308,
"fileType": "application/xml",
"contentType": "application/xml",
"metadata": {
"folder": "SALES",
"documentCategory": "INVOICE"
}
}
Successful response:
How to view the file details
Endpoint: /datastore/documents/transaction/v1/spaces/{spaceId}/files/{fileId}
Request body: View documentation
Path parameters:
spaceId
fileId
{
"id": "5db18794-cd31-4582-adba-5e9ff0f02f4b",
"filename": "S_BE0479909676_999.xml",
"description": "XML upload for document FAC-001",
"creatorSubject": "15d02643-04e4-4cb7-b3df-a1c30900576b",
"creatorType": "application",
"retentionTime": "2029-09-30T08:30:08.424Z",
"status": "AWAITING_UPLOAD",
"fileSize": 57308,
"fileType": "application/xml",
"contentType": "application/xml",
"uploadUrl": "https://storage.googleapis.com/gcs-oaxzkhsk-eu-datastore-test/transaction/file/7cbc7e1a-a705-455e-bhj8-152974aa09e1/5db18794-cd31-4582-adba-5e9ff0f02f4b?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=sa-btxdata-datastore-test-eu%40pj-bu-btxdata-test-eu.iam.gserviceaccount.com%2F20241209%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20241209T114309Z&X-Goog-Expires=3600&X-Goog-SignedHeaders=content-type%3Bhost&X-Goog-Signature=a7913259d2861ac109067c056942030bc7e481700e395f0861d5d2e915ee216886d5dcc2cfaa96fa008e08e78d87652faa82d54cbe85a79c462f08be435959ffd249e3a7df628c9cfce1054d9d630b7ff8d900bdb97a8e2056333b0f7cd8a5f03ad6444ba02c0067f114802c04e39108146812f748ae9d8a790c258b7c1b825b9984e066cb0a7996f18f03db99ac3044dca8f075e58fc81723a9bb23005d5c6e7db2d5d907a39ff26f8fd25cc96fb90faf0b15b90146c514592b74bedab7a0f714f6c28f837b7ba52a0332e3cc2c7908913ce6e5da09c800c2fb11fc4e18082206c4c41a4914c9e1df92ecfd34527d7010f5e30bfbda2a4486ce113317a0a4fd",
"metadata": {
"folder": "SALES",
"documentCategory": "INVOICE"
},
"createdAt": "2024-12-09T11:43:09.615410027Z",
"updatedAt": "2024-12-09T11:43:09.615410027Z"
}
Step 2: Upload file
Endpoint: /
uploadUrl
(returned in the previous response).
The uploadUrl is a presigned URL in GCP which allows users to temporarily and securely access bucket resources for upload.
Request body: Attach the file in PDF, UBL or XML format. Content type: binary.
Successful response: The file has been accepted for processing. File statuses explained.
Document processing and delivery
If the document is processed successfully by the system, the invoice will be sent automatically to the customer.
Step 3: View results
- Document
- Document events
- Customer
Endpoint: /datastore/documents/transaction/v1/spaces/{spaceId}/{folder}/documents/{documentId}
Path parameters: View documentation
spaceId
folder
documentId
curl -L -X GET 'https://{{serverURL}}/datastore/documents/transaction/v1/spaces/{spaceId}/{folder}/documents/{documentId}' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'
Successful response
{
"id": "0ca2797b-6365-4bf2-a490-247075e3cede",
"spaceId": "56079d21-a756-49fb-9286-9859c354aa69",
"description": "Invoice",
"source": "email",
"folder": "SALES",
"supplier": {
"id": "d44698da-6363-476f-903d-8eb113a2940e"
},
"customer": {
"id": "0639a36a-f5c2-49f8-a2db-2d60d4284362"
},
"status": {
"pay": "FULLY_PAID"
},
"category": "INVOICE",
"metadata": {
"virus": "hidden"
},
"tags": [
"new"
],
"tasks": [
{
"extensionName": "com.unifiedpost.btx.data:approve",
"status": "approve"
}
],
"retentionTime": "2023-10-04T14:20:31.502921Z",
"lines": [
{
"id": "7a1cf570-db5c-4e41-992e-9890532212ae",
"sequence": 1,
"identifier": "ID569874",
"description": "A4 copy paper",
"itemId": "Item1",
"itemCategory": "office supplies",
"productIdentifiers": {
"commodityCode": "BGT1256"
},
"quantity": 2,
"unit": "PCS",
"startDate": "2024-01-23",
"endDate": "2024-06-23",
"discounts": {
"value": "20.0"
},
"charges": {
"value": "76.67"
},
"unitPrice": "40.278192",
"netAmount": "80.56",
"grossAmount": "96.67",
"vatAmount": "16.11",
"currency": "USD",
"vatRate": "0.2",
"vatCode": "VAT"
}
],
"createdAt": "2023-10-04T14:20:31.502921Z",
"updatedAt": "2023-10-04T14:20:31.502921Z"
}
All relevant actions performed on a document are recorded in an events log in Banqup.
Endpoint: /datastore/event/v1/spaces/{spaceId}/events
Request body: View documentation
Path parameter:
spaceId
curl -L -X GET 'https://{{serverURL}}/datastore/event/v1/spaces/:spaceId/events' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'
Successful response
{
"events": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"level": "INFO",
"subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"subjectType": "user",
"ownerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"ownerType": "SPACE",
"body": "The invoices has been sent",
"category": "document",
"subcategory": "document_sent",
"metadata": {
"some": "value"
},
"properties": {
"connector": "chorus_pro"
},
"createdAt": "2024-05-31T11:58:22.189Z"
}
],
"totalElements": 0,
"currentPage": 0,
"pageSize": 0
}
If the customer doesn't exist in the system when the invoice is sent, it will be created based on the information in the invoice as a new connection.
Customers, suppliers and other business partners are collectively called connections in Banqup.
Endpoint: /datastore/documents/transaction/v1/spaces/{spaceId}/connections/{connectionId}
Path parameters: View documentation
spaceId
connectionId
curl -L -X GET 'https://{{serverURL}}/datastore/documents/transaction/v1/spaces/:spaceId/connections/:connectionId' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN'
A successful response returns the connection details. There are two types of responses, depending on the customer type (business or person):
- Business connection
- Person connection
{
"type": "business",
"id": "aaba0614-b8b6-45d6-94b7-957cde946300",
"spaceUrl": "https://entity.store/entitystore/v1/directory/entities/entity_1/spaces/space_1",
"globalIdentifiers": {
"be:vat": "123456789",
"global:email": [
"john.smith@novafish.com"
],
"global:phoneNumber": [
"0032563259874"
]
},
"localIdentifier": "001",
"alias": "UP",
"connectionStatus": "CONNECTED",
"relationType": "CUSTOMER",
"addresses": {
"main": {
"streetName": "Nitzsche Lodge",
"house": "80728",
"postalCode": "3110",
"city": "Fernandahaven",
"country": "Belgium",
"countryCode": "BE"
}
},
"tags": [
"validate",
],
"active": true,
"metadata": {
"channels": {
"main": "delivery_on_platform",
"secondary": "email"
},
"department": "Accounting",
"logo": "https://address.com/logo.jpg",
"website": "https://mycompanywebsite.com",
"notes": "Professional and amateur fishing gear",
"industry": "Agriculture, Forestry And Fishing"
},
"legalName": "Nova Fish",
"tradeName": "Fishing Gear",
"businessType": "ENTERPRISE"
}
{
"type": "person",
"id": "44285181-3714-40c0-acd2-22dd5596269e",
"spaceUrl": "https://entity.store/entitystore/v1/directory/entities/entity_1/spaces/space_1",
"globalIdentifiers": {
"global:email": [
"susan.anderson@xyz.com"
],
"global:phoneNumber": [
"00301234567"
]
},
"alias": "UP",
"connectionStatus": "CONNECTED",
"relationType": "CUSTOMER",
"addresses": {
"main": {
"street": "Milo Crossroad",
"house": "7850",
"postalCode": "3100",
"city": "Kubhaven",
"country": "Belgium",
"countryCode": "BE"
}
},
"tags": [
"validate"
],
"active": true,
"metadata": {
"channels": {
"main": "delivery_on_platform",
"secondary": "email"
},
"department": "Accounting",
"logo": "https://address.com/logo.jpg",
"website": "https://mycompanywebsite.com",
"notes": "My notes",
"industry": "Construction"
},
"firstName": "Susan",
"lastName": "Anderson"
}