> For the complete documentation index, see [llms.txt](https://docs.afx.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.afx.xyz/api-reference/exchange/vault.md).

# Vault

## Vault Deposit

> Deposit funds into a vault.\
> \
> \*\*Signature:\*\* Agent · \*\*Protobuf:\*\* \`MsgVaultDeposit\`\
> \
> \`\`\`protobuf\
> message MsgVaultDeposit {\
> &#x20; string vault         = 1;\
> &#x20; string amount        = 2;\
> &#x20; int64  currency\_code = 3;\
> }\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"servers":[{"url":"https://api.afx.xyz","description":"Mainnet"},{"url":"https://api-testnet.afx.xyz","description":"Testnet"}],"paths":{"/exchange/vaultDeposit":{"post":{"operationId":"vaultDeposit","summary":"Vault Deposit","tags":["Vault"],"description":"Deposit funds into a vault.\n\n**Signature:** Agent · **Protobuf:** `MsgVaultDeposit`\n\n```protobuf\nmessage MsgVaultDeposit {\n  string vault         = 1;\n  string amount        = 2;\n  int64  currency_code = 3;\n}\n```\n","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{"200":{"$ref":"#/components/responses/ExchangeOk"}}}}},"components":{"responses":{"ExchangeOk":{"description":"Transaction submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeResponse"}}}}},"schemas":{"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}}}}
````

## Vault Withdraw

> Withdraw from a vault by share amount. Use the user's withdrawable vault shares, not a USDC amount.\
> \
> \*\*Signature:\*\* Agent · \*\*Protobuf:\*\* \`MsgVaultWithdraw\`\
> \
> \`\`\`protobuf\
> message MsgVaultWithdraw {\
> &#x20; string vault         = 1;\
> &#x20; string share         = 2;\
> &#x20; int64  currency\_code = 3;\
> }\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"servers":[{"url":"https://api.afx.xyz","description":"Mainnet"},{"url":"https://api-testnet.afx.xyz","description":"Testnet"}],"paths":{"/exchange/vaultWithdraw":{"post":{"operationId":"vaultWithdraw","summary":"Vault Withdraw","tags":["Vault"],"description":"Withdraw from a vault by share amount. Use the user's withdrawable vault shares, not a USDC amount.\n\n**Signature:** Agent · **Protobuf:** `MsgVaultWithdraw`\n\n```protobuf\nmessage MsgVaultWithdraw {\n  string vault         = 1;\n  string share         = 2;\n  int64  currency_code = 3;\n}\n```\n","requestBody":{"required":true,"content":{"application/json":{}}},"responses":{"200":{"$ref":"#/components/responses/ExchangeOk"}}}}},"components":{"responses":{"ExchangeOk":{"description":"Transaction submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeResponse"}}}}},"schemas":{"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}}}}
````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.afx.xyz/api-reference/exchange/vault.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.
