Introduction

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.

Quick Start

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.

Create Application

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.

Create Application

Get it Approved

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.

client_id

Received after creating Application.

timestamp

A timestamp for your request, in ticks.

Content-Type

application/json

RequestId

A Unique GUID Request Token (Generate new request id on every request).

Get it Approved

Login

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.

Request URL

POST /user/login

Request parameters

country_code

User country code for example: mt, au

mobile_number

User mobile number without country code

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"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"

OTP

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.

Request URL

POST /user/verifyotp

Request parameters

otp

Received on user's mobile number.

verification_code

Received in the /user/login API.

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"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"

PIN

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.

Request URL

POST /user/verifypin

Request parameters

grant_type

user_credentials

pin

User account pin.

daily_trade_limit

Daily trade limit.

daily_withdraw_limit

Daily withdrawal limit.

total_trade_limit

total trade limit.

total_withdraw_limit

Total withdrawal limit.

verification_code

verification_code received in the /user/verifyotp API.

scope

Allowed scopes for the application.
For example trade:read, trade:create

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"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"

Example API call

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.

Request Headers
client_id

Received after creating Application.

timestamp

A timestamp for your request, in ticks.

Content-Type

application/json

Authorization

The bearer token, mandatory for all trade API's.

RequestId

A Unique GUID Request Token (Generate new request id on every request).

Request URL

POST /orders

Request parameters
Param

Description

trade_pair

The trade pair must be valid matching product available in the list of pairs for trading. Eg. BTC-AUD

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

size

Size indicates the amount of base currency required to Bid or Ask against the quote currency.

price

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.

Responses
Param

Description

id

Order id

price

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

Size indicates the amount of base currency required to Bid or Ask against the quote currency.

type

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.

trade_pair

The trade pair must be valid matching product available in the list of pairs for trading. Ex:BTC-AUD.

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

created_at

This indicates the Date and time when the order is placed.

status

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"

Request

                    
                            {
"trade_pair": "btc-aud", "side": "ask", "size": 1, "price": 0.0005
}

Response

                    
                            {
"id": 555677, "price": 0.0005, "size": 1, "type": "limit", "trade_pair": "btc-aud", "side": "ask", "created_at": 1538576785865, "status": "pending"
}

Postman Collection

The fastest way to get started is by importing our API collection into postman from the below link.

https://www.getpostman.com/collections/395aa8fe824c80b54a7e

Overview

Overview and general information about the Zebpay Build API's.

Requests

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.

Success

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.

Error Handling

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.

400

Bad Request – Invalid request format

401

Unauthorized – Invalid API Key

403

Forbidden – You do not have access to the requested resource

404

Not Found

500

Internal Server Error – We had a problem with our server

Rate Limits

When a Rate limit is exceeded, a status of "429 Too Many Requests" will be returned.

DateTime Format

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.

Pagination Support

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.

Sandbox

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.

REST API

https: //www.zebpay.co/api/v1

Market REST API

https: //www.zebpay.co/pro/v1

Websocket Feed

https: //ws-feed.zebapi.com/marketdata

Production

Zebpay Build production environment is available for API connectivity and Web trading.

Login sessions and API keys are separate from production.

REST API

https: //www.zebapi.com/api/v1

Market REST API

https: //www.zebapi.com/pro/v1

Websocket Feed

https: //ws-feed.zebapi.com/marketdata

Client Libraries

Client libraries can help you integrate with our API quickly.

Github Repository

Coins (Virtual Currencies)

Currently we support following Cryptocurrencies.

BTC

Bitcoin

BCH

Bitcoin Cash

ETH

Etherium

LTC

Litecoin

XRP

Ripple

EOS

EOS

Authentication

Generating API Key

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

Client Id

A unique GUID which need to be provided for authentication.

Client Secret

A unique GUID which need to be provided for authentication.

Api Secret

It is used to generate the hash signature,by which user will get authenticated.

Scope Permission

User must restrict the scope of Application.User can select this permission at the time of application registration.

Trade:read

