Zebpay Build is a platform where users can create their own applications for trading like other cryptocurrency trading applications.
Developers can create trading bots using Zebpay Build. Users can also build own applications (console/web/API) using our platform and will be able to:
1. Buy and Sell Crypto Assets.
2. Fetch the market data.
3. Fetch open/completed orders.
4. Cancel open orders.
5. Get the latest balance of crypto assets.
All Market and Trading related data/methods are available through REST-ful API.
To start using API, first you need to login or register with zebpay, then you need to create a new application. If you do not have zebpay account, you can sign up here.
To create new Application in zebpay build, go to the application section in build and then click on the create application button. Please fill all required details and click on the submit button and your application will be created.
Once your application is created, our team will review and approve it. After approval of application, you will get the client id and client secret key.
You also need the Authorization token to perform the API calls. You have to perform these API call in sequence
1) /user/login,
2) /user/verifyotp,
3) /user/verifypin
Please ensure above requests must contain the following headers.
Received after creating Application.
A timestamp for your request, in ticks.
application/json
A Unique GUID Request Token (Generate new request id on every request).
This API is used to authenticate the user. User will get the verification_code in response which needs to be used in /user/verifyotp API call.
POST /user/login
User country code for example: mt, au
User mobile number without country code
Received after creating Application.
Received after creating Application.
{
"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"
This API is used to authenticate verifyOtp call. User will get the verification_code in response which needs to be used in /user/verifypin API call.
POST /user/verifyotp
Received on user's mobile number.
Received in the /user/login API.
Received after creating Application.
Received after creating Application.
{
"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"
This API is used to authenticate VerifyPin. After the API is called successfully user will get the access_token which needs to be used in all API calls.
POST /user/verifypin
user_credentials
User account pin.
Daily trade limit.
Daily withdrawal limit.
total trade limit.
Total withdrawal limit.
verification_code received in the /user/verifyotp API.
Allowed scopes for the application.
For example trade:read, trade:create
Received after creating Application.
Received after creating Application.
{
"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"
User can place a limit order and it can be done only when there is sufficient amount of Quote currencies available in the account. On placing the order, the amount of quote currency for the given pair will be kept on hold for the duration of the order.
Received after creating Application.
A timestamp for your request, in ticks.
application/json
The bearer token, mandatory for all trade API's.
A Unique GUID Request Token (Generate new request id on every request).
POST /orders
Description
The trade pair must be valid matching product available in the list of pairs for trading. Eg. BTC-AUD
It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.
Size indicates the amount of base currency required to Bid or Ask against the quote currency.
The price should be in a multiple of minimum tick size.
For example: BTC-AUD pair will have the minimum tick size as 0.01 AUD.
Possilbe values are 1, 2 and 3.
1 is for limit type of order, 2 is for market type of order and 3 is for stoploss type of order
Optional: Applicable if tradeType is of stopploss type of order(3).
Description
Order id
The price should be in a multiple of minimum tick size.
For example: BTC-AUD pair will have the minimum tick size as 0.01 AUD.
Size indicates the amount of base currency required to Bid or Ask against the quote currency.
Limit order is the default order type which requires specifying the price and size. If the limit order is not seen filled, it will become the part of the order book unless filled or cancelled by the user.
The trade pair must be valid matching product available in the list of pairs for trading. Ex:BTC-AUD.
It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.
This indicates the Date and time when the order is placed.
The status of the order can be determined and then classified into 'pending' or 'complete'. Eg : A limit order will show pending unless "filled or cancelled"
{
"trade_pair": "btc-aud",
"side": "ask",
"size": 1,
"price": 0.0005
}
{
"id": 555677,
"price": 0.0005,
"size": 1,
"type": "limit",
"trade_pair": "btc-aud",
"side": "ask",
"created_at": 1538576785865,
"status": "pending"
}
The fastest way to get started is by importing our API collection into postman from the below link.
Overview and general information about the Zebpay Build API's.
All our API requests and responses are application/json content type and follow typical HTTP response status codes for success and failure. All API requests are called by the standard HTTPS. All POST calls need to specify the parameters of the format to x-www-form-urlencoded.
A successful response is indicated by HTTP status code 200 and may contain an optional body. If the response has a body it will be documented under each API.
Unless otherwise stated, errors to bad requests will respond with HTTP 4xx or status codes. The body will also contain a message parameter indicating the cause. Your language's HTTP library should be configured to provide message bodies for non-2xx requests so that you can read the message field from the body.
Following table gives more details about error code and description.
Bad Request – Invalid request format
Unauthorized – Invalid API Key
Forbidden – You do not have access to the requested resource
Not Found
Internal Server Error – We had a problem with our server
When a Rate limit is exceeded, a status of "429 Too Many Requests" will be returned.
All our Datetime properties has value as "Unique Timestamp in milliseconds" (Unix time, also known as POSIX time[citation needed] or UNIX Epoch time[1]) is a system for describing a point in time, defined as an approximation of the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.
User can convert the same to any timezone. Please note that, in case your library supports only seconds, divide the value by 1000 before converting to date object.
We support pagination in API’s which return a list. User has to pass the value parameterized like "?limit=10&page=1". By default system will limit the record to 20, and fetch the latest data.
A public sandbox is available for testing API connectivity and web trading. The sandbox environment provides all of the functionality of the production exchange and allows you to play around with API.
Login sessions and API keys are separate from production. Use the sandbox web interface to create keys in the sandbox environment.
https://www.zebpay.co/api/v1
https://www.zebpay.co/pro/v1
Zebpay Build production environment is available for API connectivity and Web trading.
Login sessions and API keys are separate from production.
https://www.zebapi.com/api/v1
https://www.zebapi.com/pro/v1
wss://ws-feed.zebpay.com/marketdata
Client libraries can help you integrate with our API quickly.
Github Repository
Currently we support following Cryptocurrencies.
Bitcoin
Bitcoin Cash
Etherium
Litecoin
Ripple
EOS
User will need to register on Application before getting started. Upon successful registration you will get the following information which needs to be saved.
This information will be used in the OAuth flow
A unique GUID which need to be provided for authentication.
A unique GUID which need to be provided for authentication.
It is used to generate the hash signature,by which user will get authenticated.
User must restrict the scope of Application.User can select this permission at the time of application registration.
Permission to read the trade.
Permission to execute the trade.
All Request must contain the following headers.
Received after creating Application.
A timestamp for your request, in ticks.
application/json
The bearer token, mandatory for all trade API's.
A Unique GUID Request Token (Generate new request id on every request).
Zebpay Build provides a page where developers can register the application as "web". At the time of application registration developers need to keep the following things in mind:
When creating .net MVC Core application, app.UseAuthentication() should be used for authentication.
http://xxxx-baseurl-xxx/signin-oidc
http://xxxx-baseurl-xxx/signout-callback-oidc
Code Sample for .net MVC Core application (developers should use Authorize attribute on Controller)
.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;
});
Zebpay provides a page where developers can register the application as "Console".
Zebpay provides a series of API's for login purpose.
The API's need to be called in a sequence : /user/login, /user/verifyotp, /user/verifypin, /user/logout. See User API for detail request/response.
After successfull authentication user will get access_token and user can use this access_token to access API.
We always need an access token to call any authenticated API. Considering a scenario where the client is a program/bot they will ideally need a manual intervention to key-in OTP in our authentication process. To get rid of this dependency we have an interactive UI where developers can generate access token and setup inside their program.
To generate access token, user needs to go to his/her application detail page, and then navigate to GenerateToken tab. You can generate token for all your scope or for a smaller set as well. System will prompt for a one time password to key-in before generating the actual token value.
This API is used to authenticate the user. User will get the verification_code in response which we need to be used in /user/verifyotp API call.
POST /user/login
User country code for example: mt, au
User mobile number without country code
Received after creating Application.
Received after creating Application.
{
"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"
This API is used to authenticate “verifyOtp”. User will get the verification_code in response which needs to be used in /user/verifypin API call.
POST /user/verifyotp
Received on user's mobile number.
Received in the /user/login API.
Received after creating Application.
Received after creating Application.
{
"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"
This API is used to authenticate “VerifyPin”. After successful API call, user will get the access_token which needs to be used for all API calls.
POST /user/verifypin
user_credentials
User account pin.
Daily trade limit.
Daily withdrawal limit.
Total trade limit.
Total withdrawal limit.
Received in the /user/verifyotp API.
Allowed scopes for the application.
For example trade:read, trade:create
Received after creating Application.
Received after creating Application.
{
"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"
This is used to logout from the application.
POST /user/logout
Access token generated in the /user/verifypin API.
Received after creating Application.
Received after creating Application.
{
"property": value,
"property": value,
"property": value,
"property": value,
"property": value,
"property": value
}
These APIs returns market details including ticker(s), book (pending orders), trades (executed orders) etc.
Users can get a list of 24 hr stats for available pair by this API. Volume is in base currency units.
GET /market
Description
Current Buy Rate
Current Sell Rate
Volume for last 24 Hrs
Change in price
Highest Price in last 24 hours.
Lowest Price in last 24 hours.
Current trade pair
Note: Pass query string parameter ?group=singapore
[
{
"pair": "",
"virtualCurrency": "",
"volume": null
},
{
"buy": "0",
"sell": "0",
"volume": 0,
"pricechange": "0.00",
"24hoursHigh": "0",
"24hoursLow": "0",
"pair": "BTC-AUD",
"virtualCurrency": "BTC",
"currency": "AUD"
},
...
]
Users can get the ticker information for the current Trade Pair with daily volume and current Price by using this API.
GET /market/{tradepair}/ticker
Description
Example BTC-AUD, ETH-AUD etc.
Current Buy Rate
Current Sell Rate
Volume for last 24 Hrs
Change in price
Highest Price in last 24 hours.
Lowest Price in last 24 hours.
Current trade pair
Note: Pass query string parameter ?group=singapore
{
"buy": "14965.69",
"sell": "14962.39",
"market": "14964.39",
"volume": 4.95532,
"24hoursHigh": "14965.69",
"24hoursLow": "14962.39",
"pricechange": "3.30",
"pair": "btc-aud",
"virtualCurrency": "btc",
"currency": "aud"
}
Users can get a list of open orders for a trade pair by using this API.
GET /market/{tradepair}/book
Description
Example BTC-AUD, ETH-AUD etc.
List of recent ask's Rates, with Price & Amount.
List of recent bid's Rates, with Price & Amount.
Current trade pair.
Note:
{
"asks": [],
"bids": [
{
"price": "14962.44",
"amount": 20044680
}
],
"pair": "btc-aud"
}
Users can get the trade History information for the current trade pair.
GET /market/{tradepair}/trades
Description
Example BTC-AUD, ETH-AUD etc.
Transaction Id maintained uniquely at Zebpay.
Executed quantity. This can be partial or completely filled.
Price at which the transaction is executed.
Ask(1)/Bid(2).
Current trade pair.
Timestamp.
Note: Pass query string parameter ?group=singapore
[
{
"trans_id": 13,
"fill_qty": 1000000,
"fill_price": 0.0005,
"fill_flags": 1,
"currencyPair": "BTC-AUD",
"lastModifiedDate": 1538576785865
}
...
]
This endpoint can be used to read order data as well as create a new order. User can also cancel a previously placed order.
User can place a limit order and it can be done only when there are sufficient amount of Quote currencies available in the account. On placing order, the amount of quote currency for the given pair will be kept on hold for the duration of the order.
POST /orders
Description
The trade pair must be a valid matching product available in the list of pairs for trading. Ex:BTC-AUD
It indicates the side at which the order is placed.
Bid side indicates a downtick and conversely Ask side indicates the uptick.
It indicates the amount of base currency required to Bid or Ask against the quote currency.
The price should be in a multiple of minimum tick size.
For example: BTC-AUD pair will have the minimum tick size as 0.01 AUD.
Description
Order id
The price should be in a multiple of minimum tick size.
For example: BTC-AUD pair will have the minimum tick size as 0.01 AUD.
It indicates the amount of base currency required to Bid or Ask against the quote currency.
Limit order is the default order type which requires specifying the price and size. If the limit order is not seen filled, it will become the part of the order book unless filled or cancelled by the user.
The trade pair must be a valid matching product available in the list of pairs for trading. Ex:BTC-AUD.
It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.
This indicates the date and time when the order is placed.
The status of the order can be determined and then classified into ‘pending’ or ‘complete’. Eg : A limit order will show pending unless "filled or cancelled"
{
"trade_pair": "btc-aud",
"side": "ask",
"size": 1,
"price": 0.0005
}
{
"id": 555677,
"price": 0.0005,
"size": 1,
"type": "limit",
"trade_pair": "btc-aud",
"side": "ask",
"created_at": 1538576785865,
"status": "pending"
}
Users can list their current orders and can also view open as well as settled orders. User needs to pass ORDER STATUS "Pending" to get all unsettled orders, "all" to get all orders.
GET /orders
Description
Optional: The trade pair must be valid matching product available in the list of pairs for trading. Ex:BTC-AUD
Optional: Default value is 'pending'. The status of the order can be determined and then classified into 'pending' or 'complete'. Order will have 'complete' status if it is fully executed in other cases, status will be 'pending'.
Optional: Order Id
Optional: Page Number of the records to be seen.
Optional: Number of records to be fetch in Single Page
Description
Order Id
The price should be in a multiple of minimum tick size.
For example: BTC-AUD pair will have the minimum tick size as 0.01 AUD.
It indicates the amount of base currency required to Bid or Ask against the quote currency.
Limit order is the default order type which requires specifying the price and size. If the limit order is not seen filled , it will become the part of the order book unless filled or cancelled by the user.
The trade pair must be a valid matching product available in the list of pairs for trading.
It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.
This indicates the date and time when the order is placed.
Executed value is filled_size * [price]
Amount of cancel value by price
Fee applicable
Quantity of order executed
The status of the order can be determined and then classified into 'pending' or 'complete'. Eg : A limit order will show pending unless "filled or cancelled"
Order is settled or in progress
{
"id": 555583,
"price": 17,
"size": 0.5,
"type": "limit",
"trade_pair": "BTC-AUD",
"side": "Ask",
"created_at": 1538576785865,
"executed_value": 8.5,
"cancel_value": 0,
"fill_fees": 0.025,
"filled_size": 0.5,
"status": "complete",
"settled": true
}
Users can get a single order's detail/fills by order id by using this API
GET /orders/{orderid}/fills
Description
Valid Order Id
Size indicates the amount of base currency required to Bid or Ask against the quote currency.
The price should be in a multiple of minimum tick size.
For example: BTC-AUD pair will have the minimum tick size as 0.01 AUD.
Amount shows the total executed value of order placed by the user.
Orders which provide liquidity are charged different fees from orders taking liquidity. Makers are charged differently than the market takers.
The fee is calculated as a percentage of the executed amount.
Fees charged for traded quantities where buy and sell takes place on the same day.
Total fees are calculated on a 24-hour cycle which is comprised of maker, taker and intraday fees. Attracted rebate would be processed at end of the time-cycle due to less fees charged on Intraday trades
Fees for a given pair will be charged always in terms of the quote currency. Eg: For the pair ETH-AUD, the attracted trade fee on the given pair will be in AUD.
This indicates the date and time when the order is placed.
{
"orderId": 555806,
"size": 0.5,
"price": 17,
"amount": 8.5,
"feesType": "taker",
"fees": 0,
"intradayFees": 0.01,
"totalFees": 0.01,
"feeCurrency": "AUD",
"createDate": 1538576785865
}
Users can cancel previously placed order by using this API.
DELETE /orders/{orderid}
Description
Valid Order Id
Success
{
"data": null,
"statusCode": 200,
"statusDescription": "success"
}
Users can trade in following pairs supported by Zebpay
Bitcoin - Australian Dollar
Bitcoin Cash - Australian Dollar
Ether - Australian Dollar
Ripple - Australian Dollar
Litecoin - Australian Dollar
EOS - Australian Dollar
POST {{baseUrl}}/orders/instant
Description
0.00042980 (quantity)
btc-aud
buy or sell
price you can get from the websocket feeds check the websoket feeds and pass the parameter based on the buy or sell side. for example: BuyRate or SellRate
check below code for generating pin. for example: jPszI7hNC7623757xaoZjw==
User's pin is encrypted using API secret (provided during creation of app on zebpay build). Algorithm used is AES encryption. Below is an example of how this can be done using Javascript.
import * as CryptoJS from 'crypto-js'; aesEncrypt(text, key){ let k = key.replace(/-/g, '').substring(0,16); k = CryptoJS.enc.Utf8.parse(k); const iv = CryptoJS.enc.Utf8.parse('0000000000000000'); const encrypted = CryptoJS.AES.encrypt(text.trim(), k, { keySize: 16, iv: iv, mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }); console.log(encrypted.toString()); return encrypted.toString(); }
{
"data": null,
"statusCode": 200,
"statusDescription": "success"
}
These endpoints are used to interact and make payments to lightning network.
This API is used to Decode Lightning invoice
POST /lightning/decode
Description
Example "lntb1530n1pwgpnr7pp5l62gagc880aw7qhknddjxtuc9ew5slkt6qhjwwepa7y0d8kvchuqdpcf45kcmrfdahzqsnfw33k76twypyx7mt9wpskwefqfaexgetjyq3njde4cqzysxqzfvcn27vxmzkrsgw6udwkfqgh4hylv3qvsdzpf42svc6pz6lrgh08cxtxf60q83hxpgxwq3t9uj344p4pwdpktnvy34hs2acaxyf42e0ygplvhhqe"
{
"invoice": {
"coinType": "testnet",
"payeeNodeKey": "023bcc1daeb7c85208991e993a2eacf86f7d9584a6dc33291bbe5e19c986a31568",
"satoshis": 153,
"signature": "c4d5e61b62b0e0876b8d7592045eb727d910320d1053554198d045af8d1779f065993a780f1b982833811597928d6a1a85cd0d97361235bc15dc74c44d559791",
"timeExpireDate": 1551945130,
"timestampString": "2019-03-07T07:47:10.000Z",
"timestamp": 1551944830,
"description": "1 Espresso Coin Panna, 1 Scala Chip Frappuccino",
"description_hash": "",
"expiry": "300",
"tags": [
{
"tagName": "payment_hash",
"data": "fe948ea3073bfaef02f69b5b232f982e5d487ecbd02f273b21ef88f69eccc5f8"
},
{
"tagName": "description",
"data": "Million Bitcoin Homepage Order #975"
},
{
"tagName": "min_final_cltv_expiry",
"data": 144
},
{
"tagName": "expire_time",
"data": 300
}
],
"payeeName": "Name not available"
},
"path": true
}
{
"statusCode": 400,
"statusDescription" : "Error",
"data" : {
message: "Invoice Expired"
}
}
This API is used to make a payment to lightning invoice
POST /lightning/pay
Description
Example "lntb1530n1pwgpnr7pp5l62gagc880aw7qhknddjxtuc9ew5slkt6qhjwwepa7y0d8kvchuqdpcf45kcmrfdahzqsnfw33k76twypyx7mt9wpskwefqfaexgetjyq3njde4cqzysxqzfvcn27vxmzkrsgw6udwkfqgh4hylv3qvsdzpf42svc6pz6lrgh08cxtxf60q83hxpgxwq3t9uj344p4pwdpktnvy34hs2acaxyf42e0ygplvhhqe"
100
{
"invoice": {
"coinType": "testnet",
"payeeNodeKey": "023bcc1daeb7c85208991e993a2eacf86f7d9584a6dc33291bbe5e19c986a31568",
"satoshis": 73,
signature"": "1b77f8c7b40023b66d084013b23b7c79b7316883ceeccb6ff7bcf9091900e8846ffd9435a827a590277e37dc5fb4e01c4d2a28a3e42ecd5f4810addde76ad9f4",
"timeExpireDate": 1551945944,
"timestampString": "2019-03-07T08:00:44.000Z",
"timestamp": 1551945644,
"description": "1 Espresso Coin Panna, 1 Scala Chip Frappuccino",
"description_hash": "",
"expiry": "300",
"tags": [
{
"tagName" : "payment_hash",
"data": "795dba87ebee09371b9a2d6f8b75544451f067832ebf8ed4384a7ee751bfd680"
},
{
"tagName" : "description",
"data": "Million Bitcoin Homepage Order #976"
},
{
"tagName": "min_final_cltv_expiry",
"data": 144
},
{
"tagName": "expire_time",
"data": 300
}
]
},
"path": true,
"status": "Payment Initiated"
}
{
"statusCode": 400,
"statusDescription": "Error",
"data" : {}
}
This API generates a new invoice to receive payment via Lightning Network.
POST /lightning/add
Description
3
test
Torch
{
"id": 1024,
"amount": "3",
"invoice": "lntb30n1pwjgv7epp528mz2sd3jax687pr8n8zpujnyyyxya4vldgmjgdmm68h34xpdm5qdq8w3jhxaqcqzpgadeueyxgg60lef5lg7c7vyv2cy9jvv3gc4y9hdcnrsh6d7jqn9s3f4wncmp4usvpfwlc2pxwf6rfjq9ltrpxedsyttm7a207ujs244spw6ww77",
"status": 1,
"label": "Torch",
"description": "test",
"linkId": "716D3329-963C-4A98-ACEA-53ED526F6969",
"type": 40,
"expiry": "2019-07-09T07:27:37.557Z",
"createdOn": "2019-07-09T06:27:37.557Z",
}
{
"statusCode": 400,
"statusDescription": "Error",
"data" : {}
}
This API is used to list all Lightning Transactions
GET /lightning/list
{
"transactions": [
{
"id": 1024,
"amount": "3",
"invoice": "lntb30n1pwjgv7epp528mz2sd3jax687pr8n8zpujnyyyxya4vldgmjgdmm68h34xpdm5qdq8w3jhxaqcqzpgadeueyxgg60lef5lg7c7vyv2cy9jvv3gc4y9hdcnrsh6d7jqn9s3f4wncmp4usvpfwlc2pxwf6rfjq9ltrpxedsyttm7a207ujs244spw6ww77",
status"": 1,
"label": "Torch",
"description": "test",
"linkId": "716D3329-963C-4A98-ACEA-53ED526F6969",
"type": 40,
"expiry": "2019-07-09T07:27:37.557Z",
"createdOn": "2019-07-09T06:27:37.557Z"
{
"id" : 737008,
"amount": "72",
"invoice": "lntb720n1pw3p9u3pp5vqyjd55qv4uep02fwqku3xuugjzj450s3dxf5uzv5xx5krdz724qdp6f45kcmrfdahzqsnfw33k76twypyx7mt9wpskwefqfaexgetjyq3nzvf58ycqzysxqzfver8trxnepuzpscpxeu3lzcf57htxwmpc9aqvk8tak9t2mtn9durkq8hdaumjlvrcll7gnullxxw42wcruhvqsje70q200je5f6fsvuqp5hdv5e",
"status": 20,
"sentTo": "testnet.mbhp",
"label": "testnet.mbhp",
"description": "Million Bitcoin Homepage Order #1149",
"type": 30,
"createdOn": "2019-06-24T09:29:48.233Z"
},
{
"id" : 736666,
"amount": "3",
"invoice": "lntb30n1pw0mlz6pp5wkqxkfs522vj04zsh7tenxr7jml64h326ztd7at89j0n87zfmmnsdq2w3jhxumnwscqzpg5pnz9x79qttth48hqg3377zw7f3ycz6y2c8c3setdd2jwgcfax2xvryma4f35fhpse9lg27usvl87r8t9t0dxe8gehcvnv29hr2h2vsqs6rv20",
"status": 20,
"label": "Torch11sssxcxcxcxc1111",
"description": "tessst",
"linkId": "3779625D-BF21-4DB2-8174-7671D1CFFF86",
"type": 40,
"createdOn": "2019-06-10T06:46:15.750Z"
}
]
},
}
{
"statusCode": 400,
"statusDescription": "Error",
"data" : {}
}
This API is used to Get Lightning Transaction details
GET /lightning/tx/{txid}
Description
Example /lightning/tx/716D3329-963C-4A98-ACEA-53ED526F6969
{
"id": 1024,
"amount": "3",
"invoice": "lntb30n1pwjgv7epp528mz2sd3jax687pr8n8zpujnyyyxya4vldgmjgdmm68h34xpdm5qdq8w3jhxaqcqzpgadeueyxgg60lef5lg7c7vyv2cy9jvv3gc4y9hdcnrsh6d7jqn9s3f4wncmp4usvpfwlc2pxwf6rfjq9ltrpxedsyttm7a207ujs244spw6ww77",
"status": 1,
"label": "Torch",
"description": "test",
"linkId": "716D3329-963C-4A98-ACEA-53ED526F6969",
"type": 40,
"expiry": "2019-07-09T07:27:37.557Z",
"createdOn": "2019-07-09T06:27:37.557Z",
}
{
"statusCode": 400,
"statusDescription": "Error",
"data" : {}
}
Note: Refer Deepstream Sample Project and Websocket Sample Project here.
The websocket feed provides real-time market data updates for following events:
To connect to Zebpay websocket feed users have to include socket.io library depending on their client. For example to use it just as a cross-browser WebSocket include js lib (user can download or refer from cdn )- and run below code in javascript:
var socket = io('ws: //ws-feed.zebpay.com/marketdata',{transports: ['websocket']});
socket.on('connect', function () {
console.log('Connected!').on
socket.on('message', function (msg) {
// my msg
});
});
Once the connection is established between the client and server, user can subscribe to different events by simply emitting a 'subscribe' event with the respective event name. The Format for event names are as follows:
Event | Event Name Format | Example |
---|---|---|
Ticker | ticker_singapore/{tradepair} | ticker_singapore/BTC-INR |
Orderbook | book_singapore/{tradepair} | book_singapore/BTC-INR |
History | history_singapore/{tradepair} | history_singapore/BTC-INR |
Instant Rates | traderates/{tradepair} | traderates/BTC-AUD |
Once you have the event name(s), you need to emit the subscribe event with the respective event name and server will start sending real time data.
// To subscribe realtime ticker event for BTC-INR
ws.emit('subscribe', 'ticker_singapore/BTC-INR');
// To subscribe realtime orderbook event for BTC-INR
ws.emit('subscribe', 'book_singapore/BTC-INR');
// To subscribe realtime history event for BTC-INR
ws.emit('subscribe', 'history_singapore/BTC-INR');
// To subscribe realtime Instant Buy/Sell rate events for BTC-AUD
ws.emit('subscribe', 'traderates/BTC-AUD');
To capture the data for any event, you have to simply add a socket listener for that event.
ws.on('ticker_singapore/BTC-INR', (data) => {
console.log('in event ticker_singapore/BTC-INR', data);
});
Note - To capture data from any event make sure you have emitted a subscribe event for that event name.
For debugging purpose and catching socket server errors, you can directly listen for the ‘error’ event. No need to subscribe.
ws.on(‘error’, (message) => {
console.error(‘Error from socket server’, message);
});
ws.emit('subscribe', 'history_singapore/BTC-INR');
ws.emit('subscribe', 'traderates/BTC-AUD');
To capture the data for any event, you have to simply add a socket listener for that event.
ws.on('traderates/BTC-AUD', (data) => {
console.log('in event traderates/BTC-AUD', data);
});
Note - To capture data from any event make sure you have emitted a subscribe event for that event name.
For debugging purpose and catching socket server errors, you can directly listen for the ‘error’ event. No need to subscribe.
ws.on(‘error’, (message) => {
console.error(‘Error from socket server’, message);
});
{
BuyRate: 14605.39338937,
SellRate: 14604.59433094,
}