# Quick start

Create an API key, sign a request and get your first market data.

This takes about five minutes. You need an OmniMarketX account. Any account works for reading.


<Steps>
<Step>
### Create an API key

Go to **Settings → API** and choose **New key**. Give it a name and choose its permissions:

- **Read**: markets, prices, your practice portfolio. Every account.
- **Practice trading**: place practice orders. Needs OmniMarket Pro.

The private key is shown **once**. Save it somewhere safe before you close the window. If you lose it, revoke the key and create a new one.
</Step>



<Step>
### Sign each request

Every request carries three headers:

| Header | Value |
|---|---|
| `OMX-KEY-ID` | your key id, for example `omx_test_…` |
| `OMX-TIMESTAMP` | the current time in milliseconds |
| `OMX-SIGNATURE` | your signature, base64 |

The signature is your Ed25519 private key signing these four lines, joined with a new line:

```text
TIMESTAMP
METHOD
PATH_WITH_QUERY
hex(sha256(BODY))
```

The timestamp must be within 30 seconds of our clock. The path starts with `/api/public/v1`.
</Step>



<Step>
### Make your first call


<Tabs items={["Python","JavaScript"]}>
<Tab value="Python">
```python
# pip install cryptography requests
import base64, hashlib, time, requests
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey

KEY_ID = "omx_..."        # from Settings → API
PRIVATE_KEY = "..."       # shown once when you created the key
BASE = "https://api.omnimarketx.com/api/public/v1"
key = Ed25519PrivateKey.from_private_bytes(base64.b64decode(PRIVATE_KEY))

def call(method, path, body=b""):
    ts = str(int(time.time() * 1000))
    msg = f"{ts}\n{method}\n/api/public/v1{path}\n{hashlib.sha256(body).hexdigest()}"
    sig = base64.b64encode(key.sign(msg.encode())).decode()
    headers = {"OMX-KEY-ID": KEY_ID, "OMX-TIMESTAMP": ts, "OMX-SIGNATURE": sig,
               "Content-Type": "application/json"}
    return requests.request(method, BASE + path, data=body, headers=headers).json()

print(call("GET", "/markets?limit=5"))
```
</Tab>



<Tab value="JavaScript">
```js
// Node 18+, no extra packages
import crypto from "node:crypto";

const KEY_ID = "omx_...";      // from Settings → API
const PRIVATE_KEY = "...";     // shown once when you created the key
const BASE = "https://api.omnimarketx.com/api/public/v1";
const seed = Buffer.from(PRIVATE_KEY, "base64");
const key = crypto.createPrivateKey({
  key: Buffer.concat([Buffer.from("302e020100300506032b657004220420", "hex"), seed]),
  format: "der", type: "pkcs8",
});

async function call(method, path, body = "") {
  const ts = String(Date.now());
  const hash = crypto.createHash("sha256").update(body).digest("hex");
  const msg = `${ts}\n${method}\n/api/public/v1${path}\n${hash}`;
  const sig = crypto.sign(null, Buffer.from(msg), key).toString("base64");
  const res = await fetch(BASE + path, {
    method, body: body || undefined,
    headers: { "OMX-KEY-ID": KEY_ID, "OMX-TIMESTAMP": ts, "OMX-SIGNATURE": sig, "Content-Type": "application/json" },
  });
  return res.json();
}

console.log(await call("GET", "/markets?limit=5"));
```
</Tab>
</Tabs>



You get back the same markets the website shows, each with its real price and its practice price.
</Step>
</Steps>



## Next

- Place a practice order, read errors and limits: [Using the API](/docs/using-the-api).
- See every endpoint: [API Reference](/docs/reference).