Permission to read the trade.

Trade:Create

Permission to execute the trade.

API - Request Headers

All Request must contain the following headers.

client_id

Received after creating Application.

timestamp

A timestamp for your request, in ticks.

Content-Type

application/json

Authorization

The bearer token, mandatory for all trade API's.

RequestId

A Unique GUID Request Token (Generate new request id on every request).

Web Application

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.

Call Back Url

http: //xxxx-baseurl-xxx/signin-oidc

PostLogoutUrl

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;
});

Backend/Console Application

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.

UI to generate Access-Token

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.

User API

Login

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.

Request URL

POST /user/login

Request parameters

country_code

User country code for example: mt, au

mobile_number

User mobile number without country code

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"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"

Verify OTP

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.

Request URL

POST /user/verifyotp

Request parameters

otp

Received on user's mobile number.

verification_code

Received in the /user/login API.

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"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"

Verify PIN

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.

Request URL

POST /user/verifypin

Request parameters

grant_type

user_credentials

pin

User account pin.

daily_trade_limit

Daily trade limit.

daily_withdraw_limit

Daily withdrawal limit.

total_trade_limit

Total trade limit.

total_withdraw_limit

Total withdrawal limit.

verification_code

Received in the /user/verifyotp API.

scope

Allowed scopes for the application.
For example trade:read, trade:create

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                                {
"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"

Logout

This is used to logout from the application.

Request URL

POST /user/logout

Request parameters

access_token

Access token generated in the /user/verifypin API.

client_id

Received after creating Application.

client_secret

Received after creating Application.

Response

                    
                            {
"property": value, "property": value, "property": value, "property": value, "property": value, "property": value
}

Market API

These APIs returns market details including ticker(s), book (pending orders), trades (executed orders) etc.

Market

Users can get a list of 24 hr stats for available pair by this API. Volume is in base currency units.

Request URL

GET /market

Scope

Param

Description

buy

Current Buy Rate

sell

Current Sell Rate

volume

Volume for last 24 Hrs

pricechange

Change in price

24hoursHigh

Highest Price in last 24 hours.

24hoursLow

Lowest Price in last 24 hours.

pair

Current trade pair

Sample Response

                    
                    [
{ "pair": "", "virtualCurrency": "", "volume": null }, { "buy": "0", "sell": "0", "volume": 0, "pricechange": "0.00", "24hoursHigh": "0", "24hoursLow": "0", "pair": "BTC-AUD", "virtualCurrency": "BTC", "currency": "AUD" },
... ]

Ticker

Users can get the ticker information for the current Trade Pair with daily volume and current Price by using this API.

Request URL

GET /market/{tradepair}/ticker

Scope

Param

Description

Tradepair

Example BTC-AUD, ETH-AUD etc.

buy

Current Buy Rate

sell

Current Sell Rate

volume

Volume for last 24 Hrs

pricechange

Change in price

24hoursHigh

Highest Price in last 24 hours.

24hoursLow

Lowest Price in last 24 hours.

pair

Current trade pair

Sample Response

                    
                            {
"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"
}

Book

Users can get a list of open orders for a trade pair by using this API.

Request URL

GET /market/{tradepair}/book

Scope

Param

Description

Tradepair

Example BTC-AUD, ETH-AUD etc.

asks

List of recent ask's Rates, with Price & Amount.

bids

List of recent bid's Rates, with Price & Amount.

pair

Current trade pair.

Sample Response

                    
                            {
                    
"asks": [], "bids": [ { "price": "14962.44", "amount": 20044680 } ], "pair": "btc-aud"
}

History

Users can get the trade History information for the current trade pair.

Request URL

GET /market/{tradepair}/trades

Scope

Param

Description

Tradepair

Example BTC-AUD, ETH-AUD etc.

trans_id

Transaction Id maintained uniquely at Zebpay.

fill_qty

Executed quantity. This can be partial or completely filled.

fill_price

Price at which the transaction is executed.

fill_flags

Ask(1)/Bid(2).

currencyPair

Current trade pair.

lastModifiedDate

Timestamp.

Sample Response

                    
                    [
                    
{ "trans_id": 13, "fill_qty": 1000000, "fill_price": 0.0005, "fill_flags": 1, "currencyPair": "BTC-AUD", "lastModifiedDate": 1538576785865 }
... ]

Trade API

This endpoint can be used to read order data as well as create a new order. User can also cancel a previously placed order.

Place a New 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.

Request URL

POST /orders

Request parameters
Param

Description

trade_pair

The trade pair must be a valid matching product available in the list of pairs for trading. Ex:BTC-AUD

side

It indicates the side at which the order is placed.
Bid side indicates a downtick and conversely Ask side indicates the uptick.

size

It indicates the amount of base currency required to Bid or Ask against the quote currency.

price

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.

Responses
Param

Description

id

Order id

price

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

It indicates the amount of base currency required to Bid or Ask against the quote currency.

type

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.

trade_pair

The trade pair must be a valid matching product available in the list of pairs for trading. Ex:BTC-AUD.

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

created_at

This indicates the date and time when the order is placed.

status

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"

Request

                    
                            {
"trade_pair": "btc-aud", "side": "ask", "size": 1, "price": 0.0005
}

Response

                    
                            {
"id": 555677, "price": 0.0005, "size": 1, "type": "limit", "trade_pair": "btc-aud", "side": "ask", "created_at": 1538576785865, "status": "pending"
}

List Trade Orders

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.

Request URL

GET /orders

Request parameters
Param

Description

trade_pair

Optional: The trade pair must be valid matching product available in the list of pairs for trading. Ex:BTC-AUD

status

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'.

orderid

Optional: Order Id

page

Optional: Page Number of the records to be seen.

limit

Optional: Number of records to be fetch in Single Page

Response parameters
Param

Description

id

Order Id

price

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

It indicates the amount of base currency required to Bid or Ask against the quote currency.

type

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.

trade_pair

The trade pair must be a valid matching product available in the list of pairs for trading.

side

It indicates the side at which the order is placed. Bid side indicates a downtick and conversely Ask side indicates the uptick.

created_at

This indicates the date and time when the order is placed.

executed_value

Executed value is filled_size * [price]

cancel_value

Amount of cancel value by price

fill_fees

Fee applicable

filled_size

Quantity of order executed

status

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"

settled

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
}

