Real-Time API (WebSockets)

Criptan's Interactive API empowers you to establish a dynamic, two-way communication session between your client and our server. With this API, you can effortlessly send messages to the server and receive event-driven responses in real-time, eliminating the need for continuous polling.

Authentication

To ensure secure access, authentication is achieved by sending the authorization token in the authorization query string parameter.

Supported messages

Subscribe/Unsubscribe to a topic

In order to start receiving data in real-time from a specific topic.

Topics available are:

Topic
Description

GENERAL

For general updates. Automatically subscribed when the connection is stablished.

OHLCV

Aggregated form of market data standing for Open, High, Low, Close and Volume. For all Criptan assets and for intervals of 1m, 5m, 15min, 1h, 4h, 1d, 1w, 2w.

TICKERS

A ticker is a report of the current market prices for an individual currency pair.

CLIENT MESSAGES

subscribe

{"action":"subscribe","topic": "OHLCV"}

unsubscribe

{"action":"unsubscribe","topic": "OHLCV"}

SERVER MESSAGES

subscriptionStatus

{"action":"subscriptionStatus","topic":"OHLCV","status":"subscribed"}
{"action":"subscriptionStatus","topic":"OHLCV","status":"unsubscribed"}

Errors

We've implemented a robust error handling system to ensure smooth interactions. Here are the possible error messages:

ZodError:

{
    "name": "ZodError",
    "issues": [
        {
            "received": "OHLCCV",
            "code": "invalid_enum_value",
            "options": [
                "GENERAL",
                "OHLCV"
            ],
            "path": [
                "body",
                "topic"
            ],
            "message": "Invalid enum value. Expected 'GENERAL' | 'OHLCV', received 'OHLCCV'"
        }
    ],
}

ResourceNotFound

{"message":"Resource not found","code":"resource_not_found"}

InternalError

{"message":"Internal error","code":"internal_error"}

The Interactive API offers a seamless and secure way to engage in real-time communication with Criptan's servers. Whether you're subscribing to topics or managing errors, our API is designed to provide a smooth and efficient experience.

Last updated