Transaction processing takes up to 1 minute, with amount up to $2000. Transactions over $2000 can take up to 1 hour.

UniEx API: User Manual

Contents

Introduction

The UniEx API is designed for website owners who want to provide their customers with the ability to quickly and conveniently exchange electronic currencies. The API is built using standard RESTful web services, all data is passed to the API and returned in JSON format.

Our API is constantly evolving and improving. Please, follow the updates on this page.

Authentication

Authentication in the UniEx API is done by passing the "Authorization: Bearer" header in the request:

Authorization: Bearer YOUR_TOKEN

Access to the Uniex API is provided in manual mode. To get your authentication token, please write an e-mail to [email protected] with your UniEx website login and a brief description of how you plan to use the API.

Standard Data Structures

This section lists the standard data structures that are used later in describing the responses of the UniEx API.

Unexpected Error

In some situations (for example, website maintenance), errors are returned that are not directly related to the requested operation.

FieldTypeDescription
errorstringError description (for example, "Maintenance mode.")

Error Message

FieldTypeDescription
errorstringshort description of the error
messagestringfull description of the error
codeintegererror code
statusintegerHTTP-response code

Exchange Operation Information

FieldTypeDescription
idstringoperation ID at UniEx website
urlstringoperation URL at UniEx website
income_codestringincome currency code
outgo_codestringoutgo currency code
income_amountfloatincome currency amount
outgo_amountfloatoutgo currency amount
payment_urlstringURL for transferring the required amount to the UniEx service
statusstringexchange operation status
created_atstringdate and time (ISO-8601) when exchange operation was created
canceled_atstringdate and time (ISO-8601) when exchange operation was cancelled
income_atstringdate and time (ISO-8601) when the money arrived to UniEx service
outgo_atstringdate and time (ISO-8601) when the money was sent to client

Receive Data for Exchange Operation Registration

Before registering an exchange operation, it is necessary to obtain a list of fields that will need to be transferred to the Exchange Operation Registration method.

Request Method and URL

OPTIONS https://uniex.co/api/exchange/{from}-{into}

, where {from} is the code of currency client will send, {into} is the code of currency client will receive in exchange.

Currency codes available: BTC, BCH, ETH, DASH, LTC, DOGE, PMUSD, PMEUR, PMRUSD, PRUSD, PRRUB, EXMUSD, EXMRUB, EXMUAH, ZEC, USDT, ADVCUSD, ADVCEUR, ADVCRUB, CARDUAH.

Successful Response

FieldTypeDescription
can_createbooleanability to create exchange operation
fieldsarraylist of fields to be transferred to the Exchange Operation Registration method (arrays containing the code and label of the field)
$ curl https://uniex.co/api/exchange/BTC-OKUSD -i \
  -X OPTIONS \
  -H "Authorization: Bearer YOUR_TOKEN"

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

{
    "can_create": true,
    "fields": [
        {
            "field": "income_amount",
            "label": "Exchange Bitcoin BTC"
        },
        {
            "field": "wallet",
            "label": "OkPay Wallet"
        }
    ]
}

Error Response

In case of an error, the Error Message data structure is returned.

Exchange Operation Registration

Method starts procedure of exchange of one currency into another.

Request Method and URL

POST https://uniex.co/api/exchange/{from}-{into}

, where {from} is the code of currency client will send, {into} is the code of currency client will receive in exchange.

Currency codes available: BTC, BCH, ETH, DASH, LTC, DOGE, PMUSD, PMEUR, PMRUSD, PRUSD, PRRUB, EXMUSD, EXMRUB, EXMUAH, ZEC, USDT, ADVCUSD, ADVCEUR, ADVCRUB, CARDUAH.

Successful Response

If the method succeeds, the Exchange Operation Information data structure is returned.

$ curl https://uniex.co/api/exchange/BTC-OKUSD -i \
  -X POST \
  -d "income_amount=0.01000000" \
  -d "wallet=OK123456" \
  -H "Authorization: Bearer YOUR_TOKEN"

HTTP/1.1 201 Created
Content-Type: application/json; charset=UTF-8

{
    "id": "1a9ef720da",
    "url": "https://uniex.co/exchange/1a9ef720da",
    "income_code": "BTC",
    "outgo_code": "OKUSD",
    "income_amount": "0.01000000",
    "outgo_amount": "95.95",
    "payment_url": "bitcoin:4HmrT8HBthGCzyUwgpBxqj9TmhaYLNSTk7?amount=0.30000000",
    "status": "Waiting payment from Mar 5, 2018, 5:25:51 PM.",
    "created_at": "2018-03-05T15:25:51+0000",
    "canceled_at": null,
    "income_at": null,
    "outgo_at": null
}

Error Response