Fills

Users can get a single order's detail/fills by order id by using this API

Request URL

GET /orders/{orderid}/fills

Scope

Param

Description

orderid

Valid Order Id

size

Size indicates the amount of base currency required to Bid or Ask against the quote currency.

price

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

Amount shows the total executed value of order placed by the user.

feesType

Orders which provide liquidity are charged different fees from orders taking liquidity. Makers are charged differently than the market takers.

fees

The fee is calculated as a percentage of the executed amount.

intradayFees

Fees charged for traded quantities where buy and sell takes place on the same day.

totalFees

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

feeCurrency

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.

createDate

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
}

Cancel Trade Order

Users can cancel previously placed order by using this API.

Request URL:

DELETE /orders/{orderid}

Scope:

Param

Description

orderid

Valid Order Id

data

Success

                    

                            {
                    
"data": null, "statusCode": 200, "statusDescription": "success"
}

Trade Pair

Users can trade in following pairs supported by Zebpay

BTC-AUD

Bitcoin - Australian Dollar

BCH-AUD

Bitcoin Cash - Australian Dollar

ETH-AUD

Ether - Australian Dollar

XRP-AUD

Ripple - Australian Dollar

LTC-AUD

Litecoin - Australian Dollar

EOS-AUD

EOS - Australian Dollar

Instant Buy Sell

Request URL:

POST {{baseUrl}}/orders/instant

Scope:

Param

Description

size

0.00042980 (quantity)

trade_pair

btc-aud

side

buy or sell

price

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

pin

check below code for generating pin. for example: jPszI7hNC7623757xaoZjw==


Description

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"
}

