Quickstart: Downloading attachments

You want to export receipts and invoices attached to payments to your application.

The scenario you want to achieve

  1. The bunq user has accepted the authorization request and your application can read the bunq user’s account information.

  2. Your application imports all the transactions and attachments.

  3. The bunq user sees the transactions matched with the receipts and invoices in your application.

Before you start

  • Make sure that you have opened a session

  • Make sure you pass the session Token in the X-Bunq-Client-Authentication header in all the following requests of the session.

Call sequence

get
List the payments of the user

https://public-api.sandbox.bunq.com/v1/user/{userID}/monetary-account/{monetary-accountID}/payment
Request
Response
Request
Path Parameters
userID
required
integer
The ID of the user.
monetary-accountID *
required
integer
The ID of the monetary account.
Headers
User-Agent
required
string
Information about the user agent originating the request. There are no restrictions on the value of this header.
X-Bunq-Client-Authentication *
required
string
The token you get in the response of the session-server call.
Response
200: OK
[
{
"id": 0,
"created": "string",
"updated": "string",
"monetary_account_id": 0,
"amount": {
"value": "string",
"currency": "string"
},
"alias": {
"iban": "string",
"display_name": "string",
"avatar": {
"uuid": "string",
"anchor_uuid": "string",
"image": [
{
"attachment_public_uuid": "string",
"content_type": "string",
"height": 0,
"width": 0
}
]
},
"label_user": {
"uuid": "string",
"display_name": "string",
"country": "string",
"avatar": {
"uuid": "string",
"anchor_uuid": "string",
"image": [
{
"attachment_public_uuid": "string",
"content_type": "string",
"height": 0,
"width": 0
}
]
},
"public_nick_name": "string"
},
"country": "string",
"bunq_me": {
"type": "string",
"value": "string",
"name": "string"
},
"is_light": true,
"swift_bic": "string",
"swift_account_number": "string",
"transferwise_account_number": "string",
"transferwise_bank_code": "string",
"merchant_category_code": "string"
},
"counterparty_alias": {
"iban": "string",
"display_name": "string",
"avatar": {
"uuid": "string",
"anchor_uuid": "string",
"image": [
{
"attachment_public_uuid": "string",
"content_type": "string",
"height": 0,
"width": 0
}
]
},
"label_user": {
"uuid": "string",
"display_name": "string",
"country": "string",
"avatar": {
"uuid": "string",
"anchor_uuid": "string",
"image": [
{
"attachment_public_uuid": "string",
"content_type": "string",
"height": 0,
"width": 0
}
]
},
"public_nick_name": "string"
},
"country": "string",
"bunq_me": {
"type": "string",
"value": "string",
"name": "string"
},
"is_light": true,
"swift_bic": "string",
"swift_account_number": "string",
"transferwise_account_number": "string",
"transferwise_bank_code": "string",
"merchant_category_code": "string"
},
"description": "string",
"type": "string",
"sub_type": "string",
"bunqto_status": "string",
"bunqto_sub_status": "string",
"bunqto_share_url": "string",
"bunqto_expiry": "string",
"bunqto_time_responded": "string",
"attachment": [
{
"id": 0,
"monetary_account_id": 0
}
],
"merchant_reference": "string",
"batch_id": 0,
"scheduled_id": 0,
"address_shipping": {
"street": "string",
"house_number": "string",
"po_box": "string",
"postal_code": "string",
"city": "string",
"country": "string",
"extra": "string",
"mailbox_name": "string",
"province": "string"
},
"address_billing": {
"street": "string",
"house_number": "string",
"po_box": "string",
"postal_code": "string",
"city": "string",
"country": "string",
"extra": "string",
"mailbox_name": "string",
"province": "string"
},
"geolocation": {
"latitude": 0,
"longitude": 0,
"altitude": 0,
"radius": 0
},
"request_reference_split_the_bill": [
{
"type": "string",
"id": 0
}
],
"balance_after_mutation": {
"value": "string",
"currency": "string"
}
}
]

get
Check if the payments have attachments

https://public-api.sandbox.bunq.com/v1/user/{userID}/monetary-account/{monetary-accountID}/payment/{paymentID}/note-attachment
Request
Response
Request
Path Parameters
userID
required
integer
The ID of the user.
monetary-accountID *
required
integer
The ID of the monetary account.
paymentID
required
integer
The ID of the payment
Headers
User-Agent
required
string
Information about the user agent originating the request. There are no restrictions on the value of this header.
X-Bunq-Client-Authentication *
required
string
The token you get in the response of the session-server call.
Response
200: OK
[
{
"id": 0,
"created": "string",
"updated": "string",
"label_user_creator": {
"uuid": "string",
"display_name": "string",
"country": "string",
"avatar": {
"uuid": "string",
"anchor_uuid": "string",
"image": [
{
"attachment_public_uuid": "string",
"content_type": "string",
"height": 0,
"width": 0
}
]
},
"public_nick_name": "string"
},
"description": "string",
"attachment": [
{
"id": 0,
"monetary_account_id": 0
}
]
}
]

Save the attachment IDs.

get
Export the raw content of the attachments

https://public-api.sandbox.bunq.com/v1/user/{userID}/attachment/{attachmentID}/content
Request
Response
Request
Path Parameters
userID
required
integer
The ID of the user.
attachmentID
required
integer
The ID of the attachment.
Headers
User-Agent
required
string
Information about the user agent originating the request. There are no restrictions on the value of this header.
X-Bunq-Client-Authentication *
required
string
The token you get in the response of the session-server call.
Response
200: OK
[
{}
]

You can use callbacks to make sure you don’t miss anything happening on the bunq account.