LogoLogo
  • GENERAL
    • About Criptan
    • Get started
      • Introduction
      • 1. Activate your account
      • 2. Add funds to your balance
      • 3. Start interacting with the API
    • API
      • Introduction
      • Authentication
        • Auth Transactions and Earn
          • API Reference
        • Auth Business (Criptan Pay)
      • Real-Time API (WebSockets)
        • OHLCV
        • TICKERS
      • Webhooks
        • Transactions and Earn Webhooks
        • Business Webhooks
      • API reference
      • Changelog
    • Developer tools
      • Sandbox
      • Support
      • Feedback
    • Security
  • Transactions
    • General
      • Overview
      • Available exchange
      • Geographic availability
      • Use cases
        • Buy
          • UX example
        • Sell
          • UX example
        • Send crypto
          • UX example
        • Receive crypto
          • UX example
        • Recurring purchases
          • UX example
        • Check history
      • FAQ
    • API Reference
      • Trades
      • Withdrawals
      • Information
  • Earn
    • General
      • Overview
      • Geographic availability
      • Use cases
        • 3, 6, 12 months
          • Make a deposit
            • UX example
          • Set up auto-renew a deposit automatically
            • UX example
        • Flex
          • Make a deposit
            • UX example
          • Make a withdrawal
            • UX example
          • Cancel a withdrawal
            • UX example
          • Set up reinvest or not rewards
            • UX example
        • Flex and 3, 6, 12 months
          • Receiving Rewards
      • FAQ
    • API Reference
  • Business (Criptan Pay)
    • General
      • Business (Criptan Pay)
      • Onboarding
      • Payment Button
      • Charges
      • FAQ
    • API Reference
      • Charge
      • Generate charge receipt
      • Get payment
    • Types CPay definitions
      • BusinessAccount
      • BusinessCharge
Powered by GitBook
On this page
  • Authentication
  • Supported messages
  • Subscribe/Unsubscribe to a topic
  • Errors
  1. GENERAL
  2. API

Real-Time API (WebSockets)

PreviousAuth Business (Criptan Pay)NextOHLCV

Last updated 1 year ago

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.

wss://rt.criptan.com