Package: dapi-python
dapi-pythonA client library that talks to theDapiAPI.QuickstartConfigure ProjectFirst install the library.$ pip install dapi-pythonConfigure LibraryCreate a Dapi client instance with your App Secret.fromdapiimportDapiClientclient=DapiClient(app_secret="YOUR_APP_SECRET")Now you can access any of the functions of the products available on theDapiClientinstance,client, (datafor example) to call Dapi with yourappSecret.fromdapiimportDapiClientclient=DapiClient(app_secret="YOUR_APP_SECRET")accounts_resp=client.data.getAccounts("YOUR_ACCESS_TOKEN","YOUR_USER_SECRET")Or, you can use thehandleSDKDapiRequestsfunction from theDapiClientinstance inside your endpoint. Our code will basically update the request to add your app'sappSecretto it, and forward the request to Dapi, then return the result.fromdapiimportDapiClientclient=DapiClient(app_secret="YOUR_APP_SECRET")dapi_resp=client.handleSDKDapiRequests()# inside your endpoint handlerReference!! Dapi API Disclaimer !!Dapi's api request and response params are in camelCase, so while this library follows PEP8 standard and uses snake_case for all arguments, all responses will be in camelCase.BaseResponseAll the responses have the fields described here. Meaning all the responses described below in the document will have following fields besides the ones specific to each response.ParameterTypeDescriptionoperationIDstrUnique ID generated to identify a specific operation.successboolReturns true if request is successful and false otherwise."statusstrThe status of the job.done- Operation Completed.failed- Operation Failed.user_input_required- Pending User Input.initialized- Operation In Progress.For further explanation seeOperation Statuses.userInputs[dict]Array ofUserInputobjects, that are needed to complete this operation.Specifies the type of further information required from the user before the job can be completed.Note: It's only returned if operation status isuser_input_requiredtypestrType of error encountered.Note: It's only returned if operation status isfailedmsgstrDetailed description of the error.Note: It's only returned if operation status isfailedUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.querystrTextual description of what is required from the user side.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted. In the response it will always be empty.Methodsauth.exchangeTokenMethod is used to obtain user's permanent access token by exchanging it with access code received during the user authentication (user login).Note:You can read more about how to obtain a permanent token onObtain an Access Token.Method DescriptiondefexchangeToken(access_code,connection_id)->dictInput ParametersParameterTypeDescriptionaccess_codeREQUIREDstrUnique code for a user’s successful login toConnect. Returned in the response ofUserLogin.connection_idREQUIREDstrTheconnectionIDfrom a user’s successful log in toConnect.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status isdone:ParameterTypeDescriptionaccessTokenstrA unique permanent token linked to the user.data.getIdentityMethod is used to retrieve personal details about the user.Method DescriptiondefgetIdentity(access_token,user_secret,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptionaccess_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status isdone:ParameterTypeDescriptionidentitydictAn object containing the identity data of the user.For the exact schema of theidentityobject, seeIdentity schema.data.getAccountsMethod is used to retrieve list of all the bank accounts registered on the user. The list will contain all types of bank accounts.Method DescriptiondefgetAccounts(access_token,user_secret,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptionaccess_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status isdone:ParameterTypeDescriptionaccounts[dict]An array containing the accounts data of the user.For the exact schema of theaccountsarray, seeAccount schema.data.getBalanceMethod is used to retrieve balance on specific bank account of the user.Method DescriptiondefgetBalance(access_token,user_secret,account_id,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptionaccount_idREQUIREDstrThe bank account ID which its balance is requested.Retrieved from one of the accounts returned from theGetAccountsmethod.access_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be valid if the status isdone:ParameterTypeDescriptionbalancedictAn object containing the account's balance information.For the exact schema of thebalanceobject, seeBalance schema.data.getTransactionsMethod is used to retrieve transactions that user has performed over a specific period of time from their bank account. The transaction list is unfiltered, meaning the response will contain all the transactions performed by the user (not just the transactions performed using your app).Date range of the transactions that can be retrieved varies for each bank. The range supported by the users bank is shown in the response parametertransactionRangeof Get Accounts Metadata endpoint.Method DescriptiondefgetTransactions(access_token,user_secret,account_id,from_date,to_date,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptionaccount_idREQUIREDstrThe bank account ID which its transactions are requested.Retrieved from one of the accounts returned from thegetAccountsmethod.from_dateREQUIREDstrThe start date of the transactions wanted.It should be in this formatYYYY-MM-DD.to_dateREQUIREDstrThe end date of the transactions wanted.It should be in this formatYYYY-MM-DD.access_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be valid if the status isdone:ParameterTypeDescriptiontransactions[dict]Array containing the transactional data for the specified account within the specified period.For the exact schema of thetransactionsarray, seeTransaction schema.payment.getBeneficiariesMethod is used to retrieve list of all the beneficiaries already added for a user within a financial institution.Method DescriptiondefgetBeneficiaries(access_token,user_secret,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptionaccess_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status isdone:ParameterTypeDescriptionbeneficiaries[dict]An array containing the beneficiary information.For the exact schema of thebeneficiariesarray, seeBeneficiary schema.payment.createBeneficiaryMethod is used to retrieve list of all the beneficiaries already added for a user within a financial institution.Method DescriptiondefcreateBeneficiary(access_token,user_secret,beneficiary_data,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptionbeneficiary_dataREQUIREDdictAn object that contains info about the beneficiary that should be added.access_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.beneficiary_data ObjectParameterTypeDescriptionnameREQUIREDstrName of the beneficiary.accountNumberREQUIREDstrAccount number of the beneficiary.ibanREQUIREDstrBeneficiary's IBAN number.swiftCodeREQUIREDstrBeneficiary's financial institution's SWIFT code.typeREQUIREDstrType of beneficiary.For further explanation seeBeneficiary Types.addressREQUIREDdictAn object containing the address information of the beneficiary.countryREQUIREDstrName of the country in all uppercase letters.branchAddressREQUIREDstrAddress of the financial institution’s specific branch.branchNameREQUIREDstrName of the financial institution’s specific branch.phoneNumberOPTIONALstrBeneficiary's phone number.routingNumberOPTIONALstrBeneficiary's Routing number, needed only for US banks accounts.address ObjectParameterTypeDescriptionline1REQUIREDstrStreet name and number. Note: value should not contain any commas or special characters.line2REQUIREDstrCity name. Note: value should not contain any commas or special characters.line3REQUIREDstrCountry name. Note: value should not contain any commas or special characters.ResponseMethod returns only the fields defined in the BaseResponse.payment.createTransferMethod is used to initiate a new payment from one account to another account.ImportantWe suggest you usetransferAutoflowmethod instead to initiate a payment.transferAutoflowabstracts all the validations and processing logic, required to initiate a transaction usingcreateTransfermethod.You can read abouttransferAutoflowfurther in the document.Method DescriptiondefcreateTransfer(access_token,user_secret,transfer_data,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptiontransfer_dataREQUIREDdictAn object that contains info about the transfer that should be initiated.access_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.transfer_data ObjectParameterTypeDescriptionsenderIDREQUIREDstrThe id of the account which the money should be sent from.Retrieved from one of the accounts array returned from the getAccounts method.amountREQUIREDfloatThe amount of money which should be sent.receiverIDOPTIONALstrThe id of the beneficiary which the money should be sent to.Retrieved from one of the beneficiaries array returned from the getBeneficiaries method.Needed only when creating a transfer from a bank that requires the receiver to be already registered as a beneficiary to perform a transaction.nameOPTIONALstrThe name of receiver.Needed only when creating a transfer from a bank that handles the creation of beneficiaries on its own, internally, and doesn't require the receiver to be already registered as a beneficiary to perform a transaction.accountNumberOPTIONALstrThe Account Number of the receiver's account.Needed only when creating a transfer from a bank that handles the creation of beneficiaries on its own, internally, and doesn't require the receiver to be already registered as a beneficiary to perform a transaction.ibanOPTIONALstrThe IBAN of the receiver's account.Needed only when creating a transfer from a bank that handles the creation of beneficiaries on its own, internally, and doesn't require the receiver to be already registered as a beneficiary to perform a transaction.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status isdone:ParameterTypeDescriptionreferencestrTransaction reference string returned by the bank.payment.transferAutoflowMethod is used to initiate a new payment from one account to another account, without having to care nor handle any special cases or scenarios.Method DescriptiondeftransferAutoflow(access_token,user_secret,transfer_autoflow_data,user_inputs=[],operation_id="")->dictInput ParametersParameterTypeDescriptiontransfer_autoflow_dataREQUIREDdictAn object that contains info about the transfer that should be initiated, and any other details that's used to automate the operation.access_tokenREQUIREDstrAccess Token obtained using theexchangeTokenmethod.user_secretREQUIREDstrTheuserSecretfrom a user’s successful log in toConnect.operation_idOPTIONALstrTheoperationIDfrom a previous call's response.Required only when resuming a previous call that responded withuser_input_requiredstatus, to provided user inputs.user_inputsOPTIONAL[dict]Array ofUserInputobjects, that are needed to complete this operation.Required only if a previous call responded withuser_input_requiredstatus.You can read more about user inputs specification onSpecify User InputUserInput ObjectParameterTypeDescriptionidstrType of input required.You can read more about user input types onUser Input Types.indexintIs used in case more than one user input is requested.Will always be 0 If only one input is requested.answerstrUser input that must be submitted.transfer_autoflow_data ObjectParameterTypeDescriptionsenderIDREQUIREDstrThe id of the account which the money should be sent from.Retrieved from one of the accounts array returned from the getAccounts method.amountREQUIREDfloatThe amount of money which should be sent.beneficiaryREQUIREDdictAn object that holds the info about the beneficiary which the money should be sent to.bankIDREQUIREDstrThe bankID of the user which is initiating this transfer.beneficiary ObjectParameterTypeDescriptionnameREQUIREDstrName of the beneficiary.accountNumberREQUIREDstrAccount number of the beneficiary.ibanREQUIREDstrBeneficiary's IBAN number.swiftCodeREQUIREDstrBeneficiary's financial institution's SWIFT code.addressREQUIREDdictAn object containing the address information of the beneficiary.countryREQUIREDstrName of the country in all uppercase letters.branchAddressREQUIREDstrAddress of the financial institution’s specific branch.branchNameREQUIREDstrName of the financial institution’s specific branch.phoneNumberOPTIONALstrBeneficiary's phone number.routingNumberOPTIONALstrBeneficiary's Routing number, needed only for US banks accounts.address ObjectParameterTypeDescriptionline1REQUIREDstrStreet name and number. Note: value should not contain any commas or special characters.line2REQUIREDstrCity name. Note: value should not contain any commas or special characters.line3REQUIREDstrCountry name. Note: value should not contain any commas or special characters.ResponseIn addition to the fields described in the BaseResponse, it has the following fields, which will only be returned if the status isdone:ParameterTypeDescriptionreferencestrTransaction reference string returned by the bank.