Guides
Transfer
Move balance between two accounts of the same customer, in the same asset, with no quote.
A transfer moves balance between two accounts of the same customer, in the same asset: the amount leaves the source account and arrives unchanged in the target account. There is no conversion. The API generates a consumed 1:1 quote and returns it on the response, so you do not create a quote. To change assets, run a swap first.
Prerequisites
- Two
ACTIVEaccounts of the same customer, with the asset enabled on both, and balance in the source.
1. Create the transfer
curl --request POST \
--url https://trace.mimicr.dev/v1/operations/transfers \
--header 'Authorization: Bearer <token>' \
--header 'X-Idempotency-Key: <uuid>' \
--header 'Content-Type: application/json' \
--data '{
"externalId": "tr-1",
"sourceAccountId": "<source-account-id>",
"targetAccountId": "<target-account-id>",
"amount": { "value": "50.00", "asset": "BRL" }
}'The response is 201 with the operation in REQUESTED. The operation's account is the source; the target shows up in intent:
"intent": {
"type": "TRANSFER",
"targetAccount": { "id": "e2a69317-7857-4a3e-973e-d727ab63b4f8", "owner": "Acme Filial Rio Ltda" }
},
"quote": {
"id": "15a2c4cb-48ca-47f8-8df6-3502a15ce6dd",
"effectiveRate": { "base": "BRL", "quote": "BRL", "value": "1.00" }
}| Error | When |
|---|---|
422 SAME_SOURCE_AND_TARGET | Source and target are the same |
422 TARGET_ACCOUNT_NOT_ACTIVE | Target not ACTIVE (details.status) |
422 SOURCE_ASSET_NOT_ENABLED or TARGET_ASSET_NOT_ENABLED | Asset not enabled on one of the accounts |
404 RESOURCE_NOT_FOUND | One of the accounts does not exist or belongs to another customer |
400 INVALID_DATA | amount or another required field is missing |
Reference: Create a transfer.
2. Track the transfer
The lifecycle is the same as a swap: about 1 s later PROCESSING (with a source balance check) and about 3 s later COMPLETED, with a DEBIT on the source and a CREDIT on the target. The webhooks are OPERATION_REQUESTED, OPERATION_PROCESSING and OPERATION_COMPLETED or OPERATION_FAILED.
curl --url https://trace.mimicr.dev/v1/accounts/<target-account-id>/balances \ --header 'Authorization: Bearer <token>'
Test it
To get two accounts and a balance quickly:
npx mimicr action trace account.create_active legalName="Acme Matriz Ltda" npx mimicr action trace account.create_active legalName="Acme Filial Rio Ltda" npx mimicr action trace account.receive_pix accountId=<source-account-id> amount=200.00
With autoSettleOperations off, the transfer waits for operation.settle or operation.fail. See Sandbox control.