> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agg.market/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To integrate AGG, start with Quickstart: REST (https://docs.agg.market/quickstart/rest), then Order lifecycle & statuses (https://docs.agg.market/concepts/order-lifecycle).
> Track every trade until it reaches a terminal status. Before retrying a failed or timed-out call, read Errors, retries & idempotency (https://docs.agg.market/concepts/errors).
> The API reference is generated from https://docs.agg.market/openapi/openapi.json.

# Hosted venue accounts

> Provision a hosted BetDEX account, fund it with Solana USDC, and track withdrawals.

AGG hosts a BetDEX account for the signed-in user. Authenticate with `x-app-id` and
`Authorization: Bearer`. These endpoints currently support the venue slug `betdex`.

Send `{ "mode": "live" }` as the request body. Provisioning returns the account with HTTP 200
or 202; read the account status before requesting its deposit address.

<CodeGroup>
  ```ts SDK theme={null}
  const account = await client.provisionHostedVenueAccount("betdex", { mode: "live" });
  ```

  ```bash cURL theme={null}
  curl -s -X POST \
    -H "x-app-id: $APP_ID" -H "Authorization: Bearer $ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"mode":"live"}' \
    "$API/users/me/venue-accounts/betdex"
  ```
</CodeGroup>

Full shape on [Provision hosted venue account](/api-reference/hosted-venue-accounts/provision-hosted-venue-account). Read it back with [Get hosted venue account](/api-reference/hosted-venue-accounts/get-hosted-venue-account).

## Deposit address

Deposit Solana USDC to the address returned for this hosted account. It credits the BetDEX
account, separately from the managed balance described in [Funding](/concepts/funding).

<CodeGroup>
  ```ts SDK theme={null}
  const deposit = await client.getHostedVenueDepositAddress("betdex");
  ```

  ```bash cURL theme={null}
  curl -s -H "x-app-id: $APP_ID" -H "Authorization: Bearer $ACCESS_TOKEN" \
    "$API/users/me/venue-accounts/betdex/deposit-address"
  ```
</CodeGroup>

Full shape on [Get hosted venue deposit address](/api-reference/hosted-venue-accounts/get-hosted-venue-deposit-address).

## Withdraw

`amountRaw` is 6-decimal USDC (`"1000000"` is 1 USDC). `requestId` is a UUID v4 and is the idempotency key. The response `decimals` is `6`.

<CodeGroup>
  ```ts SDK theme={null}
  const withdrawal = await client.withdrawHostedVenue("betdex", {
    mode: "live",
    requestId, // UUID v4
    amountRaw: "1000000", // 1 USDC, 6 decimals
    destinationAddress,
  });
  ```

  ```bash cURL theme={null}
  curl -s -X POST \
    -H "x-app-id: $APP_ID" -H "Authorization: Bearer $ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"mode":"live","requestId":"'"$REQUEST_ID"'","amountRaw":"1000000","destinationAddress":"'"$SOLANA_ADDRESS"'"}' \
    "$API/users/me/venue-accounts/betdex/withdrawals"
  ```
</CodeGroup>

Full shape on [Withdraw hosted venue funds](/api-reference/hosted-venue-accounts/withdraw-hosted-venue-funds). Poll [Get hosted venue withdrawal](/api-reference/hosted-venue-accounts/get-hosted-venue-withdrawal).

[Get hosted venue account activity](/api-reference/hosted-venue-accounts/get-hosted-venue-account-activity) returns signed exact 18-decimal amounts. That scale is only on the activity ledger.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.