Skip to content

Pay out of a vault

POST
/v1/payments
curl --request POST \
--url https://api.sotirea.com/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: example' \
--data '{ "amount": "example", "asset": "example", "chain_id": "example", "reference": "example", "to": "example", "vault_id": 1 }'

Asks for a payment and answers at once, 202, with the payment as it now stands; follow it with GET /v1/payments/{id}. Your organisation’s payment rules apply as they do to a person: a payment they refuse is answered 403 with the rule’s name in fields.rule, and one that needs approval is awaiting_approval until people in your organisation agree. Nobody who created this key, or gave it a new secret, can approve it. The network fee is paid from your gas pool, never from the amount.

Idempotency-Key
required
string
/^[A-Za-z0-9._:-]{1,64}$/

Names this payment, 1 to 64 letters, digits, dots, dashes, underscores or colons, such as your own order id. The same key repeats the same payment; the same key with a different payment is refused 409.

Media typeapplication/json
object
amount
required

How much, in the asset’s smallest unit: 1.5 of an asset with 18 decimals is 1500000000000000000.

string
asset

Native for the network’s own coin, the default, or a token’s contract address.

string
chain_id

The network, needed only when the vault is open on more than one.

string
reference

Your own id for the payment, such as an order or payout id: 1 to 128 characters with no spaces. It comes back on every answer and webhook about the payment, and GET /v1/payments?reference= finds it. Unlike the Idempotency-Key it need not be unique.

string
to
required

The address to pay.

string
vault_id
required

The vault to pay out of.

integer

Example generated

{
"amount": "example",
"asset": "example",
"chain_id": "example",
"reference": "example",
"to": "example",
"vault_id": 1
}

Done.

Media typeapplication/json
object
data
required
object
amount
required

In the asset’s smallest unit.

string
approvals_given
required
integer
approvals_required
required

How many people must agree before it is sent; 0 when it needs no approval.

integer
asset
required
string
chain_id
required
string
chain_name
required
string
created_at
required
string format: date-time
decimals
required
Any of:
integer
error
required
Any of:
string
from
required
string
held_by
required
Any of:
string
id
required

The payment’s id: api::.

string
paused
required

The network or asset is not available right now: a payment waiting cannot be approved or sent until it is. One already sent is still followed to the end.

boolean
purpose
required

Payment, asked for by a person or a key; or sweep, sent by one of your sweep rules from a deposit vault into one of your own vaults.

string
recognised
required

True for the network’s coin and for tokens on Sotirea’s recognised list. Any other token’s symbol is whatever its contract calls itself, so do not trust it by name.

boolean
reference
required
Any of:
string
requested_by_name
required
string
sent_at
required
Any of:
string format: date-time
settled_at
required
Any of:
string format: date-time
status
required

Requested, awaiting_approval, awaiting_gas, signed, sent, confirmed, failed or stuck. New statuses may be added: treat one you do not know as still in progress.

string
symbol
required
string
to
required
string
tx_hash
required
Any of:
string
vault_id
required
Any of:
integer
vault_name
required
string
meta
object
request_id

Quote it when asking about a request; it is in the X-Request-Id header too.

string
success
required

Example

{
"success": true
}

Refused or failed, in words a person can act on.

Media typeapplication/json
object
error
required
object
code
required
string
fields
object
key
additional properties
string
message
required
string
meta
object
request_id

Quote it when asking about a request.

string
success
required

Example

{
"success": false
}