Lydiax REST API

Lydiax REST API

Cryptocurrency Payment Gateway For Businesses
Introduction

The Lydiax API is designed to be a predictable and intuitive interface to enable merchants to buy/sell supported cryptocurrencies.

Sandbox REST API URL: https://sandbox-api.lydiax.com/

Production REST API URL: https://api.lydiax.com/

Authorization

The Lydiax API implements OAuth 2.0 to allow clients to log in without exposing their credentials. The process involves several steps:

Acquire an access token

  1. Use the access token to make authenticated requests
  2. Before you begin, you will need to get the client credentials from our staff.
  • Before you begin, you will need to get the client credentials from our staff.

Acquire an access token

The authentication key consists of your client id and client secret.

Note: The concatenated client id (public key) and client secret (private key) must be separated by a colon.

curl -X POST 'https://sandbox-api.lydiax.com/oauth/token?grant_type=client_credentials'
       -u LYDIAX_CLIENT_ID:LYDIAX_CLIENT_SECRET

Note: You can also log in with the basic authentication. You just need to encode the concatenated client id and client secret with Base64.

curl -X POST 'https://sandbox-api.lydiax.com/oauth/token?grant_type=client_credentials'
       -H 'Authorization: Basic NTQwMDcyNTFkYWI0NDEzOThhYjhjY2UwNzhjZjJkMGE6NGJlZGZiYWViMGE2NDBlMmI4NzI0MWVjMDkzMzEwODE='

Exchanging an access token

The access token must be exchanged in any authorized request in the header parameters. For example:

curl -X POST 'https://sandbox-api.lydiax.com/rates/BTCEUR'
       -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcl90eXBlIjoiQlVTSU5FU1MiLCJzY29wZSI6WyJ3cml0ZSJdLCJtZXJjaGFudF9pZCI6MzUwMCwiZXhwIjoxNTMyNTUyMzA1LCJhdXRob3JpdGllcyI6WyJNRVJDSEFOVF9XUklURSIsIk1FUkNIQU5UX1JFQUQiXSwianRpIjoiNDg5MTY5MTMtMDQ3Yi00YWNjLTk1ZmUtZjVhMjIzMDg5ZTk2IiwiY2xpZW50X2lkIjoiYjk3OGRkZTYyYzE2NDg2NjhhODIxMTEyNGI0MjJkN2UifQ.Ia9kALKsr094JFLNtRHcI4L9UuJu65aSt-doVmSK7Q3zH40pyrlGllcMVkp2dQRZrztD0ShSlYb7lIZygFPOthTfgf5LaFD6J3oKGY7lFcw312lAhQFIiyk-6'
Authorization
POST /oauth/token?grant_type=client_credentials
Authorization Token
POST /oauth/token?grant_type=client_credentials

Authentication

Open

This endpoint is used to acquire access token.

Request headers

The concatenated client id (public key) and client secret (private key) must be separated by a colon and then encoded with Base64.

Authorization
string required

Basic Authentication (Basic Base64_Encode(CLIENT-ID:CLIENT-SECRET))

Example:
Basic dXNlcjpwYXNzd29yZA==

Responses

200 OK
Body
Object
access_token
string

Access Token

Example:
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWFkIiwid3JpdGUiLCJwc3AiXSwicHNwX2lkIjoiMSIsImV4cCI6MTU0MTgwNjI2NCwiYXV0aG9yaXRpZXMiOlsiUk9MRV9QU1AiXSwianRpIjoiODE4NDg2OTUtMTc3ZC00NTVmLWI1M2YtMTZmNWFhMjRiZDRlIiwiY2xpZW50X2lkIjoiZGM5OWVhYzZjYWU0NzZiOTE4ZDM3ZGYxMTJhMzkxY2MxMWZmYTExMCJ9.KqzBMuiawZbYTE9FexmibkR_yVpQYQzsmQlh809f54c7UqyxniVHlPCFaLmog8YNm532mXPViTlO2evTtkINQu_tBFv6ds0Yl20XRaN4XElnUHAnGtumvpN4Tz8mDvHwRVFSE3GHsLFteaOZtFQBhHwoDw6Bs-ytAlit6cGytS-_fTESf59VA1GIAEvF1QY5SsS5ukLG7r04CtHdkGDdIoyWkFxhwOEzKquDx8KZaRn7P2anBMijmX0M89Sd5-4_c8ZFPwIQWxvNAVaKpn8z8LN8gpM5x7qctH7_ZaPlBJ6qiQAavzaakYm8WfmpVx_MA-ZwSjoillm_KHQsyeVTNQ
token_type
string