In case of an error, the Error Message data structure is returned.

Obtain Exchange Operation Status

Using this method, you can check the current status of the previously created exchange operation.

Request Method and URL

GET https://uniex.co/api/exchange/{id}

, where {id} is the exchange operation id obtained as a result of exchange operation registration.

Successful Response

If the method succeeds, the Exchange Operation Information data structure is returned.

$ curl https://uniex.co/api/exchange/1a9ef720da -i \
  -X GET \
  -H "Authorization: Bearer YOUR_TOKEN"

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

{
    "id": "1a9ef720da",
    "url": "https://uniex.co/exchange/1a9ef720da",
    "income_code": "BTC",
    "outgo_code": "OKUSD",
    "income_amount": "0.01000000",
    "outgo_amount": "95.95",
    "payment_url": "bitcoin:4HmrT8HBthGCzyUwgpBxqj9TmhaYLNSTk7?amount=0.30000000",
    "status": "Waiting payment from Mar 5, 2018, 5:25:51 PM.",
    "created_at": "2018-03-05T15:25:51+0000",
    "canceled_at": null,
    "income_at": null,
    "outgo_at": null
}

Error Response

In case of an error, the Error Message data structure is returned.

Cancel Exchange Operation

The method allows you to cancel the previously created exchange operation (in case it is not yet completed).

Request Method and URL

DELETE https://uniex.co/api/exchange/{id}

, where {id} is the exchange operation id obtained as a result of exchange operation registration.

Successful Response

If the method succeeds, the Exchange Operation Information data structure is returned.

$ curl https://uniex.co/api/exchange/1a9ef720da -i \
  -X DELETE \
  -H "Authorization: Bearer YOUR_TOKEN"
  
HTTP/1.1 202 Accepted
Content-Type: application/json; charset=UTF-8

{
    "id": "1a9ef720da",
    "url": "https://uniex.co/exchange/1a9ef720da",
    "income_code": "BTC",
    "outgo_code": "OKUSD",
    "income_amount": "0.01000000",
    "outgo_amount": "95.95",
    "payment_url": null,
    "status": "Canceled just now.",
    "created_at": "2018-03-05T15:25:51+0000",
    "canceled_at": "2018-03-13T07:01:04+0000",
    "income_at": null,
    "outgo_at": null
}

Error Response

In case of an error, the Error Message data structure is returned.

Obtain Your Exchange Operations List

The method returns information on all your exchange operations page-by-page in the form of an array. In addition to the exchange data, pagination information is returned in the API response headers.

Request Method and URL

GET https://uniex.co/api/exchanges[?page={n}]

, where ?page={n} is an optional (for the first page) parameter indicating the number of the requested data page.

Response Pagination Headers

ПолеТипОписание
X-Pagination-Total-Countintegertotal records count
X-Pagination-Page-Countintegercurrent page records count
X-Pagination-Current-Pageintegercurrent page number
X-Pagination-Per-Pageintegerrecords per page
Linkstringfirst, current, next, last page links

Successful Response

In case of a successful response, an array of exchange operations is returned, where each element of the array is a Exchange Operation Information data structure.

$ curl https://uniex.co/api/exchanges -i \
  -X GET \
  -H "Authorization: Bearer YOUR_TOKEN"

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
X-Pagination-Total-Count: 41
X-Pagination-Page-Count: 3
X-Pagination-Current-Page: 1
X-Pagination-Per-Page: 20
Link: <https://uniex.co/api/exchanges?page=1>; rel=self, <https://uniex.co/api/exchanges?page=2>; rel=next, <https://uniex.co/api/exchanges?page=3>; rel=last

[
    {
        "id": "2a4de64af9",
        "url": "https://uniex.co/exchange/2a4de64af9",
        "income_code": "BTC",
        "outgo_code": "OKUSD",
        "income_amount": "0.10000000",
        "outgo_amount": "959.54",
        "status": "Canceled an hour ago.",
        "created_at": "2018-03-05T12:23:26+0000",
        "canceled_at": "2018-03-05T12:23:38+0000",
        "income_at": null,
        "outgo_at": null
    },
    {
        "id": "2a4dd26d99",
        "url": "https://uniex.co/exchange/2a4dd26d99",
        "income_code": "PMRUSD",
        "outgo_code": "BTC",
        "income_amount": "13.94",
        "outgo_amount": "0.01660167",
        "status": "Completed, 0.01660167 BTC was sent a year ago.",
        "created_at": "2016-12-16T08:08:51+0000",
        "canceled_at": null,
        "income_at": "2016-12-16T08:08:52+0000",
        "outgo_at": "2016-12-16T08:08:52+0000"
    },
    ...
]

Error Response

In case of an error, the Error Message data structure is returned.