Working with internal API
Introduction
Internal API provides CRUD operations for general objects such as Customers, Accounts, Balances, Transactions, Tx. Rules
Additionally there are SEPA Credit money transfer, SEPA Direct debit and SEPA Mandates.
Here’s a link to Swagger on internal API
https://api.mockbank.io/swagger-ui.html#/Decoupled_Authorizations
Table of content
Prerequisites
Complete registration Quick start
Make sure you have set
client_id
andclient_secret
for your organisation
Authentication
Request example:
Note: Client ID and Secret are set on the screen above and YOUR_USERNAME
/ YOUR_PASSWORD
are respectively an Email address and password you use to login to MockBank Admin UI.
curl --location --request POST 'https://api.mockbank.io/oauth/token' \
--header 'Authorization: Basic {YOUR_CLIENT_ID:CLIENT_SECRET}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username={YOUR_USERNAME}' \
--data-urlencode 'password={YOUR_PASSWORD}' \
--data-urlencode 'grant_type=password'
Response example:
{
"access_token": "{YOUR_CLIENT_ACCESS_TOKEN}",
"token_type": "bearer",
"refresh_token": "{YOUR_CLIENT_REFRESH_TOKEN}",
"expires_in": 3564,
"scope": "all"
}
Add customer
Request example:
curl --location --request POST 'https://api.mockbank.io/customers' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"address": "Mohrenstrasse 37",
"city": "Berlin",
"zip": "10115",
"countryCode": "de",
"fullName": "Alex",
"msisdn": "+491703555555",
"password": "test",
"username": "test@mockbank.io"
}'
Response example:
{
"externalId": "{CREATED_CUSTOMER_ID}",
"fullName": "Alex",
"username": "test@mockbank.io",
"password": "alex",
"countryCode": "de",
"address": "Mohrenstrasse 37",
"zip": "10115",
"city": "Berlin",
"msisdn": "+491703555555"
}
Update customer
Request example:
curl --location --request PUT 'https://api.mockbank.io/customers/{CREATED_CUSTOMER_ID}' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"address": "Kimeria",
"city": "Brill",
"zip": "10000",
"countryCode": "ka",
"fullName": "Conan the Barbarian",
"msisdn": "+491703555555",
"password": "torgrim",
"username": "torgrim@mockbank.io"
}'
Update SCA methods
Request example:
curl --location --request PUT 'https://api.mockbank.io/customers/{CREATED_CUSTOMER_ID}/sca-methods' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"scaMeths": [
{
"authenticationMethodId": "smstaniphonex",
"authenticationType": "SMS",
"authenticationVersion": "0",
"decoupled": false,
"explanation": "Send SMS to +489********34",
"name": "Verify by Phone",
"tan": "123321"
},
{
"authenticationMethodId": "vaultappcheck",
"authenticationType": "APP",
"authenticationVersion": "0",
"decoupled": true,
"explanation": "Please check your app",
"name": "Verify by App",
"tan": "321123"
}
]
}'
Response example:
Status: 200 OK
Add account
Request example:
curl --location --request POST 'https://api.mockbank.io/customers/{CREATED_CUSTOMER_ID}/accounts' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"bban": "370400440532013001",
"bic": "MOCKDEXXXXX",
"currency": "EUR",
"iban": "DE89370400440532013002",
"maskedPan": "12******3",
"name": "Current",
"pan": "120000003",
"status": "enabled",
"type": "CASH"
}
'
Response example:
{
"externalId": "{CREATED_ACCOUNT_ID}",
"iban": "DE89370400440532013002",
"bban": "370400440532013001",
"currency": "EUR",
"name": "Current",
"status": "enabled",
"type": "CASH",
"bic": "MOCKDEXXXXX",
"pan": "120000003",
"maskedPan": "12******3"
}
Add account balance
Request example:
curl --location --request PUT 'https://api.mockbank.io/customers/{CREATED_CUSTOMER_ID}/accounts/{CREATED_ACCOUNT_ID}/balances' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--data-raw '{
"balances": [
{
"amount": 43.99,
"balanceType": "CLOSING_BOOKED",
"creditLimitIncluded": true,
"lastChangeDateTime": "2020-01-22T12:42:31.537Z",
"lastCommittedTransaction": "c9906177-c8b1-4b4c-b2fc-0d1e10cbf568",
"referenceDate": "2020-01-01"
},
{
"amount": 143.99,
"balanceType": "EXPECTED",
"creditLimitIncluded": true,
"lastChangeDateTime": "2020-01-22T12:42:31.537Z",
"lastCommittedTransaction": "c9906177-c8b1-4b4c-b2fc-0d1e10cbf568",
"referenceDate": "2020-01-01"
},
{
"amount": 243.99,
"balanceType": "AUTHORISED",
"creditLimitIncluded": true,
"lastChangeDateTime": "2020-01-22T12:42:31.537Z",
"lastCommittedTransaction": "c9906177-c8b1-4b4c-b2fc-0d1e10cbf568",
"referenceDate": "2020-01-01"
},
{
"amount": 343.99,
"balanceType": "OPENING_BOOKED",
"creditLimitIncluded": true,
"lastChangeDateTime": "2020-01-22T12:42:31.537Z",
"lastCommittedTransaction": "c9906177-c8b1-4b4c-b2fc-0d1e10cbf568",
"referenceDate": "2020-01-01"
},
{
"amount": 443.99,
"balanceType": "INTERIM_AVAILABLE",
"creditLimitIncluded": true,
"lastChangeDateTime": "2020-01-22T12:42:31.537Z",
"lastCommittedTransaction": "c9906177-c8b1-4b4c-b2fc-0d1e10cbf568",
"referenceDate": "2020-01-01"
},
{
"amount": 543.99,
"balanceType": "FORWARD_AVAILABLE",
"creditLimitIncluded": true,
"lastChangeDateTime": "2020-01-22T12:42:31.537Z",
"lastCommittedTransaction": "c9906177-c8b1-4b4c-b2fc-0d1e10cbf568",
"referenceDate": "2020-01-01"
},
{
"amount": 643.99,
"balanceType": "NON_INVOICED",
"creditLimitIncluded": true,
"lastChangeDateTime": "2020-01-22T12:42:31.537Z",
"lastCommittedTransaction": "c9906177-c8b1-4b4c-b2fc-0d1e10cbf568",
"referenceDate": "2020-01-01"
}
]
}'
Response example:
Status: 200 OK
Add transaction
Request example:
@Andrei Galitski make data more realistic?
curl --location --request POST 'https://api.mockbank.io/customers/{CREATED_CUSTOMER_ID}/transactions' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '
{
"accountId": "{CREATED_ACCOUNT_ID}",
"amount": -434,
"bookingDate": "2020-01-26",
"currency": "EUR",
"valueDate": "2020-01-25",
"operationId": "operationId-xxx",
"entryReference": "ref-xxx",
"endToEndId": "id-xxx",
"checkId": "check-xxx",
"creditorId": "creditorId",
"creditorName": "creditorName",
"creditorBic": "creditorBic",
"creditorAccount": {
"currency": "EUR",
"iban": "iban",
"bban": "bban",
"pan": "pan",
"maskedPan": "maskedPan",
"msisdn": "msisdn"
},
"ultimateCreditor": "ultimateCreditor",
"debtorName": "debtorName",
"debtorBic": "debtorBic",
"debtorAccount": {
"currency": "EUR",
"iban": "iban",
"bban": "bban",
"pan": "pan",
"maskedPan": "maskedPan",
"msisdn": "msisdn"
},
"ultimateDebtor": "ultimateDebtor",
"remittanceInformationUnstructured": "remittanceInformationUnstructured",
"remittanceInformationStructured": "remittanceInformationStructured",
"additionalInformation": "additionalInformation",
"purposeCode": "BKDF",
"bankTransactionCode": "bankTransactionCode",
"proprietaryBankTransactionCode": "proprietaryBankTransactionCode",
"eref": "eref"
}'
Response example:
{
"externalId": "{CREATED_TRANSACTION_ID}",
"accountId": "{CREATED_ACCOUNT_ID}",
"accountName": "Current",
"accountIban": "DE89370400440532013002",
"operationId": "operationId-xxx",
"entryReference": "ref-xxx",
"endToEndId": "id-xxx",
"checkId": "check-xxx",
"creditorId": "creditorId",
"bookingDate": "2020-01-26",
"valueDate": "2020-01-25",
"currency": "EUR",
"amount": -434,
"creditorName": "creditorName",
"creditorBic": "creditorBic",
"creditorAccount": {
"iban": "iban",
"bban": "bban",
"pan": "pan",
"maskedPan": "maskedPan",
"msisdn": "msisdn",
"currency": "EUR"
},
"ultimateCreditor": "ultimateCreditor",
"debtorName": "debtorName",
"debtorBic": "debtorBic",
"debtorAccount": {
"iban": "iban",
"bban": "bban",
"pan": "pan",
"maskedPan": "maskedPan",
"msisdn": "msisdn",
"currency": "EUR"
},
"ultimateDebtor": "ultimateDebtor",
"remittanceInformationUnstructured": "remittanceInformationUnstructured",
"remittanceInformationStructured": "remittanceInformationStructured",
"additionalInformation": "additionalInformation",
"purposeCode": "BKDF",
"bankTransactionCode": "bankTransactionCode",
"proprietaryBankTransactionCode": "proprietaryBankTransactionCode",
"eref": "eref"
}
Add transaction rule
Request example:
curl --location --request POST 'https://api.mockbank.io/customers/{CREATED_CUSTOMER_ID}/transactions/rules' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"accountId": "{CREATED_ACCOUNT_ID}",
"amount": -23.99,
"counterPartyIban": "DE31481516230000000018",
"counterPartyName": "Marco Tutci gmbh",
"currency": "EUR",
"dayOfMonth": 9,
"text": "Vamos a la playa"
}'
Response example:
{
"externalId": "{CREATED_RULE_ID}",
"accountId": "{CREATED_ACCOUNT_ID}",
"accountName": "Current",
"accountIban": "DE89370400440532013002",
"currency": "EUR",
"amount": -23.99,
"dayOfMonth": 9,
"counterPartyIban": "DE31481516230000000018",
"counterPartyName": "Marco Tutci gmbh",
"text": "Vamos a la playa"
}
Make SEPA Credit transfer
Request example:
curl --location --request POST 'https://api.mockbank.io/sepa/credit-transfer' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--data-raw '{
"accountId": "{CREATED_ACCOUNT_ID}",
"amount": 1,
"currency": "EUR",
"operationId": "66d92ed3-5c9e-4c9a-8c57-300f2f8dae",
"remoteBic": "SPACATW1XXX",
"remoteIban": "CA35481516230000000130",
"remoteName": "Lee Russel",
"subject": "Here is your money, Lee"
}'
Response example:
{
"externalId": "{CREATED_TRANSACTION_ID}",
"accountId": "{CREATED_ACCOUNT_ID}",
"accountName": "Current",
"accountIban": "DE89370400440532013002",
"operationId": "66d92ed3-5c9e-4c9a-8c57-300f2f8dae",
"bookingDate": "2020-10-12",
"valueDate": "2020-10-12",
"currency": "EUR",
"amount": 1,
"creditorName": "Lee Russel",
"creditorBic": "SPACATW1XXX",
"creditorAccount": {
"iban": "UK35481516230000000130",
"currency": "EUR"
},
"additionalInformation": "Here is your money, Lee"
}
Add SEPA mandate
Request example:
curl --location --request POST 'https://api.mockbank.io/sepa/mandates' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--data-raw '{
"cor1": false,
"creditorIdentityId": "RJP3401VAP",
"mandateReference": "SE90HO188A",
"recurring": false,
"remoteAddress1": "10 Downing Street",
"remoteAddress2": "LONDON, SW1A 2AA",
"remoteBic": "FDBOBEMMXXX",
"remoteCountry": "UK",
"remoteEmail": "leerus@gmail.com",
"remoteIban": "UK35481516230000000130",
"remoteName": "Lee Russel",
"remoteTitle": "Mr.",
"signatureDate": "2020-01-01",
"validFromDate": "2020-01-10"
}'
Response example:
{
"externalId": "{CREATED_MANDATE_ID}",
"creditorIdentityId": "RJP3401VAP",
"mandateReference": "SE90HO188A",
"recurring": false,
"cor1": false,
"remoteTitle": "Mr.",
"remoteName": "Lee Russel",
"remoteEmail": "leerus@gmail.com",
"remoteAddress1": "10 Downing Street",
"remoteAddress2": "LONDON, SW1A 2AA",
"remoteCountry": "UK",
"remoteIban": "UK35481516230000000130",
"remoteBic": "FDBOBEMMXXX",
"signatureDate": "2020-01-01",
"validFromDate": "2020-01-10"
}
Execute SEPA direct debit
Request example:
curl --location --request POST 'https://api.mockbank.io/sepa/direct-debit' \
--header 'Authorization: Bearer {YOUR_CLIENT_ACCESS_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"accountId": "{CREATED_ACCOUNT_ID}",
"amount": 1,
"eref": "HEH9888JH",
"currency": "EUR",
"mandateId": "{CREATED_MANDATE_ID}",
"operationId": "SE90HO188A",
"subject": "No money no honey"
}'
Response example:
{
"externalId": "{CREATED_TRANSACTION_ID}",
"accountId": "{CREATED_ACCOUNT_ID}",
"accountName": "Current",
"accountIban": "DE89370400440532013002",
"operationId": "SE90HO188A",
"mandateId": "{CREATED_MANDATE_ID}",
"bookingDate": "2020-10-12",
"valueDate": "2020-10-12",
"currency": "EUR",
"amount": 1,
"debtorName": "Lee Russel",
"debtorBic": "FDBOBEMMXXX",
"debtorAccount": {
"iban": "UK35481516230000000130"
},
"additionalInformation": "No money no honey",
"eref": "HEH9888JH"
}