Obtaining API Keys through the User Account
The user can access the API through their personal account:
User API Section.
After selecting the methods and specifying IP addresses, the user must click the “Add API Key” button. The generated Login — Key pair will be displayed on the page. Multiple keys with different method sets can be issued for one user.
Using the API
Entry Point:
https://crystal-trade.org/api/userapi/v1/
+ API method
For authorization, inсlude the following headers with the information obtained from the “API” section:
- API-LOGIN — API login
- API-KEY — API key
- API-LANG — Force the use of the specified language (optional). Example:
ru_RU
,en_US
.
All requests are sent using the POST method, and the response is returned in JSON format. GET requests are not used, and parameters are passed in the request body.
Methods of working with the API:
- test
A test method to verify API functionality.
Request parameters:
---
Response:
ip - your IP address
user_id - user ID (if the systеm is querying, ID = 0)
locale - website language
partner_id - partner ID
- get_direction_currencies
Retrieve a list of currencies available for exchange.
Request parameters:
currency_id_give - ID of the "From" currency (filter, optional parameter)
currency_id_get - ID of the "To" currency (filter, optional parameter)
Response:
The response includes 2 lists:
give - list of "From" currencies
get - list of "To" currencies
Each list contains the following data:
id - currency ID in the exchange
title - currency name in the exchange
logo - currency logo link
- get_directions
Retrieve a list of exchange directions available for exchange.
Request parameters:
currency_id_give - ID of the "From" currency (filter, optional parameter)
currency_id_get - ID of the "To" currency (filter, optional parameter)
Response:
The response includes a list of exchange directions, where:
direction_id - exchange direction ID in the exchange
currency_give_id - ID of the "From" currency in the exchange
currency_give_title - name of the "From" currency in the exchange
currency_give_logo - logo of the "From" currency in the exchange
currency_get_id - ID of the "To" currency in the exchange
currency_get_title - name of the "To" currency in the exchange
currency_get_logo - logo of the "To" currency in the exchange
- get_direction
Retrieve information about the exchange direction.
Request parameters:
direction_id - exchange direction ID
Response:
id — exchange direction ID in the systеm
url — link to the exchange page
currency_code_give — "From" currency code
currency_code_get — "To" currency code
reserve — reserve amount
course_give — exchange rate for "From" currency
course_get — exchange rate for "To" currency
sum_give — amount in "From" currency
sum_give_com — amount in "From" currency including commission
sum_get — amount in "To" currency
sum_get_com — amount in "To" currency including commission
com_give — commission text for "From" currency
com_get — commission text for "To" currency
min_give — minimum amount for "From" currency, if not set - "no"
max_give — maximum amount for "From" currency, if not set - "no"
min_get — minimum amount for "To" currency, if not set - "no"
max_get — maximum amount for "To" currency, if not set - "no"
info
timeline_text — description of the exchange
frozen_text — text for frozen status
before_button_text — text before the "Pay" button
give_fields — list of fields related to "From" currency
get_fields — list of fields related to "To" currency
dir_fields — list of exchange direction fields
Field description:
name — field name for transmission
type — field type
label — field description
req — 0 - optional, 1 - mandatory
tooltip — tooltip text
options — possible options, if the field is of type "sеlect"
cd — pointer to additional parameters
- get_calc
Calculator for amounts for exchange direction.
Request parameters:
direction_id - exchange direction ID
calc_amount - amount
calc_action - amount ownership: 1 - amount in "From" currency, 2 - amount in "To" currency, 3 - amount in "From" currency with commission, 4 - amount in "To" currency with commission
cd - fields from the exchange direction, marked cd = 1, in one field. The field is URL encoded.
Response:
currency_code_give - "From" currency code
currency_code_get - "To" currency code
reserve - "To" currency reserve
course_give - "From" currency course
course_get - "To" currency course
sum_give - amount in "From" currency
sum_give_com - amount in "From" currency with commission
sum_get - amount in "To" currency
sum_get_com - amount in "To" currency with commission
com_give - commission text of "From" currency
com_get - commission text of "To" currency
min_give - minimum amount of "From" currency, not set if "no"
max_give - maximum amount of "From" currency, not set if "no"
min_get - maximum amount of "To" currency, not set if "no"
max_get - maximum amount of "To" currency, not set if "no"
changed - flag indicating change in the entered amount: 0 - no change needed, 1 - Needs to be changed
- get_exchanges
Displaying orders created with this key
Request parameters:
start_time - unix time from which to display orders (filter, optional parameter)
end_time - unix time until which to display orders (filter, optional parameter)
ip - IP address (filter, optional parameter)
id - order ID (filter, optional parameter)
api_id - ID passed in the API (filter, optional parameter)
status_history - whether to display status history: 0 - no, 1 - yes (filter, optional parameter)
limit - number of displayed orders (filter, optional parameter)
offset - how many orders to skip (filter, optional parameter)
Response:
items - list of orders
id - order ID
api_id - ID passed in the API
time - time of status change
date - date of status change
psys_give - payment systеm of "From" currency
psys_get - payment systеm of "To"
currency_code_give - code of "From"
currency_code_get - code of "To"
course_give - course of "From"
course_get - course of "To"
amount_give - amount in "From"
amount_get - amount in "To"
exchange_success - 0 - order executed, 1 - order not executed
user_hash - user hash
user_ip - user IP
status - order status
statuses - list of status changes
time - time of status change
date - date of status change
status - order status
- create_bid
Creating an order
Request parameters:
direction_id - exchange direction ID
partner_id - partner ID (optional parameter)
api_id - order ID in your systеm (optional parameter)
calc_amount - exchange amount
calc_action - amount ownership: 1 - amount in "From" currency, 2 - amount in "To" currency, 3 - amount in "From" currency with commission, 4 - amount in "To" currency with commission
callback_url - response URL when order status changes.
account1 - from account
cfgive8 - cardholder's name
account2 - to account
cfgive3 - refund address
cf1-99 - custom fields
Example:
cf1 - First Name
cf2 - Middle Name
cf3 - Last Name
cf4 - Phone Number
cf6 - E-mail
cf11 - Telegram
Response:
url - link to the exchange page
id - order ID
hash - order hash
status - order status
status_title - order status title
psys_give - payment systеm of "From" currency
psys_get - payment systеm of "To" currency
currency_code_give - code of "From" currency
currency_code_get - code of "To" currency
amount_give - amount in "From"
amount_get - amount in "To"
api_actions - options
type - payment type
cancel - order cancellation method
instruction - payment instruction
pay_amount - amount to be paid
- cancel_bid
Cancel an order (method works only if the response to create_bid includes api_actions -> cancel = ‘api’)
Request parameters:
hash - order hash
Response:
order status
- pay_bid
Mark an order as paid (method works only if the response to create_bid includes api_actions -> pay = ‘api’)
Request parameters:
hash - order hash
Response:
order status
- bid_info
Payment information about the order
Request parameters:
id - Order ID (optional if hash is provided)
hash - Order hash (optional if ID is provided)
Response:
url - Link to the exchange page
id - Order ID
hash - Order hash
status - Status
status_title - Status title
psys_give - Payment systеm for "From" currency
psys_get - Payment systеm for "To" currency
currency_code_give - Currency code for "From" currency
currency_code_get - Currency code for "To" currency
amount_give - Amount in "From"
amount_get - Amount in "To"
api_actions - Options
type - Payment type
cancel - Order cancellation method
instruction - Payment instruction
pay_amount - Amount to be paid
- get_partner_info
Partner information
Request parameters:
---
Response:
partner_id - Partner ID
balance - Balance
min_payout - Minimum payout amount
items - List of currencies for payout:
id - Currency ID
title - Currency name
commission - Commission
amount - Balance in this currency
- get_partner_links
Information about partner links
Request parameters:
start_time - Unix time from which to display (filter, optional parameter)
end_time - Unix time until which to display (filter, optional parameter)
ip - IP address (filter, optional parameter)
limit - Number of displayed items (filter, optional parameter)
Response:
items - List of partner links:
time - Transition time
date - Transition date
browser - Browser
ip - Transitioning user's IP address
referrer - Page from which the transition was made
user_hash - User hash
query_string - Query string
- get_partner_exchanges
Information about partner exchanges
Request parameters:
start_time - Unix time from which to display orders (filter, optional parameter)
end_time - Unix time until which to display orders (filter, optional parameter)
ip - IP address (filter, optional parameter)
id - Order ID (filter, optional parameter)
status_history - Whether to display status history: 0 - no, 1 - yes (filter, optional parameter)
limit - Number of displayed orders (filter, optional parameter)
Response:
items - List of orders:
id - Order ID
time - Time of status change
date - Date of status change
psys_give - Payment systеm for "From" currency
psys_get - Payment systеm for "To" currency
currency_code_give - Currency code for "From" currency
currency_code_get - Currency code for "To" currency
course_give - Exchange rate for "From" currency
course_get - Exchange rate for "To" currency
amount_give - Amount in "From" currency
amount_get - Amount in "To" currency
exchange_success - 0 - order completed, 1 - order not completed
accrued - 0 - no reward accrued, 1 - reward accrued
partner_reward - Partner's reward
user_hash - User hash
user_ip - User's IP address
status - Order status
statuses - List of status changes:
time - Time of status change
date - Date of status change
status - Order status
- get_partner_payouts
List of withdrawal requests from users for funds withdrawal
Request parameters:
start_time - Unix time from which to display (filter, optional parameter)
end_time - Unix time until which to display (filter, optional parameter)
limit - Number of displayed items (filter, optional parameter)
id - Request ID (filter, optional parameter)
Response:
items - Listid - Request ID
time - Time of payout
date - Date of payout
method_id - Payout currency
account - Payout account
pay_amount - Payout amount
pay_currency_code - Payout currency code
original_amount - Original payout amount
original_currency_code - Original payout currency code
status - Request status. 0 - pending, 1 - paid out, 2 - cancelled
- add_partner_payout
Creation of a withdrawal request
Request parameters:
method_id - Payout currency ID
account - Account number for payout
Response:
payout_id - Payout ID