### Futures WebSocket Connection Setup Source: https://build.zebpay.com/Home/Documentation Details on how to establish a WebSocket connection to the ZebPay Futures private socket API for accessing user-specific data. ```APIDOC ## Futures WebSocket Connection ### Description The private socket API enables real-time access to user-specific data such as order updates, position status, and balance changes. This secure data stream requires authentication via the **access_token**. ### Connection URL `wss://futuresws.zebpay.com/socket.io` ### Namespace `/auth-stream` ### Authentication Clients must pass an `access_token` (JWT token) and `clientType` ('api') during the handshake. This should be included in the `auth` object. ### Example Connection Request ```json { "url": "wss://futuresws.zebpay.com/socket.io", "namespace": "/auth-stream", "transport": "websocket", "auth": { "token": "access_token", // JWT token for authentication "clientType": "api" // 'api' for api client type } } ``` ``` -------------------------------- ### Futures WebSocket Connection Request Example Source: https://build.zebpay.com/Home/Documentation This example demonstrates the structure of a connection request for the private futures WebSocket API, including authentication details. ```json { "url": "wss://futuresws.zebpay.com/socket.io", "namespace": "/auth-stream", "transport": "websocket", "auth": { "token": "access_token", // JWT token for authentication "clientType": "api" // 'api' for api client type } } ``` -------------------------------- ### Get Balance Source: https://build.zebpay.com/Home/Documentation Provides wallet balance information whenever there is a change in the wallet balance. ```APIDOC ## Get Balance ### Description Provides wallet balance information whenever there is a change in the wallet balance. ### Method Websocket Message ### Endpoint socket.zebapi.com/api/v1/websocket/public ### Parameters #### Request Body - **request** (string) - Required - Set to `"balance"`. - **token** (string) - Required - The authentication token. ### Request Example ```json { "request": "balance", "token": "" } ``` ### Response Example (Success Response) ```json { "data": [ { "currency": "INR", "balance": "6280469.9", "last_updated": "1723805866866", "pending_trade_balance": "769.4", "isVirtual": false, "lending_balance": "0", "pack_balance": "0", "qt_locked_balance": "15420.44" }, { "currency": "BTC", "balance": "2501.86179663", "last_updated": "1723805866866", "pending_trade_balance": "0", "isVirtual": true, "lending_balance": "4.60763963", "pack_balance": "0.0113988", "qt_locked_balance": "0" } ], "type": "BALANCE" } ``` ``` -------------------------------- ### Get Order Information Source: https://build.zebpay.com/Home/Documentation Provides information related to orders. ```APIDOC ## Get Order Information ### Description Provides information related to orders. ### Method Websocket Message ### Endpoint socket.zebapi.com/api/v1/websocket/public ### Parameters #### Request Body - **request** (string) - Required - Set to `"order"`. - **token** (string) - Required - The authentication token. ### Request Example ```json { "request": "order", "token": "" } ``` ``` -------------------------------- ### Get Trending Data Source: https://build.zebpay.com/Home/Documentation Fetches trending cryptocurrency data. ```APIDOC ## Get Trending Data ### Description Fetches trending cryptocurrency data. ### Method Websocket Message ### Endpoint socket.zebapi.com/api/v1/websocket/public ### Parameters #### Request Body - **request** (string) - Required - The request path for trending data, e.g., `"qt/trending/INR/INR/data"`. ### Request Example ```json { "request": "qt/trending/INR/INR/data" } ``` ### Response Example (Success Response) ```json { "data": [ { "CurrencyCode": "BTC", "CurrencyName": "Bitcoin", "IsNew": false, "MessageText": "", "PercentDiff": -2.06, "Rate": 5902484.56, "SellRate": 5798607.26, "Sender": "Zrevamp.Trade", "Sequence": 10, "TradeRateBefore24Hours": 6027030.1005408, "TradeValue": 1080140.15, "Volume": 0.18299754 }, { "CurrencyCode": "ETH", "CurrencyName": "Ether", "IsNew": false, "MessageText": "", "PercentDiff": -0.86, "Rate": 290244.25, "SellRate": 285124.2, "Sender": "Zrevamp.Trade", "Sequence": 11, "TradeRateBefore24Hours": 292788.076028, "TradeValue": 1004865.33, "Volume": 3.46213681 } ], "requestType": "INR/INR", "type": "qt-trending" } ``` ``` -------------------------------- ### Get Trending Cryptocurrency Data Source: https://build.zebpay.com/Home/Documentation Send this request to fetch trending cryptocurrency data for a specific currency pair. Ensure the request path is correctly formatted. ```json { "request": "qt/trending/INR/INR/data" } ``` -------------------------------- ### Receive Wallet Balance Update Source: https://build.zebpay.com/Home/Documentation This sample response shows the structure of wallet balance information, including currency, available balance, pending trade balance, and other relevant details. ```json { "data": [ { "currency": "INR", "balance": "6280469.9", "last_updated": "1723805866866", "pending_trade_balance": "769.4", "isVirtual": false, "lending_balance": "0", "pack_balance": "0", "qt_locked_balance": "15420.44" }, { "currency": "BTC", "balance": "2501.86179663", "last_updated": "1723805866866", "pending_trade_balance": "0", "isVirtual": true, "lending_balance": "4.60763963", "pack_balance": "0.0113988", "qt_locked_balance": "0" } ], "type": "BALANCE" } ``` -------------------------------- ### Quick Trade Sample Request Source: https://build.zebpay.com/Home/Documentation This is a sample JSON request to retrieve quick trade rates for a specific cryptocurrency pair. ```json { "request": "qt/BTC-INR" } ``` -------------------------------- ### Sample Order Book Snapshot Response Source: https://build.zebpay.com/Home/Documentation This JSON response provides a snapshot of the current order book, including buy (bids) and sell (asks) orders with their respective amounts and prices. ```json // Order book snapshot { "data": { "asks": [ { "amount": 6000, "price": "5885000" }, { "amount": 7347, "price": "5907694.21" }, { "amount": 126049, "price": "5950000" }, … ], "bids": [ { "amount": 579032, "price": "5882166.82" }, { "amount": 169454, "price": "5880000" }, … ] }, "requestType": "BTC-INR", "type": "exchange-book" } ``` -------------------------------- ### Quick Trade Sample Response Source: https://build.zebpay.com/Home/Documentation This JSON response provides the buy rate, sell rate, last traded price (LTP), and percentage change for a cryptocurrency pair in the Quick Trade market. ```json { "data": { "BTC-INR": { "BuyRate": 5969972.00442825, "LTP": 5902775.445, "PercentChange": "0.15", "SellRate": 5864271.73969875 } }, "type": "qt-instant-trade-rate" } ``` -------------------------------- ### Pagination Support Source: https://build.zebpay.com/Home/Documentation Information on how to use pagination for APIs that return lists of data. ```APIDOC ## Pagination Support We support pagination in APIs that return a list. Users need to pass parameters like `?limit=10&page=1`. By default, the system will limit the records to 20 and fetch the latest data. ``` -------------------------------- ### WebSocket Exchange Data Request Source: https://build.zebpay.com/Home/Documentation Request specific exchange data, such as order book snapshots, trade data, and ticker information for a given symbol. Example uses 'BTC-INR'. ```json { "request": "exchange/BTC-INR" } ``` -------------------------------- ### Sample Order Response Source: https://build.zebpay.com/Home/Documentation This is a sample JSON response for an order, detailing trade pair, status, price, size, and timestamps. ```json { "data": [ { "id": 5781331, "tradePair": "BTC-INR", "status": "OPEN", "side": "Bid", "orderType": "LIMIT", "avgPrice": "0", "price": "5883917.16", "size": "0.00013", "volumeOpen": "0.00013", "volumeExecuted": "0", "fee": "0", "tradeValue": "0", "marketOrderAmount": "0", "stopPrice": "0", "tax": "0", "tds": "0", "createdAt": 1723642482773 }, { "id": 5781451, "tradePair": "ETH-INR", "status": "OPEN", "side": "Bid", "orderType": "LIMIT", "avgPrice": "0", "price": "408121.98", "size": "0.002", "volumeOpen": "0.002", "volumeExecuted": "0", "fee": "0", "tradeValue": "0", "marketOrderAmount": "0", "stopPrice": "0", "tax": "0", "tds": "0", "createdAt": 1723806235036 }, { "id": 5781450, "tradePair": "ETH-INR", "status": "OPEN", "side": "Bid", "orderType": "LIMIT", "avgPrice": "0", "price": "408121.98", "size": "0.001", "volumeOpen": "0.001", "volumeExecuted": "0", "fee": "0", "tradeValue": "0", "marketOrderAmount": "0", "stopPrice": "0", "tax": "0", "tds": "0", "createdAt": 1723806192664 } ], "type": "ORDER" } ``` -------------------------------- ### Login API Response Source: https://build.zebpay.com/Home/Documentation Sample response from the /user/login API. It contains a verification_code to be used in the next step. ```json { "verification_code": "Verification_code", "access_token": null, "expires_in": null, "token_type": null, "refresh_token": null, "message": null, "error": null, "error_description": null } "statusCode": 200, "statusDescription": "OK" ``` -------------------------------- ### Sample Top Sell Price Response Source: https://build.zebpay.com/Home/Documentation This JSON response shows the lowest current sell price available in the market for a specified trading pair. ```json // Top Sell Price { "data": 5882166.82, "requestType": "BTC-INR", "type": "exchange-topsell" } ``` -------------------------------- ### Place Limit Order API Request Source: https://build.zebpay.com/Home/Documentation This is a sample request body for placing a limit order. Ensure sufficient quote asset is available and parameters like trade_pair, side, size, and price are correctly specified. ```json { "trade_pair": "BTC-INR", "side": "ask", "size": 1, "price": 2000000 } ``` -------------------------------- ### Sample Top Buy Price Response Source: https://build.zebpay.com/Home/Documentation This JSON response indicates the highest current buy price available in the market for a given trading pair. ```json // Top Buy Price { "data": 5885000, "requestType": "BTC-INR", "type": "exchange-topbuy" } ``` -------------------------------- ### Place Order API Source: https://build.zebpay.com/Home/Documentation Allows users to place limit, market, or stop-loss orders for a given trade pair with specified size and price. ```APIDOC ## POST /orders ### Description Places an order (limit, market, or stop-loss) for a specified trade pair. Ensures sufficient quote asset availability before placing the order. ### Method POST ### Endpoint /orders ### Parameters #### Request Headers - **client_id** (string) - Required - Obtained after creating an Application. - **timestamp** (string) - Required - A timestamp for the request in ticks. - **Content-Type** (string) - Required - Must be 'application/json'. - **Authorization** (string) - Required - The bearer token, mandatory for all trade APIs. - **RequestId** (string) - Required - A unique GUID Request Token. #### Request Body - **trade_pair** (string) - Required - The trade pair (e.g., 'BTC-INR'). - **side** (string) - Required - The side of the order ('Bid' or 'Ask'). - **size** (number) - Required - The amount of base currency. - **price** (number) - Required - The price for the order (must be a multiple of the minimum tick size). - **tradeType** (integer) - Required - The type of order: 1 for limit, 2 for market, 3 for stop-loss. - **stopRate** (number) - Optional - Applicable only if tradeType is 3 (stop-loss). ### Response #### Success Response (200) - **id** (integer) - The order ID. - **price** (number) - The price of the order. - **size** (number) - The size of the order. - **type** (string) - The type of order (e.g., 'limit'). - **trade_pair** (string) - The trade pair. - **side** (string) - The side of the order. - **created_at** (integer) - The timestamp when the order was placed. - **status** (string) - The status of the order ('pending' or 'complete'). #### Request Example ```json { "trade_pair": "BTC-INR", "side": "ask", "size": 1, "price": 2000000 } ``` #### Response Example ```json { "id": 555677, "price": 2000000, "size": 1, "type": "limit", "trade_pair": "BTC-INR", "side": "ask", "created_at": 1538576785865, "status": "pending" } ``` ``` -------------------------------- ### All Contract Details Event Structure Source: https://build.zebpay.com/Home/Documentation This event provides general details for all contracts, including last trade price, market price, and 24-hour price change percentage. ```APIDOC ## All Contract Details Event ### Description Provides general details for all contracts, including last trade price, market price, and 24-hour price change percentage. ### Listening Event Name `allContractDetails` ### Message Data Structure ```json { "XRPINR": { "lastPrice": "46.2545", // Last trade price "marketPrice": "46.2366455382", // Current market price "priceChangePercent": "0.725", // 24-hr price change %age per "baseAssetVolume": "487166675.8" // base asset volume in 24 hrs }, "MATICINR": { "lastPrice": "74.9827", "marketPrice": "75.02073812399999", "priceChangePercent": "0.845", "baseAssetVolume": "236293682" } // Additional symbols... } ``` ``` -------------------------------- ### Quick Trade Updates Source: https://build.zebpay.com/Home/Documentation Retrieve buy and sell prices by subscribing to Quick Trade updates for a given symbol. ```APIDOC ## Quick Trade Updates ### Description Retrieve the buy and sell prices for a specific cryptocurrency symbol. ### Method GET ### Endpoint `qt/` ### Parameters #### Path Parameters - **symbol** (string) - Required - The cryptocurrency symbol (e.g., BTC-INR). ### Request Example ```json { "request": "qt/BTC-INR" } ``` ### Response #### Success Response (200) - **data** (object) - Contains trading information for the symbol. - **BuyRate** (number) - The current buy rate. - **LTP** (number) - The last traded price. - **PercentChange** (string) - The percentage change in price over a period. - **SellRate** (number) - The current sell rate. - **type** (string) - The type of data returned, e.g., "qt-instant-trade-rate". ### Response Example ```json { "data": { "BTC-INR": { "BuyRate": 5969972.00442825, "LTP": 5902775.445, "PercentChange": "0.15", "SellRate": 5864271.73969875 } }, "type": "qt-instant-trade-rate" } ``` ``` -------------------------------- ### Authentication - Generating API Key Source: https://build.zebpay.com/Home/Documentation Steps to generate an API key for authentication purposes. ```APIDOC ## Authentication - Generating API Key Users need to register on the application before getting started. Upon successful registration, they will receive the following information, which must be saved. This information will be used in the OAuth flow: ##### Client ID A unique GUID that must be provided for authentication. ##### Client Secret A unique GUID that must be provided for authentication. ##### API Secret Used to generate the hash signature, which will authenticate the user. ``` -------------------------------- ### OTP Verification API Response Source: https://build.zebpay.com/Home/Documentation Sample response from the /user/verifyotp API. It returns a verification_code for the subsequent /user/verifypin call. ```json { "verification_code": "Verification_code", "access_token": null, "expires_in": null, "token_type": null, "refresh_token": null, "message": null, "error": null, "status": "pending" } "statusCode": 200, "statusDescription": "success" ``` -------------------------------- ### Place Limit Order API Response Source: https://build.zebpay.com/Home/Documentation This is a sample response after placing a limit order. It includes the order ID, price, size, type, trade pair, side, creation timestamp, and status. ```json { "id": 555677, "price": 2000000, "size": 1, "type": "limit", "trade_pair": "BTC-INR", "side": "ask", "created_at": 1538576785865, "status": "pending" } ``` -------------------------------- ### All Contract Details Event Structure Source: https://build.zebpay.com/Home/Documentation This JSON object details the structure for 'allContractDetails', providing market data for multiple contracts. ```json { "XRPINR": { "lastPrice": "46.2545", // Last trade price "marketPrice": "46.2366455382", // Current market price "priceChangePercent": "0.725", // 24-hr price change %age per "baseAssetVolume": "487166675.8" // base asset volume in 24 hrs }, "MATICINR": { "lastPrice": "74.9827", "marketPrice": "75.02073812399999", "priceChangePercent": "0.845", "baseAssetVolume": "236293682" }, // Additional symbols... } ``` -------------------------------- ### Sample Exchange Volume Response Source: https://build.zebpay.com/Home/Documentation This JSON object shows the last 24-hour trading volume for a specified cryptocurrency pair. ```json // Last 24 hour volume { "data": 1.5, "requestType": "BTC-INR", "type": "exchange-volumechange" } ``` -------------------------------- ### User Login API Source: https://build.zebpay.com/Home/Documentation This API is used to authenticate the user. The user will receive a verification_code in the response, which needs to be used in the /user/verifyotp API call. ```APIDOC ## POST /user/login ### Description Authenticates the user and returns a verification code for OTP verification. ### Method POST ### Endpoint /user/login ### Parameters #### Request Body - **country_code** (string) - Required - User country code (e.g., mt, au). - **mobile_number** (string) - Required - User mobile number without country code. - **client_id** (string) - Required - Client ID received after creating an application. - **client_secret** (string) - Required - Client secret received after creating an application. ### Request Example ```json { "country_code": "in", "mobile_number": "9876543210", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" } ``` ### Response #### Success Response (200) - **verification_code** (string) - The code to be used for OTP verification. - **access_token** (string) - Null in this response. - **expires_in** (number) - Null in this response. - **token_type** (string) - Null in this response. - **refresh_token** (string) - Null in this response. - **message** (string) - Null in this response. - **error** (string) - Null in this response. - **error_description** (string) - Null in this response. #### Response Example ```json { "verification_code": "Verification_code", "access_token": null, "expires_in": null, "token_type": null, "refresh_token": null, "message": null, "error": null, "error_description": null } ``` ``` -------------------------------- ### Sample Exchange Low Price Response Source: https://build.zebpay.com/Home/Documentation This JSON object details the lowest trading price observed in the last 24 hours for a specific trading pair. ```json // Last 24 hour exchange low price { "data": 4899108.005, "requestType": "BTC-INR", "type": "exchange-low" } ``` -------------------------------- ### Verify PIN API Response Source: https://build.zebpay.com/Home/Documentation This is a sample response from the VerifyPin API. It includes an access token upon successful authentication. ```json { "verification_code": null, "access_token": "access_token", "expires_in": "3600", "token_type": "Bearer", "refresh_token": null, "message": null, "error": null, "error_description": "pending" } "statusCode": 200, "statusDescription": "success" ``` -------------------------------- ### Sample Exchange Price Change Response Source: https://build.zebpay.com/Home/Documentation This JSON object represents the last 24-hour price change percentage for a given trading pair. ```json // Last 24 hour Price Change percentage { "data": -1.78, "requestType": "BTC-INR", "type": "exchange-pricechange" } ``` -------------------------------- ### Sample Executed Trades Response Source: https://build.zebpay.com/Home/Documentation This JSON object details an executed trade, including quantity, price, buyer/seller information, and transaction details. ```json // Executed trades { "data": { "fill_flags": 1, "fill_price": 2102991, "is_buyer": "maker" or "taker", "fill_qty": 4758, "inbound_order_filled": true, "lastModifiedDate": 1677154922164, "trans_id": 871549, }, "requestType": "BTC-INR", "type": "exchange-fill" } ``` -------------------------------- ### Configure OpenID Connect in .NET MVC Core Source: https://build.zebpay.com/Home/Documentation Configure the OpenID Connect authentication for a .NET MVC Core application. Ensure the Authorize attribute is used on controllers for protected resources. ```csharp .AddOpenIdConnect("oidc", options => { options.SignInScheme = "Cookies"; options.Authority = "Auth server Url"; options.RequireHttpsMetadata = true; options.ClientId = "ClientID"; options.ClientSecret = "ClientSecret"; options.ResponseType = "id_token"; options.Events.OnRemoteFailure = OnRemoteFailure; //Mandatory Scopes options.Scope.Add("openid"); options.Scope.Add("profile"); //IMplemented scopes (custom) options.Scope.Add("wallet:transactions:read"); options.Scope.Add("trade:read"); options.Scope.Add("trade:create"); options.SaveTokens = true; options.GetClaimsFromUserInfoEndpoint = true; }); ``` -------------------------------- ### Sample Last Traded Price Response Source: https://build.zebpay.com/Home/Documentation This JSON object provides the price of the most recent trade executed for a particular cryptocurrency pair. ```json // Last traded price { "data": 5882166.82, "requestType": "BTC-INR", "type": "exchange-marketprice" } ``` -------------------------------- ### Balance Update Event Structure Source: https://build.zebpay.com/Home/Documentation Details the structure for balanceUpdate events, providing real-time information on user wallet balances. Use this to monitor changes in total, locked, and available balances. ```json { "eventTime": "1696425435000000000", "accountId": 7, "updatedWalletBalance": 1989.26, "updatedLockedBalance": 1053.18, "updatedAvailableBalance": 936.08, "asset": "INR" } ``` -------------------------------- ### Request Order Information Source: https://build.zebpay.com/Home/Documentation Send an 'order' request with your authentication token to retrieve details about your orders. This endpoint provides information related to trading orders. ```json { "request": "order" "token": "" } ``` -------------------------------- ### Subscribe to Market Data Streams Source: https://build.zebpay.com/Home/Documentation Enables users to subscribe to real-time market data streams such as kline (candlestick) and mark price updates. ```APIDOC ## Subscribe to Market Data Streams ### Description Subscribes to various real-time market data streams. Users can specify multiple streams in the `params` list. ### Method Send WebSocket Message ### Endpoint `wss://futuresws.zebpay.com/socket.io` ### Parameters #### Request Body - **params** (array) - Required - A list of stream names to subscribe to. Example: `["btcinr@kline_1m", "btcinr@markPrice"]` ### Request Example ```json { "params": [ "btcinr@kline_1m", "btcinr@markPrice" ] } ``` ``` -------------------------------- ### Request Wallet Balance Information Source: https://build.zebpay.com/Home/Documentation Send a 'balance' request along with your authentication token to retrieve current wallet balance details. This includes various balance types and last updated timestamps. ```json { "request": "balance" "token": "" } ``` -------------------------------- ### Subscribe to Real-time Updates Source: https://build.zebpay.com/Home/Documentation To receive real-time data updates via websocket, send a subscription request with the desired request path and an authentication token. ```json { "request": , "token": } ``` -------------------------------- ### Exchange Trending Sample Request Source: https://build.zebpay.com/Home/Documentation This JSON request is used to fetch trending cryptocurrency data for a specified mother and quote currency. ```json { "request": "exchange/trending/INR/INR/data" } ``` -------------------------------- ### Subscribe to Data Source: https://build.zebpay.com/Home/Documentation Subscribe to real-time data streams by sending a request path and authentication token. ```APIDOC ## Subscribe to Data ### Description Subscribe to real-time data streams. The following data can be sent through the websocket instance in order to subscribe. ### Method Websocket Message ### Endpoint socket.zebapi.com/api/v1/websocket/public ### Parameters #### Request Body - **request** (string) - Required - The path of the data to subscribe to (e.g., "balance", "order"). - **token** (string) - Required - The authentication token. ### Request Example ```json { "request": "", "token": "" } ``` ``` -------------------------------- ### Verify PIN API Source: https://build.zebpay.com/Home/Documentation This API is used to authenticate and verify a user's PIN. A successful call returns an access token for subsequent API requests. ```APIDOC ## POST /user/verifypin ### Description Authenticates the user by verifying their PIN and returns an access token. ### Method POST ### Endpoint /user/verifypin ### Parameters #### Request Body - **grant_type** (string) - Required - Must be 'user_credentials'. - **pin** (string) - Required - The user's account PIN. - **daily_trade_limit** (string) - Required - The daily trade limit. - **daily_withdraw_limit** (string) - Required - The daily withdrawal limit. - **total_trade_limit** (string) - Required - The total trade limit. - **total_withdraw_limit** (string) - Required - The total withdrawal limit. - **verification_code** (string) - Required - The verification code received from the /user/verifyotp API. - **scope** (string) - Required - Allowed scopes for the application (e.g., 'trade:read,trade:create,wallet:transactions:read'). - **client_id** (string) - Required - The client ID obtained after creating an application. - **client_secret** (string) - Required - The client secret obtained after creating an application. ### Response #### Success Response (200) - **verification_code** (string) - Nullable. - **access_token** (string) - The access token for subsequent API calls. - **expires_in** (string) - The token's expiration time in seconds. - **token_type** (string) - The type of token (e.g., 'Bearer'). - **refresh_token** (string) - Nullable. - **message** (string) - Nullable. - **error** (string) - Nullable. - **error_description** (string) - Description of the error if any (e.g., 'pending'). #### Response Example ```json { "verification_code": null, "access_token": "access_token", "expires_in": "3600", "token_type": "Bearer", "refresh_token": null, "message": null, "error": null, "error_description": "pending" } ``` ``` -------------------------------- ### Verify OTP API Source: https://build.zebpay.com/Home/Documentation This API is used to authenticate the verify-OTP call. The user will receive a verification_code in the response, which needs to be used in the /user/verifypin API call. ```APIDOC ## POST /user/verifyotp ### Description Authenticates the OTP provided by the user and returns a verification code for PIN verification. ### Method POST ### Endpoint /user/verifyotp ### Parameters #### Request Body - **otp** (string) - Required - The OTP received on the user's mobile number. - **verification_code** (string) - Required - The verification code received from the /user/login API. - **client_id** (string) - Required - Client ID received after creating an application. - **client_secret** (string) - Required - Client secret received after creating an application. ### Request Example ```json { "otp": "123456", "verification_code": "USER_VERIFICATION_CODE", "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET" } ``` ### Response #### Success Response (200) - **verification_code** (string) - The code to be used for PIN verification. - **access_token** (string) - Null in this response. - **expires_in** (number) - Null in this response. - **token_type** (string) - Null in this response. - **refresh_token** (string) - Null in this response. - **message** (string) - Null in this response. - **error** (string) - Null in this response. - **status** (string) - Indicates the status of the verification, e.g., "pending". #### Response Example ```json { "verification_code": "Verification_code", "access_token": null, "expires_in": null, "token_type": null, "refresh_token": null, "message": null, "error": null, "status": "pending" } ``` ``` -------------------------------- ### User Authentication Sequence Source: https://build.zebpay.com/Home/Documentation Sequence of APIs to be called for user login and authentication in backend or console applications. ```APIDOC ## User Authentication Sequence ### Description Developers can register their application as 'Console' on ZebPay to access a series of APIs for login purposes. These APIs must be called in the specified order. Upon successful authentication, an `access_token` is issued, which is required for accessing other protected APIs. ### API Sequence 1. `/user/login` 2. `/user/verifyotp` 3. `/user/verifypin` 4. `/user/logout` ### Notes Refer to the User API documentation for detailed request and response information for each endpoint. The `access_token` obtained is crucial for subsequent authenticated API calls. ``` -------------------------------- ### Scope Permission Source: https://build.zebpay.com/Home/Documentation Details on the scope permissions available for API access. ```APIDOC ## Scope Permission Users must restrict the scope of the application. They can select the appropriate permissions during the application registration process: ##### Trade Permission to read trade data. ##### Trade Permission to execute trades. ##### wallet:transactions Permission to view wallet balances. ``` -------------------------------- ### Receive Trending Cryptocurrency Data Source: https://build.zebpay.com/Home/Documentation This is a sample response structure for trending cryptocurrency data. It includes details for multiple currencies and a type indicator. ```json { "data": [ { "CurrencyCode": "BTC", "CurrencyName": "Bitcoin", "IsNew": false, "MessageText": "", "PercentDiff": -2.06, "Rate": 5902484.56, "SellRate": 5798607.26, "Sender": "Zrevamp.Trade", "Sequence": 10, "TradeRateBefore24Hours": 6027030.1005408, "TradeValue": 1080140.15, "Volume": 0.18299754 }, { "CurrencyCode": "ETH", "CurrencyName": "Ether", "IsNew": false, "MessageText": "", "PercentDiff": -0.86, "Rate": 290244.25, "SellRate": 285124.2, "Sender": "Zrevamp.Trade", "Sequence": 11, "TradeRateBefore24Hours": 292788.076028, "TradeValue": 1004865.33, "Volume": 3.46213681 }, ... ], "requestType": "INR/INR", "type": "qt-trending" } ``` -------------------------------- ### Mark Price Update Event Structure Source: https://build.zebpay.com/Home/Documentation Provides the mark price, index price, and funding rate for a specific symbol. This data is crucial for understanding current market valuation and funding costs. ```json Action: receive Message Name: "markPriceUpdate" Message Data: { "e": "markPriceUpdate", "E": 1707636353921, "T": 1707636353915, "s": "BTCINR", "p": "4240000.00", "i": "4240050.00", "P": "4240025.00", "r": "0.0001" } ``` -------------------------------- ### markPriceUpdate Event Structure Source: https://build.zebpay.com/Home/Documentation This event provides real-time updates on the mark price, estimated settle price, index price, funding rate, and next funding time for a given symbol. ```APIDOC ## markPriceUpdate Event ### Description Provides real-time updates on the mark price, estimated settle price, index price, funding rate, and next funding time for a given symbol. ### Message Name `markPriceUpdate` ### Message Data Structure ```json { "e": "markPriceUpdate", // Event type "E": 1707634490000, // Event time "s": "BTCINR", // Symbol "p": "4334823.66859808", // Market price "P": "4335379.542328075", // Estimated settle price "i": "4336589.925536482", // Index price "r": "-0.0027", // Funding rate "T": 1707638400000 // Next funding time } ``` ``` -------------------------------- ### Subscribe to Futures Market Data Streams Source: https://build.zebpay.com/Home/Documentation This message is sent to subscribe to specific market data streams like kline and markPrice. Ensure the stream names are correctly formatted. ```json { "params":[ "btcinr@kline_1m", "btcinr@markPrice" ] } ``` -------------------------------- ### Mark Price Update Event Structure Source: https://build.zebpay.com/Home/Documentation This is the data structure for the 'markPriceUpdate' event, providing real-time market price information for a given symbol. ```json { "e": "markPriceUpdate", // Event type "E": 1707634490000, // Event time "s": "BTCINR", // Symbol "p": "4334823.66859808", // Market price "P": "4335379.542328075", // Estimated settle price "i": "4336589.925536482", // Index price "r": "-0.0027", // Funding rate "T": 1707638400000 // Next funding time } ``` -------------------------------- ### Date/Time Format Source: https://build.zebpay.com/Home/Documentation Details on the date and time format used in API responses. ```APIDOC ## Date/Time Format All our Date/Time properties are represented as a 'Unique Timestamp in milliseconds' (Unix time, also known as POSIX time or UNIX Epoch time). This system describes a point in time as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC) on Thursday, January 1, 1970. Users can convert this value to any timezone. Please note that if your library supports only seconds, divide the value by 1000 before converting it to a date object. ``` -------------------------------- ### Sample Exchange High Price Response Source: https://build.zebpay.com/Home/Documentation This JSON object indicates the highest trading price within the last 24 hours for a given exchange pair. ```json // Last 24 hour exchange high price { "data": 6299991, "requestType": "BTC-INR", "type": "exchange-high" } ``` -------------------------------- ### PostLogoutUrl Source: https://build.zebpay.com/Home/Documentation This endpoint is used for the OpenID Connect logout callback. Developers should use the Authorize attribute on their Controller in .NET MVC Core applications. ```APIDOC ## PostLogoutUrl ### Description Callback URL for OpenID Connect logout. ### Endpoint `http://xxxx-baseurl-xxx/signout-callback-oidc` ### Notes This is a sample configuration for a .NET MVC Core application. Ensure the 'oidc' authentication scheme is correctly configured. ``` -------------------------------- ### Exchange Trending Sample Response Source: https://build.zebpay.com/Home/Documentation This JSON response lists trending cryptocurrencies, including their code, name, current rate, percentage change, and volume, for a given currency pair. ```json { "data": [ { "CurrencyCode": "BTC", "CurrencyHoverImage": "https://static.zebpay.com/multicoins/ic_coin_bitcoin_hover.png", "CurrencyName": "Bitcoin", "IsNew": false, "MessageText": "", "PercentDiff": -2.42, "Rate": 5840000, "Sender": "Zrevamp.Trade", "Sequence": 4, "TradeValue": 451291.13, "Volume": 0.07727588 }, { "CurrencyCode": "MATIC", "CurrencyHoverImage": "https://static.zebpay.com/multicoins/ic_coin_polygon_hover.png", "CurrencyName": "Polygon", "IsNew": false, "MessageText": "", "PercentDiff": -28.75, "Rate": 65.19725, "Sender": "Zrevamp.Trade", "Sequence": 5, "TradeValue": 421320.26, "Volume": 6462.2398 }, ... ], "requestType": "INR/INR", "type": "exchange-trending" } ``` -------------------------------- ### Send Ping Request Source: https://build.zebpay.com/Home/Documentation Use this request to check the connection status with the server. A 'PONG' response indicates the connection is active. ```json { "request": "PING" } ``` -------------------------------- ### Position Event Structure Source: https://build.zebpay.com/Home/Documentation Represents the data structure for position-related events including newPosition, updatePosition, and closePosition. This is used for tracking changes in user positions. ```json { "eventTime": "1696425435000000000", "accountId": 5, "contractPair": "BTCINR", "contractType": "PERPETUAL", "entryPrice": 5705246, "leverage": 10, "liquidationPrice": 5199116, "marginType": "ISOLATED", "margin": 3441.36, "positionAmount": 0.002, "positionId": "3aa3b75a-20fb-4f1f-a49f-333bc45559c3", "positionSize": 34231.48, "positionStatus": "OPEN", "positionType": "LONG", "realizedProfit": 0, "quantity": 0.006, "market": "INR", "marginAsset": "INR", "marginConversionRate": 1, "marginSettlementRate": 1, "marginInMarginAsset": 3441.36, "realizedProfitInMarginAsset": 0 } ``` -------------------------------- ### Websocket Market Data Subscription Source: https://build.zebpay.com/Home/Documentation Subscribe to WebSocket to receive real-time market data updates, including order book, trades, and ticker information. ```APIDOC ## Websocket Market Data Subscription ### Description Users can subscribe to the WebSocket to receive real-time updates on market data. This includes information such as the order book, trade data, and ticker information for a specific trading pair. ### Endpoint `socket.zebapi.com/api/v1/websocket/public` ### Subscription Request To subscribe to market data, send a JSON payload with the `request` path specifying the desired data. ```json { "request": "" } ``` ### Unsubscription Request To unsubscribe, send a JSON payload with `subscribe` set to `false`. ```json { "request": "", "subscribe": false } ``` ### Exchange Data This endpoint pushes the order book snapshot, trade data, and ticker information for a given trading pair. - **Request Path:** `exchange/` #### Sample Request ```json { "request": "exchange/BTC-INR" } ``` ### Notes - Replace `` with the desired trading pair (e.g., BTC-INR). - The WebSocket connection is established at `socket.zebapi.com/api/v1/websocket/public`. ``` -------------------------------- ### Order Event Structure (newOrder) Source: https://build.zebpay.com/Home/Documentation Defines the structure for order-related events such as newOrder, orderFilled, orderPartiallyFilled, orderCancelled, or orderFailed. Use this when receiving real-time order status updates. ```json { "eventTime": "1696425435000000000", "accountId": 5, "orderId": 3133, "clientOrderId": "07227f7c2236b71b4b31-5-ext", "time": "2024-05-10T13:26:00.144Z", "updateTime": "2024-05-10T13:26:00.237Z", "symbol": "BTCINR", "baseAsset": "BTC", "quoteAsset": "INR", "contractType": "PERPETUAL", "type": "MARKET", "side": "BUY", "price": 5739874, "status": "NEW", "avgPrice": 0, "executedPrice": 0, "orderAmount": 0.002, "executedAmount": 0, "filledAmount": 0, "cumQty": 0, "linkId": "07227f7c2236b71b4b31-5-ext", "linkType": "ORDER", "subType": "PRIMARY", "placeType": "ORDER_FORM", "market": "INR", "marginAsset": "INR" } ``` -------------------------------- ### API Request Headers Source: https://build.zebpay.com/Home/Documentation All requests to the ZebPay API must include the following headers for proper authentication and processing. ```APIDOC ## API Request Headers All requests must contain the following headers: - **client_id**: Received after creating the application. - **timestamp**: A timestamp for your request, in ticks. - **Content-Type**: application/json - **Authorization**: The bearer token, mandatory for all trade APIs. - **RequestId**: A unique GUID request token (generate a new request ID for every request). ```