Token Type

Example:
bearer
expires_in
number

Token Expire Duration in ms

scope
string

Access Token Scope

Example:
read write psp
psp_id
number

PSP ID

Example:
1
jti
string

JWT ID

Example:
81848695-177d-455f-b53f-16f5aa24bd4e
Response Example
{
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWFkIiwid3JpdGUiLCJwc3AiXSwicHNwX2lkIjoiMSIsImV4cCI6MTU0MTgwNjI2NCwiYXV0aG9yaXRpZXMiOlsiUk9MRV9QU1AiXSwianRpIjoiODE4NDg2OTUtMTc3ZC00NTVmLWI1M2YtMTZmNWFhMjRiZDRlIiwiY2xpZW50X2lkIjoiZGM5OWVhYzZjYWU0NzZiOTE4ZDM3ZGYxMTJhMzkxY2MxMWZmYTExMCJ9.KqzBMuiawZbYTE9FexmibkR_yVpQYQzsmQlh809f54c7UqyxniVHlPCFaLmog8YNm532mXPViTlO2evTtkINQu_tBFv6ds0Yl20XRaN4XElnUHAnGtumvpN4Tz8mDvHwRVFSE3GHsLFteaOZtFQBhHwoDw6Bs-ytAlit6cGytS-_fTESf59VA1GIAEvF1QY5SsS5ukLG7r04CtHdkGDdIoyWkFxhwOEzKquDx8KZaRn7P2anBMijmX0M89Sd5-4_c8ZFPwIQWxvNAVaKpn8z8LN8gpM5x7qctH7_ZaPlBJ6qiQAavzaakYm8WfmpVx_MA-ZwSjoillm_KHQsyeVTNQ",
    "token_type": "bearer",
    "expires_in": 1,
    "scope": "read write psp",
    "psp_id": 1,
    "jti": "81848695-177d-455f-b53f-16f5aa24bd4e"
}
Rates
GET /rates/{currencyPairCode}
GET /withdraw/rates/{currencyPairCode}
GET /deposit/rates/{currencyPairCode}
Get Market Rate
GET /rates/{currencyPairCode}

Retrieve the current market rate.

Path variables

currencyPairCode
string required

Currency pair code: [BTCEUR, BCHEUR, XRPEUR, LTCEUR, ETHEUR]

Responses

200 200

OK

Body
*/*
Object
currency_pair
string
Example:
BTCEUR
buy_rate
number
Example:
1234.12
sell_rate
number
Example:
1234.01
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Response Example
{
    "buy_price": 123.45,
    "currency_pair": "BTCEUR",
    "sell_price": 123.45
}
Get Withdraw Rate
GET /withdraw/rates/{currencyPairCode}

Retrieve the best current market rate for withdraw transactions.

Path variables

currencyPairCode
string required

Currency pair code: [BTCEUR, BCHEUR, XRPEUR, LTCEUR, ETHEUR]

Responses

200 200

OK

Body
*/*
Object
currency_pair
string

Currency pair code

Example:
BTCEUR
buy_rate
number

Buy rate for withdraw

Example:
1234.12
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Response Example
{
    "buy_price": 123.45,
    "currency_pair": "BTCEUR"
}
Get Deposit Rate
GET /deposit/rates/{currencyPairCode}

Retrieve the best current market rate for deposit transactions.

Path variables

currencyPairCode
string required

Currency pair code: [BTCEUR, BCHEUR, XRPEUR, LTCEUR, ETHEUR]

Responses

200 200

OK

Body
*/*
Object
currency_pair
string

Currency pair code

Example:
BTCEUR
sell_rate
number

Sell rate for deposit

Example:
1234.01
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Response Example
{
    "currency_pair": "BTCEUR",
    "sell_price": 123.45
}
Orders
POST /conversions
POST /orders
POST /withdraws
GET /orders/{orderId}
Get Order Price
POST /conversions

PSPs can create conversion

Request body

application/json
Object
currency_pair
string

Currency pair code

Example:
BTCEUR
transaction_type
string

Transaction type

Examples:
BUYSELLWITHDRAW
amount
number

Cryptocurrency amount

Example:
0.1234
total
number

Money amount

Example:
1234.12

Responses

200 200

OK

Body
*/*
Object
amount
number

