Treasury
Deposits
GET /treasury/deposits
Get a list of all deposits.
Query parameters
- system_created_at_from
- system_created_at_to
- foreign_id
- state
Response
OK
{
"success": true,
"data": []model.Deposit
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/deposits/:deposit_id
Get a sepcific deposit by id.
Response
OK
{
"success": true,
"data": model.Deposit
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/deposits/:deposit_id/assignments
Get a list of assignments for this deposit.
Response
OK
{
"success": true,
"data": []model.DepositAssignment
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/deposits/:deposit_id/assignments
Create a new assignment
Request
[
{
"quantity": "2",
"account_id": "2fc830e4-20bc-4c62-9d12-97b6a07d065c"
},
{
"quantity": "30.959",
"account_id": "59012e87-f445-4149-8388-fdac7fa3d933"
}
]
Attributes
Pass a list of assignment quantities
quantity
The quantity of the total deposit that should be assigned to the account.account_id
: The id of the account the quantity should be assigned to.
Response
OK
{
"success": true,
"data": model.DepositAssignment
}
Error
- error.BadRequestError
- error.InternalServerError
PATCH /treasury/deposits/:deposit_id/assignments
Set the Deposit Assignment State of an existing Deposit Assignment
Request
{
"id": "6e9aa4c4-b405-4f97-b198-f8b3e6a19d49",
"status": "REJECTED"
}
Attributes
id
The id of the assignment.status
: Enum.DepositAssignmentState. Allowed transitions arePENDING
toREJECTED
,PENDING
toSUCCESSFUL
andREJECTED
toSUCCESSFUL
.
Response
OK
{
"success": true,
"data": model.DepositAssignment
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/deposits/:deposit_id/rectifications
Get a list of assignment rectifications for this deposit.
Response
OK
{
"success": true,
"data": []model.DepositAssignmentRectification
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/deposits/:deposit_id/rectifications
Rectify the deposit
Request
{
"reason": enum.DepositAssignmentRectificationReason,
"note": "Test Note",
"origins": [
"f72bcf03-b350-4910-805c-b75ecebc6125",
"e589c6f1-6057-48e0-80a9-bde766272b94"
],
"targets": [
{
"quantity": "1",
"account_id": "7c88083b-f4f7-4a96-a83e-8503d5376de4"
},
{
"quantity": "30.959",
"account_id": "22827471-d83a-4702-9c1d-4d9691dd023f"
},
{
"quantity": "1",
"account_id": "11a2774b-206c-4878-a561-54c324a24270"
}
]
}
Attributes
reason
The reason for the rectification.note
: An optional note.origins
: The original assignments that should be rectified.targets
: The accounts to be booked instead. The total of all quantities must match the original total.quantity
The quantity of the total deposit that should be assigned to the account.account_id
: The id of the account the quantity should be assigned to.
Response
OK
{
"success": true,
"data": model.DepositAssignmentRectification
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/account/:account_id/deposits/assignments
Get a list of assignments for this account.
Response
OK
{
"success": true,
"data": []model.DepositAssignment
}
Error
- error.BadRequestError
- error.InternalServerError
Routes
GET /treasury/wallets/routes
Get a list of all treasury routes
Query parameters
- workspace
- id
- from_wallet_id
- to_wallet_id
- protocol
Response
OK
{
"success": true,
"data": []Model.TreasuryRoutes
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/wallets/routes
Creates a new treasury route
When creating a treasury route, the fields in the from
and to
part of the request vary depending on the wallets and the protocol used.
To determine the fields required for the from
and to
part of your request, use the following API endpoint:
GET /treasury/wallets/routes/fields/:from_wallet_id/:protocol
To determine the fields required for the from
part of your request, use the following API endpoint:
GET /treasury/wallets/routes/fields/:from_wallet_id/:protocol
Request
{
"from_wallet_id": "ab39c06f-9dd0-4ad4-a9b4-7bfb6848bda2",
"to_wallet_id": "318117d0-c99d-4cc0-8170-55b61ab11cef",
"protocol": "Stellar Lumens XLM",
"label": "Test API Route",
"transfer": {
"from": {
"key":"my_withraw_key", #e.g. for kraken
"destination_external_account_id":"ab39c06f-9dd0-4ad4-a9b4-7bfb6848bda2", #e.g. white listed wallers for fireblocks
"source_vault_account_id":"5" #e.g. for fireblocks wallets
}
}
}
{
"from_wallet_id":"40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"to_wallet_id":"40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"protocol":"LTC",
"label":"test route",
"transfer":{
"from":{
"destination_external_account_id":"external_wallet_id",#e.g. for fireblocks
"source_vault_account_id":"1"#vault account id
},
"to": {
"tag":"3669176685" #e.g If a tag is required on the destination side.
}
}
}
Request examples for a Fiat outgoing route (Bank Frick)
{
"from_wallet_id": "40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"to_wallet_id": "40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"protocol": "LTC",
"label": "test route",
"protocol": "SEPA",
"transfer": {
"to": {
"name": "Creditor Name",
"reference": "Payment Reference"
}
}
}
Attributes
from_wallet_id
: The source wallet. The wallet asset has to be the same as in the destination wallet.to_wallet_id
: The destination wallet. The wallet asset has to be the same as in the source wallet.protocol
: The transfer protocol for the transferred assetlabel
: A legible display name.transfer
: Venue-specific information.
Optional Attributes for the from
and to
block
-
Fireblocks
source_vault_account_id
: The fireblocks vault (wallet collection) that should be used as source for this route. The combination of vault_account_id, asset and protocol defines a unique wallet in fireblocks.destination_external_account_id
: The fireblocks unique id of the whitelisting collection in which the desired destination address is, or should be, whitelisted. If this is left empty a new one is created *. ( *Once the route has been saved, use the endpointPUT /treasury/wallets/routes/:route_id/allow
to whiteliste it on fireblocks)
-
Bank Frick
name
: The name of the recipient.bic
: The bic of the recipient credit institution (only protocol = FOREIGN).credit_institution
: The recipient credit institution (only protocol = FOREIGN).aba
: The aba routing number of the recipient credit institution (only protocol = FOREIGN).reference
: Payment Reference.
Response
OK
{
"success": true,
"data": Model.TreasuryRoute
}
Error
- error.BadRequestError
- error.InternalServerError
PUT /treasury/wallets/routes/:route_id
Edit a existing treasury route
When creating or editing a treasury route, the fields in the from
and to
part of the request vary depending on the wallets and the protocol used.
To determine the fields required for the from
and to
part of your request, use the following API endpoint:
GET /treasury/wallets/routes/fields/:from_wallet_id/:protocol
Request
{
"from_wallet_id": "ab39c06f-9dd0-4ad4-a9b4-7bfb6848bda2",
"to_wallet_id": "318117d0-c99d-4cc0-8170-55b61ab11cef",
"protocol": "Stellar Lumens XLM",
"label": "Test API Route",
"transfer": {
"from": {
"key":"my_withraw_key", #e.g. for kraken
"destination_external_account_id":"ab39c06f-9dd0-4ad4-a9b4-7bfb6848bda2", #e.g. white listed wallers for fireblocks
"source_vault_account_id":"5" #e.g. for fireblocks wallets
}
}
}
{
"from_wallet_id":"40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"to_wallet_id":"40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"protocol":"LTC",
"label":"test route",
"transfer":{
"from":{
"destination_external_account_id":"external_wallet_id",#e.g. for fireblocks
"source_vault_account_id":"1"#vault account id
},
"to": {
"tag":"3669176685" #e.g If a tag is required on the destination side.
}
}
}
Request examples for a Fiat outgoing route (Bank Frick)
{
"from_wallet_id": "40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"to_wallet_id": "40d1cf0d-459a-47e0-82a5-cf112cc04f67",
"protocol": "LTC",
"label": "test route",
"protocol": "FOREIGN",
"transfer": {
"to": {
"name": "Creditor Name",
"bic": "bic",
"credit_institution": "credit inst",
"aba": "aba nr",
"reference": "Payment Reference"
}
}
}
Attributes
from_wallet_id
: The source wallet. The wallet asset has to be the same as in the destination wallet.to_wallet_id
: The destination wallet. The wallet asset has to be the same as in the source wallet.protocol
: The transfer protocol for the transferred assetlabel
: A legible display name.transfer
: Venue-specific information.
Optional Attributes for the from
and to
block
-
Fireblocks
source_vault_account_id
: The fireblocks vault (wallet collection) that should be used as source for this route. The combination of vault_account_id, asset and protocol defines a unique wallet in fireblocks.destination_external_account_id
: The fireblocks unique id of the whitelisting collection in which the desired destination address is, or should be, whitelisted. If this is left empty a new one is created *. ( *Once the route has been saved, use the endpointPUT /treasury/wallets/routes/:route_id/allow
to whiteliste it on fireblocks)
-
Bank Frick
name
: The name of the recipient.bic
: The bic of the recipient credit institution (only protocol = FOREIGN).credit_institution
: The recipient credit institution (only protocol = FOREIGN).aba
: The aba routing number of the recipient credit institution (only protocol = FOREIGN).reference
: Payment Reference.
Response
OK
{
"success": true,
"data": Model.TreasuryRoute
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/wallets/routes/:route_id/estimate-fee
Request
{
"quantity": "2"
}
Attributes
quantity
: The quantity that is to be transferred via this route and on the basis of which a fee is to be determined.
Response
OK
"success": true,
"data": {
"asset": "XLM",
"custom": true,
"speed_levels": {
"DEFAULT": {
"fee": "0.05"
},
"FAST": {
"fee": "0.1"
},
"SLOW": {
"fee": "0.0005001"
}
}
}
Error
- error.BadRequestError
- error.InternalServerError
PUT /treasury/wallets/routes/:route_id/allow
Sets the destination of a route to the allow-list of the underlying venue
This feature is currently supported only by Fireblocks venue
Request
{
"from_wallet_id": "3925gft-a25d-4e32-b887-e961235h338",
"to_wallet_id": "282bg9f6-640a-4860-b5e9-4af0458sferg",
"label": "Test Route",
"transfer": {
"from": {
"destination_external_account_id": "145tref6-640a-4860-b5e9-4af0458sferg",
"source_vault_account_id": "5"
}
},
"settlement": {}
}
Response
OK
{
"success": true,
"data": {
"id": "65155166-19d6-4dca-8872-21eef0833065",
"workspace": "trever",
"label": "ADA Fireblocks → Kraken (TEST)",
"from_wallet_id": "7c5c5509-c19f-43a8-a910-53f6cddf0832",
"to_wallet_id": "43d911a8-bdf6-46ce-8750-e9c5224c567e",
"protocol": "ADA",
"transfer": {
"from": {
"destination_external_account_id": "ad63a4ff-73d1-41f9-9ac9-7d258887d015",
"source_vault_account_id": "7"
},
"to": {
"on_allowlist": true
}
},
"settlement": {},
"from_wallet": Model.Wallet
,
"to_wallet": Model.Wallet
,
}
}
Error
- error.BadRequestError
- error.InternalServerError
Settlements
GET /settlements
Get a list of Settlements
Response
OK
{
"success": true,
"data": []model.Settlement
}
Error
- error.InternalServerError
GET /settlements/:settlement_id/available-fills
Get a list of available fills for a settlements
Query parameters
- venue_id: Defines the venue for which the fills are to be searched. (required)
Response
OK
{
"success": true,
"data": []model.Fill
}
Error
- error.InternalServerError
GET /settlements/fills/:fill_id
Get a fill by ID
Response
OK
{
"success": true,
"data": model.Fill
}
Error
- error.BadRequestError
- error.InternalServerError
POST /settlements
Create a new Settlement
Request
{
"timerange_from": 1713935575,
"timerange_to": 1714108375
}
Response
OK
{
"success": true,
"data": model.Settlement
}
Error
- error.BadRequestError
- error.InternalServerError
Treasury Jobs
GET /treasury/jobs
Get a list of Transfer Jobs
Response
OK
{
"success": true,
"data": []model.TreasuryJob
}
Error
- error.InternalServerError
POST /treasury/jobs
Create a new Transfer Job
Request
{
"route": "1340c458-35c6-4196-bf23-c404b1ab645f",
"condition_type": "SWEEPING",
"active": true,
"speed_level": "CUSTOM",
"fee": "0.0250005",
"interval": 1,
"min_quantity": "30",
"conditions": [
{
"target": "20"
}
]
}
{
"route": "1340c458-35c6-4196-bf23-c404b1ab645f",
"condition_type": "PROVISION",
"active": true,
"speed_level": "FAST",
"fee": null,
"min_quantity": "40",
"interval": 12,
"conditions": [
{
"target": "250"
}
]
}
{
"route": "1340c458-35c6-4196-bf23-c404b1ab645f",
"condition_type": "CONDITIONAL",
"active": true,
"interval": 240,
"speed_level": "DEFAULT",
"fee": null,
"quantity": "50",
"conditions": [
{
"balance_side": "from",
"predicate": "GT",
"quantity": "100"
},
{
"balance_side": "to",
"predicate": "LT",
"quantity": "500"
}
]
}
Attributes
route
: The Treasury route to use for the transaction.condition_type
: enum.ConditionTypeactive
: Boolean to specify whether or not the job should be active after creation.interval
: The interval between job executions in minutes. Choose between 15, 30, 60, or 240 (4h), 720 (12h) or 1440 (24h).speed_level
: Supported speed levels from the underlying venue. Slow = low fee, Fast = High fee.fee
: Ifspeed_level
isCUSTOM
a fee can be set. Note: Not all venues support custom fee.min_quantity
: Set a minimum quantity for a transaction to avoid too many small transactions.conditions
: The set of conditions that have to be met.Model.TreasuryJobCondition
.
Optional
quantity
: The amount to be transferred. Only required for condition_typeCONDITIONAL
.
Response
OK
{
"success": true,
"data": model.TransferJob
}
Error
- error.BadRequestError
- error.InternalServerError
PUT /treasury/jobs
Edit an existing Transfer Job
Request
{
"id":"c9bd97f4-5322-4e70-a7f6-29f34cd5e765",
"route":"1340c458-35c6-4196-bf23-c404b1ab645f",
"active":false,
"speed_level": "CUSTOM",
"fee": "0.0250005",
"interval":15,
"min_quantity": "30",
"condition_type":enum.ConditionType,
"conditions":[
{
"target":"200"
}
]
}
Attributes
id
: The id of the job that should be edited.route
: The Treasury route to use for the transaction.active
: Boolean to specify whether or not the job should be active after creation.interval
: The interval between job executions in minutes. Choose between 15, 30, 60, or 240 (4h), 720 (12h) or 1440 (24h).speed_level
: Supported speed levels from the underlying venue. Slow = low fee, Fast = High fee.fee
: Ifspeed_level
isCUSTOM
a fee can be set. Note: Not all venues support custom fee.min_quantity
: Set a minimum quantity for a transaction to avoid too many small transactions.condition_type
: enum.ConditionTypeconditions
: The set of conditions that have to be met. Model.TreasuryJobCondition.
Optional
quantity
: The amount to be transferred. Only required for condition_typeCONDITIONAL
.
Response
OK
{
"success": true,
"data": model.TreasuryJob
}
Error
- error.BadRequestError
- error.InternalServerError
Wallets
GET /treasury/wallets
Get a list of all wallets
Query parameters
- id
- address
- reference_text
- foreign_id
- service_id
- venue_id
- customer_id
Response
OK
{
"success": true,
"data": []model.Wallet
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/wallets/:wallet_id
Get a particular wallet by its id
Response
OK
{
"success": true,
"data": []model.Wallet
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/wallets/:wallet_id/balance
Get balances for a particular wallet
Response
OK
{
"success": true,
"data": {
"free": "0.005515",
"used": "0",
"total": "0.005515",
"protocol": "BTC"
}
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/wallets
Create a new Wallet
Request
{
"type": enum.WalletType,
"asset": "XLM",
"address": "0x78768e7r8w7e68r76we8r8wer88",
"label": "API Test Wallet",
"service_id": "181c9bf0-8781-4c09-9f21-1ffd8cabfd2e",
"account_id": "842c84c4-c013-4abc-bd39-40103d453b9b",
"access_type": enum.WalletAccessType,
"customer_id":"bf95ec68-fb51-4a17-b70c-c8dd0a4d2455",
"configuration": {}
}
{
"type": enum.WalletType,
"asset":"LTC",
"address":"",
"label":"LTC - Fireblocks Venue Wallet",
"service_id":"49dd5b29-5963-4e5c-b7c9-f9604857f2e0",
"venue_id":"3517699f-b753-411a-80a7-a4da56f24475",
"account_id":"20d4d3bd-c1a0-4816-a882-e7db73a21ff9",
"customer_id":"bf95ec68-fb51-4a17-b70c-c8dd0a4d2455",
"configuration":{
"create_external_wallet":true,
"protocol":"LTC",
"vault_id":"16",
"vault_name":"My Vault"
},
"access_type": enum.WalletAccessType
}
Attributes
type
Wallet type can be Venue to manage VENUE Accounts for e.g. Omnibus Wallet or Settlements. Can be CUSTOMER to manage external and internal customer wallets.asset
: The Asset (Crypto or Fiat) that should be stored on the wallet.address
: the blockchain address or the IBAN, can be empty ifcreate_external_wallet
is set totrue
label
: A legible display name.service_id
: The underlying WOMS Service.venue_id
: The venue behind the service. Only mandatory if type isVENUE
.account_id
: The account behind that wallet. Can be a customer account or a venue/trading account.customer_id
: Mandatory if type isCUSTOMER
. The id of the customer to whom the wallet is to be assigned.configuration
: Venue specific information.access_type
can be EXTERNAL or INTERNAL. Venue wallets always require a Venue_id and an underlying service and are therefore always of type INTERNAL. Customer wallets can be INTERNAL if venue_id and service_id are passed and EXTERNAL if not.
Optional Configurations for Venues
Fireblocks
create_external_wallet
: if true the wallet will be created on the venue. A new address is generated on the venue and stored in the wallet on Trever.protocol
: In Fireblocks the wallet needs an asset and a protocol on creation. To see all supported assets and their protocols go to the venue screen in Trever.vault_id
: the id of the vault (collection of wallets, one wallet per asset in one vault) the wallet should be stored in. If left empty, a new vault is created and stored in the wallet in Trever.vault_name
: OPTIONAL. If acreate_external_wallet
is set to true and novault_id
is passed, a new vault account on fireblocks is created. In this case the user has the option to name the new vault. If this novault_name
is passed, the name will be ’trever - [uuid]'
Tangany
create_external_wallet
: if true the wallet will be created on the venue. A new address is generated on the venue and stored in the wallet on Trever.customer_id
: The account id that should be used to create the wallet.wallet_id
: If an existing wallet should be used.
Bank Frick
customer_number
: The customer number of the connected venue.customer_account_number
: The account number for this sub account at Bank Frick.
Response
OK
{
"success": true,
"data": model.Wallet
}
Error
- error.BadRequestError
- error.InternalServerError
PUT /treasury/wallets/:wallet_id
Edit a Wallet
Request
{
"type": enum.WalletType,
"asset": "XLM",
"address": "0x78768e7r8w7e68r76we8r8wer88",
"label": "API Test Wallet",
"service_id": "181c9bf0-8781-4c09-9f21-1ffd8cabfd2e",
"venue_id": "8ca97202-910a-46dc-8976-ee217f1d1bb6",
"account_id": "842c84c4-c013-4abc-bd39-40103d453b9b",
"matching_configurations": [],
"configuration": [],
"access_type": enum.WalletAccessType,
"customer_id":"bf95ec68-fb51-4a17-b70c-c8dd0a4d2455",
}
Attributes
type
Wallet type can be Venue to manage VENUE Accounts for e.g. Omnibus Wallet or Settlements. Can be CUSTOMER to manage external and internal customer wallets.asset
: The Asset (Crypto or Fiat) that should be stored on the wallet.address
: the blockchain address or the IBAN, can be empty ifcreate_external_wallet
is set totrue
label
: A legible display name.service_id
: The underlying WOMS Service.venue_id
: The venue behind the service. Only mandatory if type isVENUE
.account_id
: The account behind that wallet. Can be a customer account or a venue/trading account.customer_id
: Mandatory if type isCUSTOMER
. The id of the customer to whom the wallet is to be assigned.configuration
: Venue specific information.access_type
can be EXTERNAL or INTERNAL. Venue wallets always require a Venue_id and an underlying service and are therefore always of type INTERNAL. Customer wallets can be INTERNAL if venue_id and service_id are passed and EXTERNAL if not.
Optional Configurations for Venues
Fireblocks
- Once the
create_external_wallet
option is set to true, changes made to this wallet will be ignored by the backend. Except changing the label, type or customer and customer account.
Tangany
- Once the
create_external_wallet
option is set to true, changes made to this wallet will be ignored by the backend. Except changing the label, type or customer and customer account.
Response
OK
{
"success": true,
"data": model.Wallet
}
Error
- error.BadRequestError
- error.InternalServerError
Withdrawals
GET /treasury/withdrawals
Get a list of all withdrawals.
Response
OK
{
"success": true,
"data": []model.Withdrawal
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/withdrawals/:withdrawals_id
Get one withdrawal by id.
Response
OK
{
"success": true,
"data": model.Withdrawal
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/wallets/routes/:treasury_route_id/withdrawals
Creates a new withdrawal for a treasury route
Request
{
"fee": "0.009999",
"quantity": "30",
"note": "API test withdrawal",
"speed_level": "SLOW",
"account": "0306ce84-def9-4400-a977-be1a150e6728"
}
Attributes
fee
: The fee estimated by the venue according to the selected speed_level (see/treasury/wallets/routes/:route_id/estimate-fee
). If the selected level iscustom
the fee can be set by the user.quantity
: Quantity of the assets that should be withdrawn according to the selected treasury routenote
: An optional note textspeed_level
: The selected fee/speed level. Slow = Low Fee. Fast = High Fee.account_id
: Optional. The account to which a withdrawal is to be assigned. The amount of the transaction is blocked on this account until the withdrawal was successful or was rejected.
Response
OK
{
"success": true,
"data": Model.Withdrawal
}
Error
- error.BadRequestError
- error.InternalServerError
Batch Withdrawals
POST /treasury/withdrawals/batch/prepare
Takes a list of withdrawals and creates a batch withdrawal if possible.
Every withdrawal needs a route_id
, a quantity
and a speed_level
. Optionally it can take a note
and an account_id
(the account that should be used to lock the submitted amount). Withdrawals with the same asset, destination wallet and speed_level will be bundled to one withdrawal. The response of this call will show you which withdrawals are batched to one. This response can be passed to the second submit endpoint, mentioned below.
Custom fee is not possible for this endpoint.
Request
{
"withdrawals": [
{
"route_id": "b7723959-4a01-4e56-a27b-aeb8da293ea5",
"quantity": "0.1",
"speed_level": "SLOW",
"account_id": "2fc830e4-20bc-4c62-9d12-97b6a07d065c"
},
{
"route_id": "abade1f0-f0bf-4e91-a27e-8745d0d7d407",
"quantity": "0.1",
"speed_level": "SLOW",
"account_id": "59012e87-f445-4149-8388-fdac7fa3d933"
},
{
"route_id": "c62f3429-056a-41f6-8e51-4fc5a44553ef",
"quantity": "0.1",
"speed_level": "SLOW",
"account_id": "d0d182a4-5036-48e8-a902-a85f4dfbd5c5"
}
]
}
Attributes
route_id
: The treasury route that should be used for this withdrawal. To find out whether a withdrawal can be bundled, the asset and the source wallet of this route are used.quantity
: Quantity of the assets that should be withdrawn according to the selected treasury routenote
: An optional note textspeed_level
: Enum.BatchWithdrawalSpeedLevel The selected fee/speed level. Slow = Low Fee. Fast = High Fee.account_id
: The selected account will be used to lock the quantity. If the withdrawal is successful, the withdrawal is assigned to this account and the amount is deducted from its balance. If the withdrawal is not successful, the amount will be unlocked.
Response
OK
{
"success": true,
"data": []Model.BatchWithdrawalRequest
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/withdrawals/batch/submit
Takes the response of the prepare endpoint and initiates the resulting withdrawals. The response of the first named endpoint can consist of one or more withdrawals. Withdrawals that cannot be bundled into one are executed separately. It is recommended that you do not fill the payload of this endpoint yourself but only use valid answers from the prepare endpoint.
Request
{
"withdrawals": []Model.BatchWithdrawalRequest
}
Response
OK
{
"success": true,
"data": []Model.Withdrawal
}
Error
- error.BadRequestError
- error.InternalServerError
Withdrawal Assignments
GET /treasury/withdrawals/:withdrawal_id/assignments
Get a list of assignments for this withdrawal.
Response
OK
{
"success": true,
"data": []model.WithdrawalAssignment
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/withdrawals/:withdrawal_id/assignments
Create a new assignment
Request
[
{
"quantity": "2",
"account_id": "2fc830e4-20bc-4c62-9d12-97b6a07d065c"
},
{
"quantity": "30.959",
"account_id": "59012e87-f445-4149-8388-fdac7fa3d933"
}
]
Attributes
Pass a list of assignment quantities
quantity
The quantity of the total withdrawal that should be assigned to the account.account_id
: The id of the account the quantity should be assigned to.
Response
OK
{
"success": true,
"data": model.WithdrawalAssignment
}
Error
- error.BadRequestError
- error.InternalServerError
PATCH /treasury/withdrawals/:withdrawal_id/assignments
Set the Withdrawal Assignment State of an existing withdrawal Assignment
Request
{
"id": "6e9aa4c4-b405-4f97-b198-f8b3e6a19d49",
"status": "REJECTED"
}
Attributes
id
The id of the assignment.status
: Enum.WithdrawalAssignmentState. Allowed transitions arePENDING
toREJECTED
,PENDING
toSUCCESSFUL
andREJECTED
toSUCCESSFUL
.
Response
OK
{
"success": true,
"data": model.WithdrawalAssignment
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/withdrawals/:withdrawal_id/rectifications
Get a list of assignment rectifications for this withdrawal.
Response
OK
{
"success": true,
"data": []model.WithdrawalAssignmentRectification
}
Error
- error.BadRequestError
- error.InternalServerError
POST /treasury/withdrawals/:withdrawal_id/rectifications
Rectify the withdrawal
Request
{
"reason": enum.WithdrawalAssignmentRectificationReason,
"note": "Test Note",
"origins": [
"f72bcf03-b350-4910-805c-b75ecebc6125",
"e589c6f1-6057-48e0-80a9-bde766272b94"
],
"targets": [
{
"quantity": "1",
"account_id": "7c88083b-f4f7-4a96-a83e-8503d5376de4"
},
{
"quantity": "30.959",
"account_id": "22827471-d83a-4702-9c1d-4d9691dd023f"
},
{
"quantity": "1",
"account_id": "11a2774b-206c-4878-a561-54c324a24270"
}
]
}
Attributes
reason
The reason for the rectification.note
: An optional note.origins
: The original assignments that should be rectified.targets
: The accounts to be booked instead. The total of all quantities must match the original total.quantity
The quantity of the total withdrawal that should be assigned to the account.account_id
: The id of the account the quantity should be assigned to.
Response
OK
{
"success": true,
"data": model.WithdrawalAssignmentRectification
}
Error
- error.BadRequestError
- error.InternalServerError
GET /treasury/account/:account_id/withdrawals/assignments
Get a list of assignments for this account.
Response
OK
{
"success": true,
"data": []model.WithdrawalAssignment
}
Error
- error.BadRequestError
- error.InternalServerError