# Example API Calls

## Getting Your Balance

How to fetch your available and pending balance.

```
$ curl 'https://api.vaultoro.com/v1/private/balances' \
  -H 'VTOKEN: {TOKEN}'
```

The response will look a bit like this. Your pending balances represent orders you currently have places. To calculate your available balance, simply subtract your pending balance from your settled balance.

```
{
	"data": [{
		"type": "PENDING",
		"handle": "BTC",
		"quantity": "0.00000000"
	}, {
		"type": "SETTLED",
		"handle": "BTC",
		"quantity": "9998.04231521"
	}, {
		"type": "PENDING",
		"handle": "GOLD",
		"quantity": "17.0439"
	}, {
		"type": "SETTLED",
		"handle": "GOLD",
		"quantity": "100007.0439"
	}, {
		"type": "PENDING",
		"handle": "DASH",
		"quantity": "0.00000000"
	}, {
		"type": "SETTLED",
		"handle": "DASH",
		"quantity": "23.97600000"
	}, {
		"type": "PENDING",
		"handle": "SILVER",
		"quantity": "0"
	}, {
		"type": "SETTLED",
		"handle": "SILVER",
		"quantity": "50000"
	}]
}
```

## Creating an Order

The following will create a BUY order for 5 grams of Gold at 0.00050445 BTC.

```
curl -XPOST https://api.vaultoro.com/v1/private/orders \
-H "VTOKEN: $VTOKEN" \
-H 'Content-type: application/json' \
-d '{"pair": "GOLDBTC", "type": "BUY", "quantity": 5, "price": 0.00050445, "matchType": "LIMIT" }'
```

If successful, your response will look like this.

```
{
	"data": {
		"result": {
			"referenceId": "4kehxgp1keba8x4f",
			"createdAt": 1598440574
		}
	}
}
```

To **cancel** this order, use the referenceId returned.

```
curl -XDELETE https://api.vaultoro.com/v1/private/orders/4kehxgp1keba8x4f  \
-H "VTOKEN: $VTOKEN" \
-H 'Content-type: application/json'
```

If successful, you will receive the following response.

```
{
	"data": {
		"cancelled": true
	}
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api-docs.vaultoro.com/example-api-calls.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
