Genesis Arbitrage

Genesis Arbitrage · · 3 min read

API key

An API key is a long random string a service uses to tell who sent a request: whose account it is, which plan it is on and what data it may receive. For a program the key works like a password: whoever knows the string acts on the owner's behalf.

How the key is sent

The key travels in a header of every request, while filters go in the URL. In Genesis API the header is X-API-Key and the key looks like gns_live_…. The example requests AI Signals graded alpha:

import os
import requests

key = os.environ.get("GENESIS_API_KEY")
if not key:
    raise SystemExit("set GENESIS_API_KEY on the server")

r = requests.get(
    "https://api.genesisarbitrage.com/v1/ai/signals",
    headers={"X-API-Key": key},  # the key goes in the header only
    params={"category": "alpha"},  # filters go in the URL
    timeout=10,
)
if r.status_code == 401:
    # the key is missing, invalid or revoked
    print(r.json()["error"]["code"])  # invalid_key
elif r.ok:
    print("alpha signals:", r.json()["meta"]["count"])

A header is used because the request URL, query string included, ends up in web server and proxy logs, and in browser history if someone opens it in a browser. The Genesis API documentation says it plainly: never pass the key in query parameters, never embed it in website or app code, and make requests from your own server only. Exchanges work the same way: Binance takes the key in the X-MBX-APIKEY header, and account requests are also signed with a second key, the API secret.

How to store the key

Exchange key vs Genesis API key

Exchange keyGenesis API key
RightsRead, trade, withdraw: whatever you enableRead data only
A leak exposesTrades and withdrawals on your accountYour call quota
ProtectionNo withdrawals, IP whitelistReissue in your profile

A Genesis API key is read-only: it cannot place orders or withdraw money. Key errors and their codes are in the Authentication and Errors sections.

See also: API, endpoint, rate limit, API key: get, store, reissue and revoke.

Questions and answers

Can I create several Genesis API keys?

No, an account has one key. "Reissue" gives you a new key and disables the old one immediately.

Where do I get a Genesis API key?

In your profile, in the Genesis API block, once you pay for an API plan. The "Get key" button opens the "Your API key" window with a "Copy" button.