Lightning

These endpoints are used to interact and make payments to lightning network.

Decode

This API is used to Decode Lightning invoice

Request URL

POST /lightning/decode

Scope

Param

Description

invoice

Example "lntb1530n1pwgpnr7pp5l62gagc880aw7qhknddjxtuc9ew5slkt6qhjwwepa7y0d8kvchuqdpcf45kcmrfdahzqsnfw33k76twypyx7mt9wpskwefqfaexgetjyq3njde4cqzysxqzfvcn27vxmzkrsgw6udwkfqgh4hylv3qvsdzpf42svc6pz6lrgh08cxtxf60q83hxpgxwq3t9uj344p4pwdpktnvy34hs2acaxyf42e0ygplvhhqe"

Sample Response

                    
                                {
                    
"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
}

Sample Error Response

                    
                                  {
                    
"statusCode": 400, "statusDescription" : "Error", "data" : {
message: "Invoice Expired"
}
}

Pay

This API is used to make a payment to lightning invoice

Request URL

POST /lightning/pay

Scope

Param

Description

invoice

Example "lntb1530n1pwgpnr7pp5l62gagc880aw7qhknddjxtuc9ew5slkt6qhjwwepa7y0d8kvchuqdpcf45kcmrfdahzqsnfw33k76twypyx7mt9wpskwefqfaexgetjyq3njde4cqzysxqzfvcn27vxmzkrsgw6udwkfqgh4hylv3qvsdzpf42svc6pz6lrgh08cxtxf60q83hxpgxwq3t9uj344p4pwdpktnvy34hs2acaxyf42e0ygplvhhqe"

amount

100

Sample Response

                    
                                    {
                    
"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"
}

Sample Error Response

                    
                                      {
                    
"statusCode": 400, "statusDescription": "Error", "data" : {}
}

Add

This API generates a new invoice to receive payment via Lightning Network.

Request URL

POST /lightning/add

Scope

Param

Description

amount

3

memo

test

namelabel

Torch

Sample Response

                    
                                    {
                    
"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",
}

Sample Error Response

                    
                                {
                    
"statusCode": 400, "statusDescription": "Error", "data" : {}
}

List Transactions

This API is used to list all Lightning Transactions

Request URL

GET /lightning/list

Sample Response

                    
                                {
                    
"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"
}
] },
}

Sample Error Response

                    
                                      {
                    
"statusCode": 400, "statusDescription": "Error", "data" : {}
}

Transaction details

This API is used to Get Lightning Transaction details

Request URL

GET /lightning/tx/{txid}

Scope

Param

Description

txid

Example /lightning/tx/716D3329-963C-4A98-ACEA-53ED526F6969

Sample Response

                    
                                    {
                    
"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",
}

Sample Error Response

                    
                                {
                    
"statusCode": 400, "statusDescription": "Error", "data" : {}
}

Websocket Feeds

The websocket feed provides real-time market data updates for following events:

  • 1. Tickers
  • 2. Orderbook
  • 3. Trades or History
  • 4. Instant Buy/Sell rates

Websocket Feeds Endpoint URL
ws://ws-feed.zebpay.com/marketdata

Connection Overview

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
}); });

Event Subscription

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/{tradepair} ticker/BTC-AUD
Orderbook book/{tradepair} book/BTC-AUD
History history/{tradepair} history/BTC-AUD
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-EUR
ws.emit('subscribe', 'ticker/BTC-AUD');

// To subscribe realtime orderbook event for BTC-AUD
ws.emit('subscribe', 'book/BTC-AUD');

// To subscribe realtime history event for BTC-AUD
ws.emit('subscribe', 'history/BTC-AUD');

// To subscribe realtime Instant Buy/Sell rate events for BTC-AUD
ws.emit('subscribe', 'traderates/BTC-AUD');

Realtime Event Data

To capture the data for any event, you have to simply add a socket listener for that event.

                    
                                ws.on('ticker/BTC-AUD', (data) => {
                                console.log('in event ticker/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,
}