Withdrawal templates
Use these methods to manage client withdrawal templates.
When making withdrawals via the B2Core UI, clients can save data about withdrawal transactions as templates to avoid specifying the same information repeatedly for frequent withdrawals.
GET[host]/api/v2/my/withdrawals/patterns |
|
GET[host]/api/v2/my/withdrawals/patterns/{patternId} |
|
POST[host]/api/v2/my/withdrawals/patterns |
|
PATCH[host]/api/v2/my/withdrawals/patterns/{patternId} |
|
DELETE[host]/api/v2/my/withdrawals/patterns/{patternId} |
Get a list of withdrawal templates
Use this method to obtain a list of available withdrawal templates.
Use a separate method to get withdrawal template details.
Request
Header parameters:
Authorization: Bearer <access_token>
Query parameters:
The following filter parameters are available for this method:
- name
The name of a withdrawal template.
- fromCreateTime
The start date of a period when withdrawal templates were created.
- toCreateTime
The end date of a period when withdrawal templates were created.
The following sorting parameters are available for this method:
- createTime
The date and time when a withdrawal template was created.
- name
The name of a withdrawal template.
Refer to the Query parameters section in the API Overview for details on applying filter and sorting parameters.
GET[host]/api/v2/my/withdrawals/patterns
curl --location -g --request GET 'https://host.name/api/v2/my/withdrawals/patterns?offset=0&limit=10&sort_by=createTime&filter[name]=Nick&filter[fromCreateTime]=2022-12-01T07:23:59%2B00:00&filter[toCreateTime]=2022-12-01T07:23:59%2B00:00' \
--header 'Authorization: Bearer <token>'
Response
A response contains an array of Withdrawal Template objects providing information about the withdrawal templates matching the request parameters.
Get withdrawal template details
Use this method to obtain detailed information about a specified withdrawal template.
Use a separate method to get a list of withdrawal templates.
Request
Path parameters:
- patternId required
The identifier of a withdrawal template.
GET[host]/api/v2/my/withdrawals/patterns/{patternId}
curl --location --request GET 'https://host.name/api/v2/my/withdrawals/patterns/1' \
--header 'Authorization: Bearer <token>'
Response
A response contains a Withdrawal Template object providing information about the specified withdrawal template.
Create a withdrawal template
Use this method to create a withdrawal template.
Request
Header parameters:
Authorization: Bearer <access_token>
Body
Specify the following parameters for a withdrawal template:
- name string required
The name of a withdrawal template.
- amount string required
The withdrawal amount.
- amountTo string
The withdrawal amount converted to the currency in which the wallet for withdrawing funds is denominated.
- accountId integer
The identifier of the account from which funds are to be withdrawn.
- methodId integer
The identifier of a withdrawal method.
- groupId integer or null
The identifier of the group in which a withdrawal method is included.
- currencyNumericCode integer
The numeric code of the currency in which a withdrawal transaction is made.
- data object
The data specific to a withdrawal method.
Expand fields- wallet_address string
The address of the wallet to which funds are to be withdrawn.
- comment string
The optional comment to a withdrawal transaction.
- isWhitelisted boolean
If
true
, the withdrawal address saved with a template is added to a client whitelist; otherwise,false
.This parameter can’t be set if the option for managing withdrawal address whitelists is disabled for a client.
POST[host]/api/v2/my/withdrawals/patterns
curl --location --request POST 'https://host.name/api/v2/my/withdrawals/patterns/1' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"name": "My withdrawal template",
"amount": "0.0001",
"accountId": 275,
"groupId": 1,
"currencyNumericCode": 1000,
"data": {
"data":{
"wallet_address": "2NGWBeEcAau98dLd4CPyXfFTJCUViEXo81f",
"comment": "Withdrawal via B2BinPay"
}
},
"isWhitelisted": 0
}'
Response
A response contains a Withdrawal Template object providing information about the newly created withdrawal template.
Update a withdrawal template
Use this method to update a withdrawal template.
Request
Header parameters:
Authorization: Bearer <access_token>
Path parameters:
- patternId required
The identifier of a withdrawal template.
Body:
The following field values can be updated for a withdrawal template:
- name string
The name of a withdrawal template.
- amount string
The withdrawal amount.
- amountTo string or null
The withdrawal amount converted to the currency in which the wallet for withdrawing funds is denominated.
- accountId integer
The identifier of the account from which funds are to be withdrawn.
- methodId integer
The identifier of a withdrawal method.
- groupId integer or null
The identifier of the group in which a withdrawal method is included.
- currencyNumericCode integer
The numeric code of the currency in which a withdrawal transaction is made.
- data object
The data specific to a withdrawal method.
- isWhitelisted boolean
If
true
, the withdrawal address saved with a template is added to a client whitelist; otherwise,false
.This parameter can’t be updated if the option for managing withdrawal address whitelists is disabled for a client.
PATCH[host]/api/v2/my/withdrawals/patterns/{patternId}
curl --location --request PATCH 'https://host.name/api/v2/my/withdrawals/patterns/1' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"name": "My withdrawal template",
"amount": "0.0001",
"accountId": 275,
"groupId": 1,
"currencyNumericCode": 1000,
"data": {
"data":{
"wallet_address": "2NGWBeEcAau98dLd4CPyXfFTJCUViEXo81f",
"comment": "Withdrawal via B2BinPay"
}
},
"isWhitelisted": 1
}'
Response
A response includes a Withdrawal Template object providing information about the withdrawal template that was updated.
Delete a withdrawal template
Use this method to remove a specified withdrawal template.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- patternId required
The identifier of a withdrawal template.
DELETE[host]/api/v2/my/withdrawals/patterns/{patternId}
curl --location --request DELETE 'https://host.name/api/v2/my/withdrawals/patterns/1' \
--header 'Authorization: Bearer <token>'
Response
In case of success, no response body is returned.