Skip to main content
Version: testnet (v0.77)

API endpoints

While there are hundreds of available endpoints, the categories below cover the basics to get you started.

Submit transactions

You can submit a transaction with POST /transaction. You'll need a Vega Wallet app or signer library to prepare your transaction before sending.

If you use Go, you can import Vega as a dependency, and use the code under wallet/pkg ↗ to sign and send your transaction.

DescriptionDocumentationCall
Submit a transactionSubmit transactionPOST /transaction
Get blockchain heightList partiesGET /blockchain/height
Get the current Vega timeList partiesGET /time
Check your spam statisticsList partiesGET /spam/statistics

Transaction samples

Follow the guide to sending transactions to sign and send using the command line wallet.

Submit order

This is a partial example of an order submission.

{
"orderSubmission": {
"marketId": "1234",
"price": "42",
"size":10,
"side": "SIDE_BUY",
"timeInForce": "TIME_IN_FORCE_FOK",
"type": "TYPE_LIMIT"
}
}

See the commands API for all fields, including optionals.

Amend order

Change an existing order. If you leave a field unset - if it was used on your original order - or with a default value, the field's value will not change.

{
"orderAmendment": {
"marketId": "1234",
"price": "42",
"sizeDelta":10,
"side": "SIDE_BUY",
"timeInForce": "TIME_IN_FORCE_FOK",
"type": "TYPE_LIMIT"
}
}

See the commands API for all fields, including optionals.

Cancel order

Cancel an existing order, or all orders on a market. If you use the market ID, it will cancel all orders on that market.

{
"orderCancellation": {
"orderId": "42",
}
}

Submit stop orders

Submit a stop order - a normal order that remains off the order book and is only submitted if a given trigger is breached from a particular direction. If both rises-above and falls-below are configured, then if one is triggered the other will be cancelled (OCO).

{
"stopOrdersSubmission": {
"OrderSubmission": {
"marketId": "1234",
"price": "42",
"size":10,
"side": "SIDE_BUY",
"timeInForce": "TIME_IN_FORCE_FOK",
"type": "TYPE_LIMIT"
}
"expiresAt": "42",
"expiryStrategy":10,
"sizeOverrideSetting": "SIDE_BUY",
"sizeOverrideValue": "TIME_IN_FORCE_FOK",
"trailingPercentOffset": "TYPE_LIMIT",
"price": "TYPE_LIMIT"
}
}

Cancel stop order

Cancel untriggered stop orders by specifing which stop order using its ID, or cancel all your stop orders on a given market using the market ID. If any cancelled stop order is part of an OCO, both stop orders will be cancelled.

{
"stopOrdersCancellation": {
"orderId": "42",
}
}

Switch between cross and isolated margin

Change the margin mode you're using on a market by including the mode to switch to. When changing to isolated margin mode, include the margin amount you want as a decimal amount where 1 = 100%.

{
"updateMarginMode": {
"marketId" "1234"
"mode": "MODE_ISOLATED_MARGIN",
"marginFactor": "0.2"
}
}

Parties

A party is a single user, defined as a Vega public key. As one person or entity can have many public keys, this is a unique identifier as far as an individual key's actions. Party ID and public key (pubkey) are all names for the same thing.

DescriptionDocumentationCall
See a paginated list of partiesList partiesGET /api/v2/parties

Assets

Assets used on Vega originate on external chains, not the Vega chain.

Inter-chain asset interactions can be:

  • Between Vega and Ethereum, and facilitated through the Ethereum bridge.
  • Between Vega and Arbitrum, faciliated through the Arbitrum bridge.

Assets can only be added to the network to be used as collateral through a successful governance proposal and enactment, and a follow-on update to the relevant asset bridge.

DescriptionDocumentationCall
See all assets that can be used on the networkList assetsGET /api/v2/assets
Show a specific asset's detailsAssetGET /api/v2/asset/:assetId

Deposits and withdrawals

Assets used on the Vega network can be deposited using a web3 wallet:

  • Via the Ethereum bridge contract, for ERC-20 assets on Ethereum mainnet
  • Via the Arbitrum bridge, for assets on the Arbitrum mainnet network

Read more about the asset bridges.

Assets can be withdrawn back into an external wallet if they are not being used for margin, positions, or liquidity bond.

DescriptionDocumentationCall
See all deposits for a specific public keyList depositsGET /api/v2/deposits
See a specific deposit using its IDDepositGET /api/v2/deposit/:id
Understanding the concepts: accountsAccounts
Understanding the concepts: deposits and withdrawalsDeposits and withdrawals

Accounts

Vega relies on accounts to ensure funds are never lost or double spent. The amounts in each account, as well as the transactions that were added to and removed from those accounts, are all recorded and stored on-chain. Accounts are used either to hold assets that the public key holder is in control of using — such as deposited collateral, or for setting money aside that only the network can manage — to fulfil margin requirements, for example, or to store assets that are earmarked for rewards or paying out fees.

DescriptionDocumentationCall
List accounts based on chosen filtersList accountsGET /api/v2/accounts
Understanding the concepts: accountsAccounts

Governance proposals and voting

Governance proposals used to add new assets and markets, as well as to suggest changes to assets, markets, and network parameters, as well as off-chain suggestions. VEGA tokens need to be associated to the Vega public key that wants to take part in governance.

DescriptionDocumentationCall
View all governance proposals with their current state, paginatedList proposalsGET /api/v2/governances
Get detailed information about a specific governance proposal using its IDProposalGET /api/v2/governance
How to submit proposals using command lineSubmitting proposals
Understanding the concepts: GovernanceVega governance

Governance token

VEGA token are used for taking part in network, market, asset and freeform governance, and to secure the network by nominating validators that run the network.

DescriptionDocumentationCall
See a list of votesList votesGET /api/v2/votes
How to nominate validators using the smart contractsStake tokens
Understand the concepts: GovernanceVega governance