# API

Source: https://docs.testnet.mog.xyz/api/

Markdown: https://docs.testnet.mog.xyz/api.md

Reviewed protocol version: 11.0.0

Protocol review date: 2026-10-30

Scope: reviewed public documentation. Numerical examples use illustrative or launch settings; they are not live quotes or a guarantee of current deployed parameters. Consult the app for current market and position values.

Mog has no account API keys. Your wallet is the account, and a session key it grants signs trading instructions. Reads are public. Every write is a signed instruction that the chain checks.

## The parts

| Part                                | Use it to                                                                           | Auth                                                                                                                                             |
| ----------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `mog` CLI                           | Trade, read the account and run strategies from a terminal or an agent              | Session key on your machine                                                                                                                      |
| Info endpoint, `POST /indexer/info` | Read markets, prices, candles, orders, positions, fills and payouts                 | None. Reads are public.                                                                                                                          |
| Stream, `/indexer/ws`               | Follow prices, fills and order updates live                                         | None                                                                                                                                             |
| Relay, `POST /submit`               | Deliver signed orders, cancels, closes and top-ups. The relay pays the network fee. | The signature in each instruction. Browser requests are accepted only from Mog's own sites; servers and the CLI send no origin and are accepted. |
| The chain                           | Send the same signed instructions yourself and pay the network fee                  | The signature, or the sending wallet                                                                                                             |

Start with the [quick start](https://docs.testnet.mog.xyz/api/quick-start/). The CLI handles keys, signing, units and retries, so it is the simplest client.

## Two keys

|              | Wallet (root)                                   | Session key                         |
| ------------ | ----------------------------------------------- | ----------------------------------- |
| Signs        | Granting and revoking session keys, withdrawals | Orders, cancels, closes, top-ups    |
| Can withdraw | Yes                                             | No. The contract refuses it.        |
| Lifetime     | Permanent                                       | Expires. At launch, at most 7 days. |

A leaked session key can trade the account's balance until it expires or the wallet revokes it. It can never move money out. See [Session keys](https://docs.testnet.mog.xyz/account/session-keys/).

## Networks

|               | Mainnet                            | Testnet                                    |
| ------------- | ---------------------------------- | ------------------------------------------ |
| Chain         | Robinhood Chain, id 4663           | Robinhood Chain testnet, id 46630          |
| API host      | `https://api.mog.xyz`              | `https://api.testnet.mog.xyz`              |
| Info endpoint | `https://api.mog.xyz/indexer/info` | `https://api.testnet.mog.xyz/indexer/info` |
| Stream        | `wss://api.mog.xyz/indexer/ws`     | `wss://api.testnet.mog.xyz/indexer/ws`     |
| CLI           | `mog network mainnet`              | the default                                |

## Units

- Money, prices and ids are decimal strings of whole numbers, so no precision is lost. Prices and most money values carry 18 decimals. Trading-balance units carry 6.
- Times are Unix milliseconds. Signed deadlines are Unix seconds in chain time.
- Lists page by cursor: pass the last row's cursor to get the next page. A page shorter than its limit is the last.

## Reference

- [Errors](https://docs.testnet.mog.xyz/api/reference/errors/): relay refusal codes and CLI exit codes.
- [Permissions](https://docs.testnet.mog.xyz/api/reference/permissions/): who may call each part of the venue.