Cryptocurrency amount

Example:
0.1234
total
number

Transaction total

Example:
1234.12
expires
string

Conversion token expiration time

Example:
2018-12-20T16:20:12.942
token
string

Conversion token

Example:
DAeba1ThzKhIhEaEk9k7qvxrOtl3mqeescI5BHLCPCNVTN1ltWjxd92e8i8Y4MZkSRGP4SnPlHw7rR98qJQ==
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Create Order
POST /orders

PSPs users can create orders

Request body

application/json

orderData

Object
token
string

Conversion token

Example:
DAeba1ThzKhIhEaEk9k7qvxrOtl3mqeescI5BHLCPCNVTN1ltWjxd92e8i8Y4MZkSRGP4SnPlHw7rR98qJQ==
customer
Object

Customer details

reference_id
string

Customer reference id

Example:
SV-000001
first_name
string

Customer first name

Example:
John
last_name
string

Customer last name

Example:
Doe
email
string

Customer email address

Example:
john.doe@gmail.com
ip_address
string

Customer IP address

Example:
127.0.0.1

Responses

200 200

OK

Body
*/*
Object
id
integer

Order id

Example:
1
type
string

Order type

Examples:
BUYSELL
status
string

Order status

Example:
PENDING
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Withdraw
POST /withdraws

PSPs users can create withdraws

Request body

application/json

Customer withdrawal details

Object
token
string

Conversion token

Example:
DAeba1ThzKhIhEaEk9k7qvxrOtl3mqeescI5BHLCPCNVTN1ltWjxd92e8i8Y4MZkSRGP4SnPlHw7rR98qJQ==
address
string

Customer wallet address

Examples:
2MvjvPzR9fgazeqjuuB7ARDuxJC1f9AXZC4rfPmoTFk3ZoV7VMtCowe3doLxjgBu2ge3t?dt=2
customer
Object

Customer details

reference_id
string

Customer reference id

Example:
SV-000001
first_name
string

Customer first name

Example:
John
last_name
string

Customer last name

Example:
Doe
email
string

Customer email address

Example:
john.doe@gmail.com
ip_address
string

Customer IP address

Example:
127.0.0.1

Responses

200 200

OK

Body
*/*
Object
id
integer

Order id

Example:
1
type
string

Order type

Example:
WITHDRAW
status
string

Order status

Example:
PENDING
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Get Order Details
GET /orders/{orderId}

PSPs users can create orders

Path variables

orderId
string required

Order ID

Responses

200 200

OK

Body
*/*
Object
id
integer

Order ID

Example:
1
status
string

Order status

Examples:
COMPLETEDPENDINGFAILED
type
string

Order type

Examples:
BUYSELLWITHDRAWDEPOSITPAYMENT
currency_pair
string

Currency pair code

Example:
BTCEUR
amount
number

Order amount

Example:
0.1234
total
number

Order total

Example:
1234.12
reference_id
string

Customer reference id

Example:
SV-0001
first_name
string

Customer first name

Example:
John
last_name
string

Customer last name

Example:
Doe
email
string

Customer email address

Example:
john.doe@gmail.com
ip_address
string

Customer ip address

Example:
127.0.0.1
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Coin Deposit Address
POST /customer/deposit/address
GET /customer/{referenceId}/deposit/address/{cryptocurrencyCode}
Create Customer Deposit Address
POST /customer/deposit/address

Creates a deposit address for a customer

Request body

application/json

Create a wallet address for deposit transactions

Object
cryptocurrency_code
string

Cryptocurrency code

Examples:
BTCBCHXRPLTCETH
customer
Object

Customer details

reference_id
string

Customer reference id

Example:
SVG-000001
first_name
string

Customer first name

Example:
John
last_name
string

Customer last name

Example:
Doe
email
string

Customer email address

Example:
john.doe@gmail.com

Responses

200 200

OK

Body
*/*
Object
id
integer

Customer deposit wallet address id

Example:
1
address
string

