Obtaining an API Key

To begin using the Hook Odyssey API, you'll need to obtain an API key. Follow these steps to get started:

  • Join the Hook Discord

  • Submit a Ticket: Be sure to include the ethereum address to link the API key to, and some details about your usage. Are you a market maker or systematic trader, application developer, etc.?

  • You should recieve an initial response within 24 hours. Please send a follow up in the created support channel if you do not recieve a response.

Authenticating Requests

Authentication is required for all queries, mutations, and subscription.

GraphQL Queries and Mutations:

Your API key should be included in the HTTP Request headers with the header key: X-HOOK-API-KEY.

Here's an example query in Python using the gql library:

query = """
    query PerpetualPairs {
        perpetualPairs {

headers = {"X-HOOK-API-KEY": "your_api_key_here"}
url = "your_api_url"
transport = AIOHTTPTransport(url=url, headers=headers)
async with Client(transport=transport) as session:
    result = await session.execute(gql(query), variable_values={})

With returns:

    "data": {
        "perpetualPairs": [
                "symbol": "MILADY",
                "baseCurrency": "ETH"

Make sure to replace "your_api_key_here" with the actual API key provided to you.

GraphQL Subscriptions:

When authenticating via websockets for a GraphQL subscription, you need to include the X-HOOK-API-KEY in your connection_init message's payload. Here's an example:

  "type": "connection_init",
  "payload": {
    "X-HOOK-AUTH-TOKEN": "your_api_key_here"

Here's an example subscription in Python using the gql library:

subscription_query = """
    subscription onTickerEvent($symbol: String!) {
        ticker(symbol: $symbol) {

init_payload = {"X-HOOK-API-KEY": "your_api_key_here"}
url = "your_api_url"
transport = WebsocketsTransport(url=url, headers=init_payload)
async with Client(transport=transport) as session:
    subscription = gql(subscription_query)
    async for result in session.subscribe(
        subscription, variable_values={"symbol": "ETH"}
        yield result

Again, ensure that "your_api_key_here" is replaced with the actual API key provided to you.

Last updated