Anycoin API (1.1)

Download OpenAPI specification:Download

API for Anycoin.cz opened only to verified partners.

Basics

Host (production): https://www.anycoin.cz

Host (staging): https://staging.anycoin.cz

Staging requires IP whitelisting. Contact your representative for access.

Authentication

Signing API requests:

There are two sets of keys: app key and user api key. App key is used to identify your app and user api key is used to identify the user.

  • Public endpoints (rates, currencies) do not require any authentication
  • Endpoints that are specific to the user, the user api key and app key are required
    • typically for trades, withdrawals etc.
    • the app key is only required if the api call is made by a third party app the the user authorized
  • Endpoint not specific to the user, only the app key is required
    • typically when the app wants to create a user

When signing with the app key, headers x-app-key and x-app-sgn must be added. When signing with the api key, headers x-api-key and x-api-sgn must be added.

Both x-app-sgn and x-api-sgn headers are calculated using the same algorithm, but with different secret keys.

Header x-timestamp must be added and contain current UTC timestamp in milliseconds. Call must then be made within +- 5 minutes, otherwise it will fail.

Pseudo algorithm:

import crypto from 'crypto';
import qs from 'qs';

export function calculateApiSignature(
  path: string,
  params: Object,
  timestamp: number,
  apiSecret: string,
) {
  const secret = Buffer.from(apiSecret, 'base64');
  const signatureInput =
    path + qs.stringify(params, {sort: alphabeticalSort}) + `${timestamp}`;

  const signature = crypto
    .createHmac('sha512', secret)
    .update(signatureInput)
    .digest()
    .toString('base64');

  return signature;
}
  

With this function, set these headers to correctly sign the api call:

  x-timestamp: (timestamp)
  x-api-key: (your api key)
  x-api-sgn: getSignature(path, body, timestamp, apiKeySecret)
  x-app-key: (your app key)
  x-app-sgn: getSignature(path, body, timestamp, appKeySecret)

Rates

Exchange rates

Get current exchange rates for all pairs.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Single exchange rate

Get detailed exchange rates (buy, sell, mid) for a specific pair.

query Parameters
base
string
Example: base=BTC

Base currency (coin)

quote
string
Example: quote=CZK

Quote currency (fiat)

Responses

Response samples

Content type
application/json
{
  • "buy": 9950,
  • "sell": 10050,
  • "mid": 10000
}

Currencies

Supported currencies

Get list of supported coins and fiats.

Responses

Response samples

Content type
application/json
{
  • "currencies": [
    ]
}

Accounts

Endpoints related to user accounts

User accounts

Returns a list of user's accounts with current balance.

Authorizations:
(AppKeyUserApiKey)
query Parameters
currencies
string[]

Array of currencies to return. If not specified, all currencies are returned.

Responses

Response samples

Content type
application/json
{
  • "accounts": [
    ]
}

Orders

Endpoints related to user orders

Order

Retrieve detailed information about a specific order by its id.

Authorizations:
(AppKeyUserApiKey)
query Parameters
order_id
number

Responses

Response samples

Content type
application/json
{ }

List of orders

Retrieve a list of user's orders.

Authorizations:
(AppKeyUserApiKey)

Responses

Response samples

Content type
application/json
{
  • "orders": [
    ]
}

Create order

Create a new order.

Authorizations:
(AppKeyUserApiKey)
query Parameters
coin_code
string
Example: coin_code=BTCCZK
coin_value
number
Example: coin_value=0.1

Amount of cryptocurrency to be bought/sold

fiat_value
number
Example: fiat_value=1000

Price to pay for the cryptocurrency

rate_value
number
Example: rate_value=10000

Rate to be used (must be equal to fiat_value / coin_value)

rate_type
string
Example: rate_type=CUSTOM

CUSTOM (for limit order) or MARKET (for market order)

sell
boolean
Example: sell=true

false for buy, true for sell

payment_type
string
Example: payment_type=VIRTUAL

always use VIRTUAL

payout_type
string
Example: payout_type=KEEP

always use KEEP

Responses

Response samples

Content type
application/json
{
  • "orderId": 0
}

Cancel order

Mark an order for cancellation.

Authorizations:
(AppKeyUserApiKey)
query Parameters
order_id
number

Responses

Response samples

Content type
application/json
{ }

Transactions

Transaction detail

Retrieve detailed information about a specific user transaction by its public id.

Authorizations:
(AppKeyUserApiKey)
path Parameters
publicId
required
string

The public ID of the transaction to retrieve details for

Responses

Response samples

Content type
application/json
{
  • "amount": 0,
  • "currency": null,
  • "orderId": 0,
  • "txnType": null,
  • "fundingStatus": null,
  • "fundingAddress": null,
  • "fundingUpdatedAt": "2019-08-24T14:15:22Z",
  • "withdrawalFee": 0,
  • "withdrawalTxId": "string",
  • "createdAt": "2019-08-24T14:15:22Z"
}

Transactions

Retrieve a list of user transactions.

Authorizations:
(AppKeyUserApiKey)

Responses

Response samples

Content type
application/json
{
  • "id": null,
  • "amount": 0,
  • "currency": null,
  • "orderId": 0,
  • "txnType": null,
  • "fundingStatus": null,
  • "fundingAddress": null,
  • "fundingUpdatedAt": "2019-08-24T14:15:22Z",
  • "withdrawalFee": 0,
  • "withdrawalTxId": "string",
  • "createdAt": "2019-08-24T14:15:22Z"
}

Withdrawals

Endpoints related to user withdrawals

Create a withdrawal

Create a new withdrawal request.

Authorizations:
(AppKeyUserApiKey)

Responses

Response samples

Content type
application/json
{
  • "accountTxnId": 0
}

Pay a lightning invoice

Pay a lightning invoice using the Lightning Network.

Authorizations:
(AppKeyUserApiKey)

Responses

Response samples

Content type
application/json
{
  • "accountTxnId": 0
}

Users

Endpoints related to user management

Creates a new user

Creates a new user with the given email.

Authorizations:
AppKey
query Parameters
email
string

User email, must be a valid email address. Will be converted to lowercase.

Responses

Response samples

Content type
application/json
{ }