Customer deposit wallet address

Example:
QS2ZRh8xVbT4uSHUKKQi7aEziZnra1p4WV
cryptocurrency_code
string

Cryptocurrency code

Example:
BTC
401 401

Unauthorized

*/*
403 403

Forbidden

*/*
404 404

Not Found

*/*
Get Customer Deposit Address
GET /customer/{referenceId}/deposit/address/{cryptocurrencyCode}

Fetches previously created deposit address for a customer.

Path variables

referenceId
string required
cryptocurrencyCode
string required

Responses

200 200

OK

Body
Object
address
string
201 Created

Created

Payment
POST /payments/hosted
POST /payments
POST /payments/{paymentReferenceId}/conversion
GET /payments/{paymentReferenceId}
POST /payments/{paymentReferenceId}/accept
POST /payments/{paymentReferenceId}/refund
Create Hosted Payment
POST /payments/hosted

Creates a payment request and returns a hosted payment page url

Request body

Object
currency
string required

Currency code

Example:
EUR
total
number required

Payment amount

Example:
123.45
reference
Object required

Payment reference

customer
Object

Customer details

reference_id
string required

Customer reference id

Example:
SV-000001
first_name
string

Customer first name

Example:
John
last_name
string

Customer last name

Example:
Doe
email
string

Customer email addres

Example:
john.doe@gmail.com
ip_address
string

Customer ip address

Example:
127.0.0.1
merchant_name
string required

Merchant name

Example:
Merchant ABC
description
string nullable

Payment description

Example:
Order #1 Item

Responses

200 OK
Body
Object
total
number

Payment amount

Example:
123.45
currency
string

Currency code

Example:
EUR
status
string

Payment status

Example:
CREATED
description
string

Payment description

Example:
Order #1 Item
expired
string

Payment expiration timestamp

Example:
2019-01-10T12:23:50.33
payment_id
string

Payment reference id

Example:
PAYM-1a2b3c4d5f6g
payment_url
string

The URL where the customer will be redirected to complete the payment

Example:
https://payment.lydiax.com/sci/payments/PAYM-1a2b3c4d5f6g
Create Payment
POST /payments

Creates a payment request

Request body

Object
currency
string required

Currency code

Example:
EUR
return_url
string

The URL where the customer will return to your website after a successful payment

Example:
https://www.merchant-website.com/success-payment
failure_url
string

The URL where the customer will return to your website after a failed payment

Example:
https://www.merchant-website.com/failure-payment
total
number required

Payment amount

Example:
123.45
reference
Object required

Payment reference

customer
Object

Customer details

reference_id
string required

Customer reference id

Example:
SV-000001
first_name
string

Customer first name

Example:
John
last_name
string

Customer last name

Example:
Doe
email
string

Customer email addres

Example:
john.doe@gmail.com
ip_address
string

Customer ip address

Example:
127.0.0.1
merchant_name
string required

Merchant name

Example:
Merchant ABC
description
string nullable

Payment description

Example:
Order #1 Item

Responses

200 OK
Body
Object
total
number

Payment amount

Example:
123.45
currency
string

Currency code

Example:
EUR
status
string

Payment status

Example:
CREATED
description
string

Payment description

Example:
Order #1 Item
expired
string

Payment expiration timestamp

Example:
2019-01-10T12:23:50.33
payment_id
string

Payment reference id

Example:
PAYM-1a2b3c4d5f6g
methods
Array

Supported payment methods

Object
name
string

Cryptocurrency name

Example:
Bitcoin
code
string

Cryptocurrency code

Example:
BTC
Payment Conversion
POST /payments/{paymentReferenceId}/conversion

Path variables

paymentReferenceId
string required

Payment reference number

Example:
PAYM-1a2b3c4d5f6g

Request body

Object
cryptocurrency_code
string

Cryptocurrency code

Examples:
BTCLTCXRPBCH

Responses

200 OK
Body
Object
payment_id
string

Payment reference number

Example:
PAYM-1a2b3c4d5f6g
currency
string

Payment currency

Example:
EUR
total
number

Payment amount

Example:
123.45
amount
number

Cryptocurrency amount

Example:
0.12345
merchant_name
string

Merchant name

Example:
Merchant A
status
string

Payment status

Example:
COMPLETED
cryptocurrency
string

Cryptocurrency code

Example:
LTC
address
string

Payment cryptocurrency address

Example:
QVminJah59qeMaJQq24johqP3BHfQZvYKW
expires_in
integer

Payment expire duration in seconds

Example:
123
Get Payment Details
GET /payments/{paymentReferenceId}

Path variables

paymentReferenceId
string required

Payment reference number

Example:
PAYM-1a2b3c4d5f6g

Responses

200 OK
Body
Object
payment_id
string

Payment reference number

Example:
PAYM-1a2b3c4d5f6g
currency
string

Payment currency

Example:
EUR
total
number

Payment amount

Example:
123.45
amount
number

Cryptocurrency amount

Example:
0.12345
merchant_name
string

Merchant name

Example:
Merchant A
status
string

Payment status

Example:
COMPLETED
cryptocurrency
string

Cryptocurrency code

Example:
LTC
address
string

Payment cryptocurrency address

Example:
QVminJah59qeMaJQq24johqP3BHfQZvYKW
expires_in
integer

Payment expire duration in seconds

Example:
123
return_url
string

The URL where the customer will return to your website after a successful payment

Example:
https://www.merchant-website.com/success-payment
failure_url
string

The URL where the customer will return to your website after a failed payment

Example:
https://www.merchant-website.com/failure-payment
is_refundable
boolean

Payment refundable status

Example:
true
refundable_amount
integer

Refundable amount

Example:
12.34
is_acceptable
boolean

Payment acceptable status

Example:
true
acceptable_amount
integer

Acceptable amount

Example:
123.01
Accept Payment
POST /payments/{paymentReferenceId}/accept

Creates a refund

Path variables

paymentReferenceId
string required

Payment reference id

Responses

202 Accepted
Body
Object
currency
string

Payment currency code

Example:
EUR
total
number

Payment total

Example:
123.45
amount
number

Payment cryptocurrency amount

Example:
0.1234
cryptocurrency
string

Payment cryptocurrency

Example:
LTC
address
string

Payment address

Example:
QR2ErhhJb1gE1WCFihqbT5BKFzPKdfAUr2
blockchain_tx_id
string

Blockchain transaction id

Example:
bb0316814ccd6fd10f5d7455e788de2abb6f7feb784dbbb40ac7050999bdb4a1
Refund Payment
POST /payments/{paymentReferenceId}/refund

Creates a refund

Path variables

paymentReferenceId
string required

Payment reference id

Request body

Object
address
string required

Refund address

Example:
QS2ZRh8xVbT4uSHUKKQi7aEziZnra1p4WV
reason
string nullable

Refund reason

Example:
excess cryptocurrency amount

Responses

200 OK
Body
Object
refund_id
string

Refund id

Example:
1
amount
number

Total refund amount

Example:
123.45
payment_id
string

Payment reference id

Example:
PAYM-1a2b3c4d5f6g
address
string

Refund address

Example:
QS2ZRh8xVbT4uSHUKKQi7aEziZnra1p4WV
Webhooks

Webhook details

POST /your-webhook-url
Webhook Details
POST /your-webhook-url

Request headers

User-Agent
string optional

Webhook user agent

Example:
Lydiax-Hook
Webhook-Id
string optional

Webhook id

Example:
1

Request body

Object
id
integer

Order id

Example:
1
status
string

Order status

Example:
COMPLETED
type
string

Order transaction type

Example:
PAYMENT
currency_pair
string

Currency pair code

Example:
BTCEUR
order_amount
number

Cyyptocurrency amount

Example:
0.12345
order_total
number

Order total

Example:
1234.56
reference_id
string

Customer reference id

Example:
BSL-000001
first_name
string

Customer first name

Example:
John
last_name
string

Customer last name

Example:
Doe
email
string

Customer email address

Example:
john.doe@gmail.com
ip_address
string

Customer ip address

Example:
127.0.0.1
address
string

Payment address

Example:
2Mv2VAaATwnmaqxNLRWQB3vVUyjrMpy48zr
blockchain_tx_id
string

Blockchain transaction id

Example:
bb0316814ccd6fd10f5d7455e788de2abb6f7feb784dbbb40ac7050999bdb4a1
payment_id
string

Payment reference id

Example:
PAYM-1a2b3c4d5f6g