Sandbox Data Management - Treasury APIs
Managing data in the sandbox
On this page
Sandbox default dataset
During the project creation workflow the smart sandbox database is populated with an initial default dataset. This data helps you get started with sandbox testing and is associated with the project client ID, so it's exclusive to the members of your Corporate sandbox project.
For Virtual Accounts default dataset, please visit the sandbox access guide found on this page
- Properties of the default dataset include:
-
- The transaction date of the data is the project creation date. Please use the project creation date when querying transaction level details.
- The data comprises 300 transaction entries per account with random debit and credit amounts.
- Any payment entries will be saved in addition to the default dataset so will reflect the balance of the accounts.
- You can add more data via file upload that will be covered later in this document.
- There are 16 accounts currently configured in the default dataset against 8 countries that are detailed in the below table.
- Accounts configured in the default dataset:
-
accountNumber accountCountry institutionCode accountType iban idOther bankCode 10000001 GB HBEU CA GB92MIDL40000010000001 MIDLGB22XXX 10000002 GB HRFB CA GB40HBUK40010010000002 HBUKGB4BXXX 339200000003 HK HBAP CA 004 HSBCHKHHHKH 339200000004 HK HBAP CA 004 HSBCHKHHHKH 1234000000000000005 CN HBAP CA HSBCCNSHXXX 1234000000000000006 CN HBAP CA HSBCCNSHXXX 146000000007 SG HBAP CA HSBCSGSGXXX 146000000008 SG HBAP CA HSBCSGSGXXX 146000000009 IN HBAP CA HSBCINBBXXX 146000000010 IN HBAP CA HSBCINBBXXX 1100000011 US HBAP CA 22000020 MRMDUS33XXX 1100000012 US HBAP CA 22000020 MRMDUS33XXX 021580000000000130 MX HBMI CA BIMEMXMMXXX 021580000000000143 MX HBMI CA BIMEMXMMXXX 220000000015 AE HBME CA AE310200000000000000015 BBMEAEADXXX 220000000016 AE HBME CA AE950200000220000000016 BBMEAEADXXX
Note, it is possible to add more accounts into the sandbox database if the countries you wish to test against are not included in the default dataset.
Adding data to the sandbox
Currently the sandbox supports file upload via the Developer Portal project details page or via self-service API.
- File upload table schema
-
Please find the table schema for the
accountandtransactiontables below.Input files are required to comply with these schema to prevent data validation errors during upload.
- Account table
-
- Field name is mandatory, field values can be optional as per the schema below.
- Optional fields can be populated to enable specific test cases to be completed for those values.
Field Name Description Required Example Value accountNumber Bank Account number Yes 10000001 accountCountry ISO country code Yes GB institutionCode HSBC institution code - will be provided by your client integration manager Yes HBEU accountType CA for current account Yes CA accHolderName Account holder name, used for HK Direct Debit entries No Sandbox Test accSchemeName Scheme name, used for HK Direct Debit entries No BBAN ccy ISO Currency code Yes GBP iban International Bank Account Number No GB92MIDL40000010000001 idOther Other bank identifier-used for HK Bank Code 004 and US routing number 22000020 No 004 bankCode HSBC BIC Code No MIDLGB22XXX msgId Specific message identifier for account No AM003UKSB88061 lineOfCredit Enables a credit line to be included in the balance No 10000 - Transaction table
-
- Field name is mandatory, field values can be optional as per the schema below.
- Optional fields can be populated to enable specific test cases to be completed for those values.
Field Name Description Required Example Value accountNumber Bank Account number Yes 10000001 accountCountry ISO country code Yes GB institutionCode HSBC institution code - will be provided by your client integration manager Yes HBEU accountType CA for current account Yes CA amt Transaction amount always positive number Yes 3084.36 ccy ISO Currency code Yes GBP cdtDbtInd Debit or Credit indicator should be either CRDT or DBIT Yes CRDT rvslInd Reversal indicator usually false (this value is lowercase in live) No false sts Status usually BOOK for Booked No BOOK addtlNtryInf Payment narrative can be used to populate specific account entries for testing No Posting narrative is provided in this field acctSvcrRef Unique reference as assigned by the account servicing institution No 123456789 endToEndId Unique identification, as assigned by the initiating party, to unambiguously identify the transaction No E2EIDREFPVT066 transactionTime Used as part of BookgDt the date part of the value is the entry date of the data to the sandbox No 09:00 domnCd ISO Domain code No PMNT domnFmlyCd ISO Family code No MCOP prtryCd Bank Transaction code in proprietary format No NTRF prtryIssr Issuer of the proprietary bank transaction code will be SWIFT or BAI No SWIFT
Please find a full list of the supported SWIFT, BAI2 and ISO transaction codes here: SWIFT, BIA2 and ISO Codes.pdf
Adding data via the Developer Portal
To add data to the Sandbox via the Developer Portal site, follow the steps below :
- Use the Dev Hub link to navigate to the project details page associated with your sandbox testing project.
- Scroll to the Sandbox Management section on the sandbox details page.
- The Test Data section contains the controls required to upload csv input files and reset the sandbox back to the default dataset.
- Download the csv template to populate your test data files in accordance with the required field names, please verify the input values against the above table schema to prevent file upload validation errors.
Adding data via the sandbox Management API
The swagger definition for this API is available here: Sandbox Management API
The Sandbox Management API is available to upload test data files and reset the sandbox directly from your development environment.
- Sandbox Management API:
POST/DELETE https://sandbox.corporate-api.hsbc.com/v1/sandbox-self-service/manage/data POSTmethod adds rows to the table defined in the headertable-nameDELETEresets the sandbox table defined in the headertable-nameto the default dataset.
The cURL snippets below are examples of adding data to the transaction table.
curl --location --request POST 'https://sandbox.corporate-api.hsbc.com/v1/sandbox-self-service/manage/data' \
--header 'x-hsbc-client-id: {{client-id}}' \
--header 'x-hsbc-client-secret: {{client-secret}}' \
--header 'x-hsbc-profile-id: {{profile-id}}' \
--header 'product-category: treasury' \
--header 'category-version: 1.0' \
--header 'api-name: account-information' \
--header 'api-version: v2' \
--header 'table-name: transaction' \
--header 'product-names: account-information-v2' \
--header 'content-type: multipart/form-data' \
--f file=@/{{your-upload-file-location-and-filename}}
Postman collection
A downloadable Postman collection is available on your project details page to help get started with the Smart Sandbox.