NAV
HTTP cURL Ruby Java JavaScript

Introduction

Bitspark is the pioneer of the worlds first cash in, cash out Blockchain powered remittance platform that enables Money Transfer Operators (MTOs) and Individuals to send money quicker, cheaper and to more destinations than ever before.

The Bitspark API is designed for anyone to leverage Bitspark’s many payment destinations and methods - particularly in countries and areas traditionally under-served by existing payment channels and integrate easily into whatever product or service you intend to build with it.

General

URL

http://api.bitspark.io/v1

Authentication

Bitspark uses API keys to allow access to the API. You can generate your keys at our API page.

Bitspark expects for the Key and Sign to be included in all auth API requests to the server in a Headers that looks like the following:

Headers

REQUEST

GET /v1/call_example HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET -H "Key: YOUR_API_KEY" -H "Sign: COMPUTED_HMAC" -H "Cache-Control: no-cache"
    "http://api.bitspark.io/v1/call_example"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/call_example")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/call_example")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/call_example",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (fail)

{
  "errors": [
    {
      "code": 401,
      "error_code": "request_unauthorized",
      "message": [
        "Unauthorized"
      ]
    }
  ]
}
Key Value Description
Key YOUR_API_KEY Your personal API-KEY length of 40 hex characters.
Sign COMPUTED_HMAC Genarated with your API-SECRET HMAC-SHA512 Signature in Hex format.

Signature

You can use some programming language to generate HMAC signature:
( just click an appropriate language tab to see the code example )

# ----- URL encoding -----
require 'cgi'
require 'openssl'

class String
  def to_query(key)
    "#{CGI.escape(key.to_s)}=#{CGI.escape(to_s)}"
  end
end
class Hash
  def to_query(namespace = nil)
    collect do |key, value|
      unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty?
        value.to_query(namespace ? "#{namespace}[#{key}]" : key)
      end
    end.compact.sort! * '&'
  end
end

def calculate_hmac(api_secret, data)
  OpenSSL::HMAC.new(api_secret, OpenSSL::Digest::SHA512.new).update(data).to_s
end
# ----- URL encoding -----

api_secret = 'your_api_secret'
request_url = 'http://api.bitspark.io/v1/call_example?attribute=value1&attributes[attribute][email protected]'
encoded_form_data = ''

# ----- POST requests only -----
form_data = {
  attribute: 'value',
  attributes: {
    attribute: [email protected]'
  }
}

encoded_form_data = form_data.to_query # => "attribute=value&attributes%5Battribute%5D=v%40lue"
# ----- POST requests only  -----

calculate_hmac(api_secret, encoded_form_data + request_url)
# => "bb4882ac67b7815b4bf36b1fa99d95c95237db21353b95873fff008e76c2c204
#     95d746ae47cedf766d8cf6ee72eab25bac7972d3ebf397a84586e0fb0f371306"

# OR vice versa, both are correct
calculate_hmac(api_secret, request_url + encoded_form_data)
# => "64110ab16e3efed24e2f7bdd11c3682c477b09e9d38dcc7438d2ea15cc895134
#     4990ad5301748c60c64489ca463ad526d50aa75230846a3898554f8b8f4d98f1"
// required lib
// compile "info.guardianproject.netcipher:netcipher:1.2"

public String encrypt(String data) {
    String digest = null;
    try {
        String algo = "HmacSHA512";
        SecretKeySpec key = new SecretKeySpec(apiSecret.getBytes("UTF-8"), algo);
        Mac mac = Mac.getInstance(algo);
        mac.init(key);

        byte[] bytes = mac.doFinal(data.getBytes("ASCII"));

        StringBuilder hash = new StringBuilder();
        for (byte aByte : bytes) {
            String hex = Integer.toHexString(0xFF & aByte);
            if (hex.length() == 1) {
                hash.append('0');
            }
            hash.append(hex);
        }
        digest = hash.toString();
    } catch (UnsupportedEncodingException | InvalidKeyException | NoSuchAlgorithmException ignored) {
    }
    return digest;
}
var imported = document.createElement('script');
imported.src = 'http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha512.js';
document.head.appendChild(imported);

var computed_hmac = CryptoJS.HmacSHA512('encoded_form_data', 'your_api_secret').toString();
document.write(computed_hmac);

To generate COMPUTED_HMAC follow next steps:

http://api.bitspark.io/v1/call_example

http://api.bitspark.io/v1/call_example?attribute=value1&attributes[attribute][email protected]

Key Value Encoded key-value pairs
attribute value attribute=value
attributes[attribute] [email protected] attributes%5Battribute%5D=v%40lue

attribute=value&attributes%5Battribute%5D=v%40lue

attribute=value&attributes%5Battribute%5D=v%40luehttp://api.bitspark.io/v1/call_example?attribute=value1&attributes[attribute][email protected]

OR this:

http://api.bitspark.io/v1/call_example?attribute=value1&attributes[attribute][email protected]=value&attributes%5Battribute%5D=v%40lue

Pagination

REQUEST

GET /v1/call_example?pagination[offset]=1&pagination[limit]=20 HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/call_example?pagination[offset]=1&pagination[limit]=20"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/call_example?pagination%5Boffset%5D=1&pagination%5Blimit%5D=20")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/call_example?pagination%5Boffset%5D=1&pagination%5Blimit%5D=20")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/call_example?pagination%5Boffset%5D=1&pagination%5Blimit%5D=20",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "call_examples",
      "attributes": {
        "attribute": "string",
        "empty": null
      }
    },
    "..."
  ],
  "meta": {
    "total_count": 100,
    "total_pages": 5,
    "prev_page": null,
    "next_page": 2
  }
}

REQUEST PARAMS

Key Required Type Default Description
pagination[offset] true [integer] 1 Number of current page
pagination[limit] false [integer] 20 Number of records per pages

RESPONSE DETAILS

Key Type Description
total_count [integer] Total count of all records
total_pages [integer] Total count of pages
prev_page [integer] Number of previous page ( returns null if there is no previous page )
next_page [integer] Number of next page ( returns null if there is no next page )

Public

Money Shops

All Money Shops

REQUEST

GET /v1/money_shops?location[lat]=40.7143528&location[lng]=-74.0059731 HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/money_shops?location[lat]=40.7143528&location[lng]=-74.0059731"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/money_shops?location%5Blat%5D=40.7143528&location%5Blng%5D=-74.0059731")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/money_shops?location%5Blat%5D=40.7143528&location%5Blng%5D=-74.0059731")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/money_shops?location%5Blat%5D=40.7143528&location%5Blng%5D=-74.0059731",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "money_shops",
      "attributes": {
        "qr_code": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
        "name": "Company Name One",
        "address": "350 5th Ave, New York, NY 10118, USA",
        "lat": 40.7484401,
        "lng": -73.9856639,
        "image_url": "https://bitspark-upload-staging.s3.amazonaws.com/uploads/profile/image/ffffffff-ffff-ffff-ffff-ffffffffffff/image.jpg"
      }
    },
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "money_shops",
      "attributes": {
        "qr_code": "cccccccc-cccc-cccc-cccc-cccccccccccc",
        "name": "Company Name Two",
        "address": "183 Queen's Rd E, Wan Chai, Hong Kong",
        "lat": 22.2744158,
        "lng": 114.1711181,
        "image_url": null
      }
    },
    "..."
  ]
}

ENDPOINT

/money_shops

DESCRIPTION

This endpoint retrieves all money shops sorted by distance to your location. If location is not specified, it is sorted by distance to Hong Kong.

REQUEST PARAMS

Key Required Type Default Description
location[lat] false [decimal] 22.2799146 Latitude coordinate of your location
location[lng] false [decimal] 114.1715395 Longitude coordinate of your location

RESPONSE DETAILS

Key Type Description
qr_code [uuid] UUID for generating money shop QR Code image
name [string] Money shop company name
address [string] Money shop adress
lat [decimal] Latitude coordinate of money shop location
lng [decimal] Longitude coordinate of money shop location
image_url [string] URL to money shop image

Specific Money Shop

REQUEST

GET /v1/money_shops/ffffffff-ffff-ffff-ffff-ffffffffffff HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/money_shops/ffffffff-ffff-ffff-ffff-ffffffffffff"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/money_shops/ffffffff-ffff-ffff-ffff-ffffffffffff")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/money_shops/ffffffff-ffff-ffff-ffff-ffffffffffff")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/money_shops/ffffffff-ffff-ffff-ffff-ffffffffffff",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "money_shops",
    "attributes": {
      "qr_code": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "name": "Company Name One",
      "address": "350 5th Ave, New York, NY 10118, USA",
      "lat": 40.7484401,
      "lng": -73.9856639,
      "image_url": "https://bitspark-upload-staging.s3.amazonaws.com/uploads/profile/image/ffffffff-ffff-ffff-ffff-ffffffffffff/image_one.jpg",
      "topup_commissions": [
        {
          "currency": "HKD",
          "fee": "0.0"
        },
        {
          "currency": "USD",
          "fee": "1.1"
        },
        "..."
      ]
    }
  }
}

ENDPOINT

/money_shops/:money_shop_id_or_qrcode

DESCRIPTION

This endpoint retrieves a specific money shop.

RESPONSE DETAILS

Key Type Description
qr_code [uuid] UUID for generating money shop QR Code image
name [string] Money shop company name
address [string] Money shop adress
lat [decimal] Latitude coordinate of money shop location
lng [decimal] Longitude coordinate of money shop location
image_url [string] URL to money shop image
topup_commissions [array of hashes] Top up commissions of this shop for every available currencies
topup_commissions[][currency] [string] Commission currency code
topup_commissions[][fee] [decimal] Commision amount of money

Destinations

Available Destinations

REQUEST

GET /v1/static/destination_data?include=destination_info HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/static/destination_data?include=destination_info"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/static/destination_data?include=destination_info")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/static/destination_data?include=destination_info")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/static/destination_data?include=destination_info",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "destinations",
      "attributes": {
        "code": "destination_code",
        "name": "Destination Name",
        "currency_name": "PHP",
        "available": true,
        "fields": [
          "province",
          "provider",
          "validations",
          "delivery_method"
        ]
      },
      "relationships": {
        "destination_info": {
          "data": {
            "id": "destination_code",
            "type": "destination_infos"
          }
        }
      }
    },
    "..."
  ],
  "included": [
    {
      "id": "destination_code",
      "type": "destination_infos",
      "attributes": {
        "provinces": [
          {
            "name": "Province Name",
            "delivery_methods": [
              "delivery_method_code",
              "..."
            ],
            "code": "province_code"
          },
          "..."
        ],
        "delivery_methods": [
          {
            "name": "Delivery Method Name",
            "providers": [
              "provider_code_one",
              "..."
            ],
            "code": "delivery_method_code"
          },
          "..."
        ],
        "providers": [
          {
            "name": "Provider Name",
            "code": "provider_code"
          },
          "..."
        ]
      }
    },
    "..."
  ]
}

ENDPOINT

/static/destination_data

DESCRIPTION

This endpoint retrieves all available destinations with all info about it.

REQUEST PARAMS

Key Required Type Default Description
include false [string] none Set it to destination_info to include detailed destination data

RESPONSE DETAILS

Key Type Description
code [string] Destination name code
name [string] Destination name
currency_name [string] Destination currency name
available [boolean] Returns true if destination available, so always returns true
fields [array] List of required fields for validations
relationships[destination_info][provinces] [array of hashes] List of all available provinces with delivery_methods
relationships[destination_info][delivery_methods] [array of hashes] List of all available delivery_methods with providers
relationships[destination_info][providers] [array of hashes] List of all available providers
relationships[destination_info][account_types] [array of hashes] List of all available bank account types for this Destinaiton

Currencies

Available Currencies

REQUEST

GET /v1/static/currencies HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/static/currencies"
    -H "Cache-Control: no-cache"

require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/static/currencies")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/static/currencies")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/static/currencies",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "currencies",
      "attributes": {
        "code": "hkd",
        "name": "HKD",
        "account": true,
        "currency_type": "banknote",
        "banknote": true,
        "bitspark_deposit_credentials": {}
      }
    },
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "currencies",
      "attributes": {
        "code": "usd",
        "name": "USD",
        "account": true,
        "currency_type": "banknote",
        "banknote": true,
        "bitspark_deposit_credentials": {}
      }
    },
    "..."
  ]
}

ENDPOINT

/static/currencies

DESCRIPTION

This endpoint retrieves all available currencies.

RESPONSE DETAILS

Key Type Description
code [string] Currency name code
name [string] Currency name
account [boolean] Returns true if currency available, so always returns true
currency_type [string] Specifies currency type.Can be cryptocurrency or banknote.
banknote [boolean] Returns true if currency is of banknote type.
bitspark_deposit_credentials [hash] Returns Bitspark deposit credentials for this currency

Send Money Info

Validation Rules

REQUEST

GET /v1/static/validation_rules?filter[destination]=ffffffff-ffff-ffff-ffff-ffffffffffff&filter[province]=province_code&filter[delivery_method]=delivery_method_code&filter[provider]=provider_code HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/static/validation_rules?filter[destination]=ffffffff-ffff-ffff-ffff-ffffffffffff&filter[province]=province_code&filter[delivery_method]=delivery_method_code&filter[provider]=provider_code"
    -H "Cache-Control: no-cache"

require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/static/validation_rules?filter%5Bdestination%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&filter%5Bprovince%5D=province_code&filter%5Bdelivery_method%5D=delivery_method_code&filter%5Bprovider%5D=provider_code")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/static/validation_rules?filter%5Bdestination%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&filter%5Bprovince%5D=province_code&filter%5Bdelivery_method%5D=delivery_method_code&filter%5Bprovider%5D=provider_code")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/static/validation_rules?filter%5Bdestination%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&filter%5Bprovince%5D=province_code&filter%5Bdelivery_method%5D=delivery_method_code&filter%5Bprovider%5D=provider_code",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "1",
      "type": "fields_data",
      "attributes": {
        "object_type": "transfer",
        "level": "level_code",
        "code": "delivery_method_code_or_empty_string",
        "dependency_levels": [
          {
            "destinations": [
              "ffffffff-ffff-ffff-ffff-ffffffffffff"
            ]
          },
          {
            "delivery_methods": [
              "delivery_method_code"
            ]
          }
        ],
        "lower_levels": [
          "lower_level_code"
        ],
        "fields_info": {
          "validation_rules": [
            {
              "field": "field_name",
              "data": {
                "required": true,
                "decimal": true,
                "integer": true,
                "minvalue": 100
              }
            },
            {
              "field": "relation.field_name",
              "data": {
                "letters": true,
                "phone": true,
                "email": true
              }
            },
            "..."
          ],
          "possible_fields": [
            "field_name",
            "relation.field_name",
            "..."
          ],
          "required_fields": [
            "field_name",
            "..."
          ]
        }
      }
    },
    "..."
  ]
}

ENDPOINT

/static/validation_rules

DESCRIPTION

This endpoint retrieves validation rules for Send Money endpoint.

REQUEST PARAMS

Key Required Type Default Description
filter[destination] false [string] none Destination ID
filter[province] false [string] none Province code
filter[delivery_method] false [string] none Delivery method code
filter[provider] false [string] none Provider code

RESPONSE DETAILS

Key Type Description
object_type [string] Validation object type, "transfer" in this case
level [string] Validation level code ( can be one of: "destinations", "providers", "delivery_methods")
dependency_levels [array of hashes] Validation dependency levels ( can be an empty array [])
dependency_levels[][destinations] [array] List of destination IDs
dependency_levels[][delivery_methods] [array] List of delivery method codes
lower_levels [array of strings] Validation dependency levels ( can be one of: [], ["delivery_methods"], ["providers"])
fields_info [hash] Validation info for each Send Money form-data field
fields_info[possible_fields] [array of strings] Possible form-data fields for Send Money endpoint
fields_info[required_fields] [array of strings] Required form-data fields for Send Money endpoint
fields_info[validation_rules] [array of hashes] Validation rules for each Send Money form-data field
fields_info[validation_rules][field] [string] Field name, can be a field of ralation (with dot)
fields_info[validation_rules][data] [hash] Actual validation rules of form-data field, can be any subhash of next key-value pairs
fields_info[validation_rules][data][required] [boolean] Returns true if field is required
fields_info[validation_rules][data][decimal] [boolean] Returns true if field must be decimal format
fields_info[validation_rules][data][integer] [boolean] Returns true if field must be integer format
fields_info[validation_rules][data][minvalue] [integer] Returns minimum value for decimal or integer fields
fields_info[validation_rules][data][letters] [boolean] Returns true if field must be include only letters
fields_info[validation_rules][data][phone] [boolean] Returns true if field must be phone format
fields_info[validation_rules][data][email] [boolean] Returns true if field must be email format

Send Money Exchange Rate

REQUEST

GET /v1/static/send_money_exchange_rate?currency_from=usd&currency_to=php HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/static/send_money_exchange_rate?currency_from=usd&currency_to=php"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/static/send_money_exchange_rate?currency_from=usd&currency_to=php")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/static/send_money_exchange_rate?currency_from=usd&currency_to=php")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/static/send_money_exchange_rate?currency_from=usd&currency_to=php",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "99999999999999",
    "type": "send_money_exchange_rate",
    "attributes": {
      "rate": "11.11",
      "currency_from": "USD",
      "currency_to": "PHP"
    },
    "links": {
      "self": "http://api.bitspark.io/v1/static/send_money_exchange_rate?currency_from=usd&currency_to=php"
    }
  }
}

ENDPOINT

/static/send_money_exchange_rate

DESCRIPTION

This endpoint retrieves specific exchange rate for Send Money endpoint.

REQUEST PARAMS

Key Required Type Default Description
currency_from true [string] Currency to convert ( should be one of Available Currencies codes )
currency_to true [string] Currency to convert in ( should be one of: php, idr, vnd)

RESPONSE DETAILS

Key Type Description
rate [decimal] Actual exchange rate for Send Money endpoint.
currency_from [string] Currency in which will be sent money
currency_to [string] Currency in which will be received money

Amount to Pay

REQUEST

GET /v1/static/amount_to_pay?account_currency=usd&transfer[amount]=11.11&transfer[destination_id]=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer[delivery_method]=delivery_method_code&transfer[provider]=provider_code&transfer[province]=province_code HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/static/amount_to_pay?account_currency=usd&transfer[amount]=11.11&transfer[destination_id]=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer[delivery_method]=delivery_method_code&transfer[provider]=provider_code&transfer[province]=province_code"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/static/amount_to_pay?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/static/amount_to_pay?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/static/amount_to_pay?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "99999999999999",
    "type": "payment_data",
    "attributes": {
      "total_amount_to_pay": "0.99",
      "transaction_fee": "0.0"
    }
  }
}

ENDPOINT

/static/amount_to_pay

DESCRIPTION

This endpoint retrieves precalculated amount to pay for Send Money endpoint. Please check Authnticated section for similar endpoint with more information.

REQUEST PARAMS

Key Required Type Default Description
account_currency true [string] nope Account currency to calculate amount in ( should be one of Available Currencies codes )
transfer[amount] true [decimal] nope Amount of money to be payed ( should be greater then 0.0)
transfer[destination_id] true [uuid] nope Destination ID for send money to
transfer[delivery_method] true [string] nope Delivery method code
transfer[provider] true [string] nope Provider code
transfer[province] false [string] nope Province code

RESPONSE DETAILS

Key Type Description
total_amount_to_pay [decimal] Total amount to pay
transaction_fee [decimal] transaction fee

Exchange Money Info

Internal Exchange Rate

REQUEST

GET /v1/static/internal_exchange_rate?currency_from=usd&currency_to=btc HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/static/internal_exchange_rate?currency_from=usd&currency_to=btc"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/static/internal_exchange_rate?currency_from=usd&currency_to=btc")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/static/internal_exchange_rate?currency_from=usd&currency_to=btc")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/static/internal_exchange_rate?currency_from=usd&currency_to=btc",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "99999999999999",
    "type": "internal_exchange_rate",
    "attributes": {
      "rate": "0.0011",
      "currency_from": "USD",
      "currency_to": "BTC"
    },
    "links": {
      "self": "http://api.bitspark.io/api/v1/static/internal_exchange_rate?currency_from=usd&currency_to=btc"
    }
  }
}

ENDPOINT

/static/internal_exchange_rate

DESCRIPTION

This endpoint retrieves exchange rate for Exchange Money endpoint.

REQUEST PARAMS

Key Required Type Description
currency_from true [string] Currency to convert ( should be one of Available Currencies codes )
currency_to true [string] Currency to convert ( should be one of Available Currencies codes )

RESPONSE DETAILS

Key Type Description
rate [decimal] Actual exchange rate for Exchange Money endpoint.
currency_from [string] Currency from which will be exchanged money
currency_to [string] Currency to which will be exchanged money

Authenticated

Personal Info

Account

REQUEST

GET /v1/accounts/me?account_currency=usd&include=currency HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/accounts/me?account_currency=usd&include=currency"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/accounts/me?account_currency=usd&include=currency")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/accounts/me?account_currency=usd&include=currency")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/accounts/me?account_currency=usd&include=currency",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (success)

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "accounts",
    "attributes": {
      "balance": "0.0",
      "shop_commission": "0.0",
      "balance_threshold": "0.0"
    },
    "relationships": {
      "currency": {
        "data": {
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
          "type": "currencies"
        }
      }
    }
  },
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "currencies",
      "attributes": {
        "code": "usd",
        "name": "USD",
        "account": true
      }
    }
  ]
}

RESPONSE (fail)

{
  "errors": [
    {
      "code": 400,
      "error_code": "bad_request",
      "message": [
        "Invalid Account Currency"
      ]
    }
  ]
}

ENDPOINT

/accounts/me

DESCRIPTION

This endpoint retrieves info about one of your accounts.

REQUEST PARAMS

Key Required Type Default Description
account_currency true [string] none Currency of account you want to retrieve ( should be one of Available Currencies codes )
include false [string] none Set it to currency to include currency info

RESPONSE DETAILS

Key Type Description
balance [decimal] Account balance
shop_commission [decimal] Shop commission
balance_threshold [decimal] Balance threshold
relationships[currency][code] [string] Account currency name
relationships[currency][name] [string] Account currency code
relationships[currency][account] [boolean] Returns true if currency available

Profile

REQUEST

GET /v1/users/me?include=profile.identity_document,active_account.currency HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/users/me?include=profile.identity_document,active_account.currency"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/users/me?include=profile.identity_document%2Cactive_account.currency")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/users/me?include=profile.identity_document%2Cactive_account.currency")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/users/me?include=profile.identity_document%2Cactive_account.currency",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (success)

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "users",
    "attributes": {
      "login": "[email protected]"
    },
    "relationships": {
      "profile": {
        "data": {
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
          "type": "profiles"
        }
      },
      "active_account": {
        "data": {
          "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
          "type": "accounts"
        }
      }
    },
    "links": {
      "self": "http://api.bitspark.io/v1/users/me"
    }
  },
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "profiles",
      "attributes": {
        "first_name": "First",
        "middle_name": "mid",
        "last_name": "Last",
        "residence_country": "CHN",
        "contact_number": "+123456789012",
        "company_name": "Company One",
        "address": "350 5th Ave, New York, NY 10118, USA",
        "verified": false
      },
      "relationships": {
        "identity_document": {
          "data": {
            "id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
            "type": "identity_documents"
          }
        }
      }
    },
    {
      "id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
      "type": "identity_documents",
      "attributes": {
        "id_number": "123456789",
        "value": "id_card",
        "proof_url": "https://bitspark-upload-staging.s3.amazonaws.com/uploads/profile/proof/eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee/proof.jpg",
        "approved": false
      }
    },
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "accounts",
      "attributes": {
        "balance": "0.0",
        "shop_commission": "0.0",
        "balance_threshold": "0.0"
      },
      "relationships": {
        "currency": {
          "data": {
            "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
            "type": "currencies"
          }
        }
      }
    },
    {
      "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
      "type": "currencies",
      "attributes": {
        "code": "btc",
        "name": "BTC",
        "account": true
      }
    }
  ]
}

ENDPOINT

/users/me

DESCRIPTION

This endpoint retrieves info about your profile.

REQUEST PARAMS

Key Required Type Default Description
include false [string] none Can be any subset of: profile, profile.identity_document, active_account, active_account.currency

RESPONSE DETAILS

Key Type Description
login [string] Your login ( can be email or contact_number)
relationships[profile][first_name] [string] Your first name
relationships[profile][middle_name] [string] Your middle name
relationships[profile][last_name] [string] Your last name
relationships[profile][residence_country] [string] Your residence country ( should be one of ISO 3166-1 ALPHA-3 country codes )
relationships[profile][contact_number] [string] Your contact number
relationships[profile][company_name] [string] Your company name
relationships[profile][address] [string] Your address
relationships[profile][verified] [boolean] Returns true if your profile verified
relationships[identity_document][id_number] [string] Your ID number
relationships[identity_document][value] [string] Your ID type ( can be id_card or passport)
relationships[identity_document][proof_url] [string] URL to your ID proof
relationships[identity_document][approved] [boolean] Returns true if document approved by admin
relationships[active_account][balance] [decimal] Account balance
relationships[active_account][shop_commission] [decimal] Shop commission
relationships[active_account][balance_threshold] [decimal] Balance threshold
relationships[currency][code] [string] Account currency code
relationships[currency][name] [string] Account currency name
relationships[currency][account] [boolean] Returns true if currency available

Update Profile

REQUEST

POST /v1/users HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
profiles
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][first_name]"
First
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][middle_name]"
mid
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][last_name]"
Last
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][residence_country]"
CHN
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][contact_number]"
+8622444455555
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][company_name]"
Company One
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][currency_id]"
79d0c52e-4706-4622-96cc-2f308cd1faf4
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][address]"
350 5th Ave, New York, NY 10118, USA
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][identity_document][data][type]"
identity_documents
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][identity_document][data][attributes][id_number]"
123456789
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][identity_document][data][attributes][value]"
passport
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][identity_document][data][attributes][proof]"; filename=""
Content-Type:
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][user][data][type]"
users
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][user][data][attributes][current_password]"
12345678
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][user][data][attributes][password]"
12345678
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][user][data][attributes][password_confirmation]"
12345678
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v1/users"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "data[type]=profiles"
    -F "data[attributes][first_name]=First"
    -F "data[attributes][middle_name]=mid"
    -F "data[attributes][last_name]=Last"
    -F "data[attributes][residence_country]=CHN"
    -F "data[attributes][contact_number]=+8622444455555"
    -F "data[attributes][company_name]=Company One"
    -F "data[attributes][currency_id]=79d0c52e-4706-4622-96cc-2f308cd1faf4"
    -F "data[attributes][address]=350 5th Ave, New York, NY 10118, USA"
    -F "data[relationships][identity_document][data][type]=identity_documents"
    -F "data[relationships][identity_document][data][attributes][id_number]=123456789"
    -F "data[relationships][identity_document][data][attributes][value]=passport"
    -F "data[relationships][identity_document][data][attributes][proof]=@[object Object]"
    -F "data[relationships][user][data][type]=users"
    -F "data[relationships][user][data][attributes][current_password]=12345678"
    -F "data[relationships][user][data][attributes][password]=12345678"
    -F "data[relationships][user][data][attributes][password_confirmation]=12345678"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/users")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\nprofiles\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][first_name]\"\r\n\r\nFirst\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][middle_name]\"\r\n\r\nmid\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][last_name]\"\r\n\r\nLast\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][residence_country]\"\r\n\r\nCHN\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][contact_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][company_name]\"\r\n\r\nCompany One\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][currency_id]\"\r\n\r\n79d0c52e-4706-4622-96cc-2f308cd1faf4\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][address]\"\r\n\r\n350 5th Ave, New York, NY 10118, USA\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][type]\"\r\n\r\nidentity_documents\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][attributes][id_number]\"\r\n\r\n123456789\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][attributes][value]\"\r\n\r\npassport\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][attributes][proof]\"; filename=\"[object Object]\"\r\nContent-Type: false\r\n\r\n\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][type]\"\r\n\r\nusers\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][attributes][current_password]\"\r\n\r\n12345678\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][attributes][password]\"\r\n\r\n12345678\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][attributes][password_confirmation]\"\r\n\r\n12345678\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\nprofiles\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][first_name]\"\r\n\r\nFirst\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][middle_name]\"\r\n\r\nmid\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][last_name]\"\r\n\r\nLast\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][residence_country]\"\r\n\r\nCHN\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][contact_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][company_name]\"\r\n\r\nCompany One\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][currency_id]\"\r\n\r\n79d0c52e-4706-4622-96cc-2f308cd1faf4\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][address]\"\r\n\r\n350 5th Ave, New York, NY 10118, USA\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][type]\"\r\n\r\nidentity_documents\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][attributes][id_number]\"\r\n\r\n123456789\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][attributes][value]\"\r\n\r\npassport\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][identity_document][data][attributes][proof]\"; filename=\"[object Object]\"\r\nContent-Type: false\r\n\r\n\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][type]\"\r\n\r\nusers\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][attributes][current_password]\"\r\n\r\n12345678\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][attributes][password]\"\r\n\r\n12345678\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][user][data][attributes][password_confirmation]\"\r\n\r\n12345678\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/users")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("data[type]", "profiles");
form.append("data[attributes][first_name]", "First");
form.append("data[attributes][middle_name]", "mid");
form.append("data[attributes][last_name]", "Last");
form.append("data[attributes][residence_country]", "CHN");
form.append("data[attributes][contact_number]", "+8622444455555");
form.append("data[attributes][company_name]", "Company One");
form.append("data[attributes][currency_id]", "79d0c52e-4706-4622-96cc-2f308cd1faf4");
form.append("data[attributes][address]", "350 5th Ave, New York, NY 10118, USA");
form.append("data[relationships][identity_document][data][type]", "identity_documents");
form.append("data[relationships][identity_document][data][attributes][id_number]", "123456789");
form.append("data[relationships][identity_document][data][attributes][value]", "passport");
form.append("data[relationships][identity_document][data][attributes][proof]", {"0":{}});
form.append("data[relationships][user][data][type]", "users");
form.append("data[relationships][user][data][attributes][current_password]", "12345678");
form.append("data[relationships][user][data][attributes][password]", "12345678");
form.append("data[relationships][user][data][attributes][password_confirmation]", "12345678");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/users",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE is the same as for Profile with all included data

ENDPOINT

/users

DESCRIPTION

With this endpoint you can update your profile info.

FORM DATA

Key Required Type Description
data[type] true [string] Profile’s type ( must be profiles)
data[attributes][first_name] false [string] Your first name
data[attributes][middle_name] false [string] Your middle name
data[attributes][last_name] false [string] Your last name
data[attributes][residence_country] false [string] Your residence country ( should be one of ISO 3166-1 ALPHA-3 country codes )
data[attributes][contact_number] false [string] Your contact number
data[attributes][company_name] false [string] Your company name
data[attributes][currency_id] false [string] Account currency ID ( should be one of Available Currencies ID’s )
data[attributes][address] false [string] Your address
data[relationships][identity_document][data][type] true [string] Identity Document’s type ( must be identity_documents)
data[relationships][identity_document][data][attributes][id_number] false [string] Your ID number
data[relationships][identity_document][data][attributes][value] false [string] Your ID type ( should be one of: id_card, passport)
data[relationships][identity_document][data][attributes][proof] false [file] Your ID proof ( file should be one of next types: jpg, jpeg, gif, png, bmp, pdf)
data[relationships][user][data][type] true [string] User’s type ( must be users)
data[relationships][user][data][attributes][current_password] false [string] Your current password
data[relationships][user][data][attributes][password] false [string] New password
data[relationships][user][data][attributes][password_confirmation] false [string] New password confirmation

RESPONSE DETAILS

Detailed amount to pay

Amount to Pay V2

REQUEST

GET /v2/static/amount_to_pay?account_currency=usd&transfer[amount]=11.11&transfer[destination_id]=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer[delivery_method]=delivery_method_code&transfer[provider]=provider_code&transfer[province]=province_code HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v2/static/amount_to_pay?account_currency=usd&transfer[amount]=11.11&transfer[destination_id]=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer[delivery_method]=delivery_method_code&transfer[provider]=provider_code&transfer[province]=province_code"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v2/static/amount_to_pay?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v2/static/amount_to_pay?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v2/static/amount_to_pay?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "99999999999999",
    "type": "payment_data",
    "attributes": {
      "total_amount_to_pay": "0.99",
      "transaction_fee": "0.0"
    }
  }
}

ENDPOINT

/static/amount_to_pay

DESCRIPTION

This endpoint retrieves precalculated amount to pay for Send Money endpoint.

REQUEST PARAMS

Key Required Type Default Description
account_currency true [string] nope Account currency to calculate amount in ( should be one of Available Currencies codes )
transfer[amount] true [decimal] nope Amount of money to be payed ( should be greater then 0.0)
transfer[amount_to_send] true [decimal] nope Amount of money that user wants to transact in user currency
transfer[destination_id] true [uuid] nope Destination ID for send money to
transfer[delivery_method] true [string] nope Delivery method code
transfer[provider] true [string] nope Provider code
transfer[province] false [string] nope Province code

RESPONSE DETAILS

Key Type Description
total_amount_to_pay_in_user_currency [decimal] Total amount to pay as is in user currency
total_amount_to_pay_in_destination_currency [decimal] Total amount to pay as is in destination currency
transaction_fee_in_user_currency [decimal] Transaction fee as is in user currency
transaction_fee_in_destination_currency [decimal] Transaction fee as is in destination currency

Amount to Pay V3

REQUEST

GET /v3/calculations/amount_to_pay/calculate?account_currency=usd&transfer[amount]=11.11&transfer[destination_id]=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer[delivery_method]=delivery_method_code&transfer[provider]=provider_code&transfer[province]=province_code HTTP/1.1
Host: api.bitspark.io
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v3/calculations/amount_to_pay/calculate?account_currency=usd&transfer[amount]=11.11&transfer[destination_id]=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer[delivery_method]=delivery_method_code&transfer[provider]=provider_code&transfer[province]=province_code"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v3/calculations/amount_to_pay/calculate?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v3/calculations/amount_to_pay/calculate?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v3/calculations/amount_to_pay/calculate?account_currency=usd&transfer%5Bamount%5D=11.11&transfer%5Bdestination_id%5D=ffffffff-ffff-ffff-ffff-ffffffffffff&transfer%5Bdelivery_method%5D=delivery_method_code&transfer%5Bprovider%5D=provider_code&transfer%5Bprovince%5D=province_code",
  "method": "GET",
  "headers": {
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "99999999999999",
    "type": "payment_data",
    "attributes": {
      "total_amount_to_pay": "0.99",
      "transaction_fee": "0.0"
    }
  }
}

ENDPOINT

/calculations/amount_to_pay/calculate

DESCRIPTION

This endpoint retrieves precalculated amount to pay for Send Money endpoint.

REQUEST PARAMS

Key Required Type Default Description
account_currency true [string] nope Account currency to calculate amount in ( should be one of Available Currencies codes )
transfer[amount] true [decimal] nope Amount of money to be payed ( should be greater then 0.0)
transfer[amount_to_send] true [decimal] nope Amount of money that user wants to transact in user currency
transfer[destination_id] true [uuid] nope Destination ID for send money to
transfer[delivery_method] true [string] nope Delivery method code
transfer[provider] true [string] nope Provider code
transfer[province] false [string] nope Province code

RESPONSE DETAILS

Key Type Description
total_amount_to_pay_in_user_currency [decimal] Total amount to pay as is in user currency
total_amount_to_pay_in_destination_currency [decimal] Total amount to pay as is in destination currency
transaction_fee_in_user_currency [decimal] Transaction fee as is in user currency
transaction_fee_in_destination_currency [decimal] Transaction fee as is in destination currency
payment_service_fee_in_destination_currency [decimal] Transaction cable fee as is in destination currency
payment_service_fee_in_user_currency [decimal] Transaction cable fee as is in destination currency
destination_amount [decimal] Amount to be sent to destination point

Recipients

All Recipients

REQUEST

GET /v1/recipients HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/recipients"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/recipients")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/recipients")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/recipients",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "recipients",
      "attributes": {
        "first_name": "First",
        "middle_name": "mid",
        "last_name": "Last",
        "email": "[email protected]",
        "phone_number": "+123456789012",
        "alt_phone_number": null,
        "address": "350 5th Ave, New York, NY 10118, USA",
        "bank_branch": "Bank Branch Name",
        "beneficiary_name": "Beneficiary Name",
        "bank_account_number": "111111111111"
      }
    },
    "..."
  ]
}

ENDPOINT

/recipients

DESCRIPTION

This endpoint retrieves all your send money recipients.

RESPONSE DETAILS

Key Type Description
first_name [string] Recipient’s first name
middle_name [string] Recipient’s middle name
last_name [string] Recipient’s last name
email [string] Recipient’s email
phone_number [string] Recipient’s valid phone number
alt_phone_number [string] Recipient’s alternative phone number
address [string] Recipient’s adsress
bank_branch [string] Recipient’s bank branch
beneficiary_name [string] Recipient’s beneficiary
bank_account_number [string] Recipient’s bank account number

Show Recipient

REQUEST

GET /v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff")
  .get()
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "user_recipients",
    "attributes": {
      "first_name": "First",
      "middle_name": "mid",
      "last_name": "Last",
      "email": "[email protected]",
      "phone_number": "+8611444455555",
      "alt_phone_number": "+8622444455555",
      "address": "350 5th Ave, New York, NY 10118, USA",
      "bank_branch": "Bank Branch name",
      "beneficiary_name": "Beneficiary Name",
      "bank_account_number": "111111111111"
    }
  }
}

ENDPOINT

/recipients/:recipient_id

DESCRIPTION

This endpoint retrieves a specific recipient.

RESPONSE DETAILS

Create Recipient

REQUEST

POST /v1/recipients HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
user_recipients
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][first_name]"
First
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][middle_name]"
mid
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][last_name]"
Last
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][email]"
[email protected]
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][phone_number]"
+8611444455555
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][alt_phone_number]"
+8622444455555
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][address]"
350 5th Ave, New York, NY 10118, USA
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][bank_branch]"
Bank Branch name
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][beneficiary_name]"
Beneficiary Name
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][bank_account_number]"
111111111111
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v1/recipients"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "data[type]=user_recipients"
    -F "data[attributes][first_name]=First"
    -F "data[attributes][middle_name]=mid"
    -F "data[attributes][last_name]=Last"
    -F "data[attributes][email][email protected]"
    -F "data[attributes][phone_number]=+8611444455555"
    -F "data[attributes][alt_phone_number]=+8622444455555"
    -F "data[attributes][address]=350 5th Ave, New York, NY 10118, USA"
    -F "data[attributes][bank_branch]=Bank Branch name"
    -F "data[attributes][beneficiary_name]=Beneficiary Name"
    -F "data[attributes][bank_account_number]=111111111111"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/recipients")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][first_name]\"\r\n\r\nFirst\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][middle_name]\"\r\n\r\nmid\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][last_name]\"\r\n\r\nLast\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][email]\"\r\n\r\n[email protected]\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][phone_number]\"\r\n\r\n+8611444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][alt_phone_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][address]\"\r\n\r\n350 5th Ave, New York, NY 10118, USA\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_branch]\"\r\n\r\nBank Branch name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][beneficiary_name]\"\r\n\r\nBeneficiary Name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_account_number]\"\r\n\r\n111111111111\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][first_name]\"\r\n\r\nFirst\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][middle_name]\"\r\n\r\nmid\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][last_name]\"\r\n\r\nLast\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][email]\"\r\n\r\[email protected]\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][phone_number]\"\r\n\r\n+8611444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][alt_phone_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][address]\"\r\n\r\n350 5th Ave, New York, NY 10118, USA\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_branch]\"\r\n\r\nBank Branch name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][beneficiary_name]\"\r\n\r\nBeneficiary Name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_account_number]\"\r\n\r\n111111111111\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/recipients")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("data[attributes][first_name]", "First");
form.append("data[attributes][middle_name]", "mid");
form.append("data[attributes][last_name]", "Last");
form.append("data[attributes][email]", "[email protected]");
form.append("data[attributes][phone_number]", "+8611444455555");
form.append("data[attributes][alt_phone_number]", "+8622444455555");
form.append("data[attributes][address]", "350 5th Ave, New York, NY 10118, USA");
form.append("data[attributes][bank_branch]", "Bank Branch name");
form.append("data[attributes][beneficiary_name]", "Beneficiary Name");
form.append("data[attributes][bank_account_number]", "111111111111");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/recipients",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "user_recipients",
    "attributes": {
      "first_name": "First",
      "middle_name": "mid",
      "last_name": "Last",
      "email": "[email protected]",
      "phone_number": "+8611444455555",
      "alt_phone_number": "+8622444455555",
      "address": "350 5th Ave, New York, NY 10118, USA",
      "bank_branch": "Bank Branch name",
      "beneficiary_name": "Beneficiary Name",
      "bank_account_number": "111111111111"
    }
  }
}

ENDPOINT

/recipients

DESCRIPTION

This endpoint creates new recipient.

FORM DATA

Key Required Type Description
data[type] true [string] Recipient’s type ( must be user_recipients)
data[attributes][first_name] true [string] Recipient’s first name
data[attributes][middle_name] false [string] Recipient’s middle name
data[attributes][last_name] true [string] Recipient’s last name
data[attributes][email] false [string] Recipient’s email
data[attributes][phone_number] false [string] Recipient’s valid phone number
data[attributes][alt_phone_number] false [string] Recipient’s alternative phone number
data[attributes][address] false [string] Recipient’s adsress
data[attributes][bank_branch] true (only for bank transfers) [string] Recipient’s bank branch
data[attributes][beneficiary_name] true (only for bank transfers) [string] Recipient’s beneficiary
data[attributes][bank_account_number] true (only for bank transfers) [string] Recipient’s bank account number

RESPONSE DETAILS

Update Recipient

REQUEST

PUT /v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
user_recipients
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][first_name]"
First One1
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][middle_name]"
mid mAn
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][last_name]"
Last another
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][email]"
[email protected]
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][phone_number]"
+8611444455555
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][alt_phone_number]"
+8622444455555
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][address]"
350 5th Ave, New York, NY 10118, USA
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][bank_branch]"
Bank Branch name
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][beneficiary_name]"
Beneficiary Name
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][bank_account_number]"
111111111111
------WebKitFormBoundary7MA4YWxkTrZu0gW--
curl -X PUT "http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "data[type]=user_recipients"
    -F "data[attributes][first_name]=First One1"
    -F "data[attributes][middle_name]=mid mAn"
    -F "data[attributes][last_name]=Last another"
    -F "data[attributes][email][email protected]"
    -F "data[attributes][phone_number]=+8611444455555"
    -F "data[attributes][alt_phone_number]=+8622444455555"
    -F "data[attributes][address]=350 5th Ave, New York, NY 10118, USA"
    -F "data[attributes][bank_branch]=Bank Branch name"
    -F "data[attributes][beneficiary_name]=Beneficiary Name"
    -F "data[attributes][bank_account_number]=111111111111"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Put.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][first_name]\"\r\n\r\nFirst One1\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][middle_name]\"\r\n\r\nmid mAn\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][last_name]\"\r\n\r\nLast another\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][email]\"\r\n\r\n[email protected]\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][phone_number]\"\r\n\r\n+8611444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][alt_phone_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][address]\"\r\n\r\n350 5th Ave, New York, NY 10118, USA\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_branch]\"\r\n\r\nBank Branch name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][beneficiary_name]\"\r\n\r\nBeneficiary Name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_account_number]\"\r\n\r\n111111111111\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][first_name]\"\r\n\r\nFirst One1\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][middle_name]\"\r\n\r\nmid mAn\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][last_name]\"\r\n\r\nLast another\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][email]\"\r\n\r\[email protected]\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][phone_number]\"\r\n\r\n+8611444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][alt_phone_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][address]\"\r\n\r\n350 5th Ave, New York, NY 10118, USA\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_branch]\"\r\n\r\nBank Branch name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][beneficiary_name]\"\r\n\r\nBeneficiary Name\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bank_account_number]\"\r\n\r\n111111111111\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff")
  .put(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("data[attributes][first_name]", "First One1");
form.append("data[attributes][middle_name]", "mid mAn");
form.append("data[attributes][last_name]", "Last another");
form.append("data[attributes][email]", "[email protected]");
form.append("data[attributes][phone_number]", "+8611444455555");
form.append("data[attributes][alt_phone_number]", "+8622444455555");
form.append("data[attributes][address]", "350 5th Ave, New York, NY 10118, USA");
form.append("data[attributes][bank_branch]", "Bank Branch name");
form.append("data[attributes][beneficiary_name]", "Beneficiary Name");
form.append("data[attributes][bank_account_number]", "111111111111");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff",
  "method": "PUT",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "user_recipients",
    "attributes": {
      "first_name": "First One1",
      "middle_name": "mid mAn",
      "last_name": "Last another",
      "email": "[email protected]",
      "phone_number": "+8611444455555",
      "alt_phone_number": "+8622444455555",
      "address": "350 5th Ave, New York, NY 10118, USA",
      "bank_branch": "Bank Branch name",
      "beneficiary_name": "Beneficiary Name",
      "bank_account_number": "111111111111"
    }
  }
}

ENDPOINT

/recipients/:recipient_id

DESCRIPTION

With this endpoint you can update specific recipient info.

FORM DATA

RESPONSE DETAILS

Delete Recipient

REQUEST

DELETE /v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X DELETE "http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Delete.new(url)
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff")
  .delete(null)
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/recipients/ffffffff-ffff-ffff-ffff-ffffffffffff",
  "method": "DELETE",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

ENDPOINT

/recipients/:recipient_id

DESCRIPTION

With this endpoint you can delete specific recipient.

RESPONSE DETAILS

Transactions

Transfers History

REQUEST

GET /v1/transactions/remittances?include=transfer_recipient HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/transactions/remittances?include=transfer_recipient"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/transactions/remittances?include=transfer_recipient")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/transactions/remittances?include=transfer_recipient")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/transactions/remittances?include=transfer_recipient",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "transfers",
      "attributes": {
        "status": {
          "code": "unknown",
          "message": "Unknown"
        },
        "amount": "11.11",
        "currency": "VND",
        "exchange_rate": "22222.22222",
        "destination_country": "Vietnam",
        "tracking_number": null,
        "tracking_number_possible": false
      },
      "relationships": {
        "transfer_recipient": {
          "data": {
            "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
            "type": "transfer_recipients"
          }
        }
      }
    },
    "..."
  ],
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "transfer_recipients",
      "attributes": {
        "first_name": "First",
        "middle_name": null,
        "last_name": "Last",
        "email": "[email protected]",
        "phone_number": "+8611444455555",
        "alt_phone_number": null,
        "address": "350 5th Ave, New York, NY 10118, USA",
        "bank_branch": "Bank Branch name",
        "beneficiary_name": "Beneficiary Name",
        "bank_account_number": "111111111111"
      }
    },
    "..."
  ]
}

ENDPOINT

/transactions/remittances

DESCRIPTION

This endpoint retrieves all created transfers with details.

REQUEST PARAMS

Key Required Type Default Description
include false [string] none Set it to transfer_recipient to include all transfers’ recipients

RESPONSE DETAILS

Key Type Description
status[code] [string] Transfer status code
status[message] [string] Transfer status message
amount [decimal] Sent amount of money
currency [string] Destination currency
exchange_rate [decimal] Send money exchange rate
destination_country [string] Destination country
tracking_number [string] Transfer tracking number
tracking_number_possible [string] Returns true if tracking_number will be present
relationships[transfer_recipient] [hash] See All Recipients for response details.

Transactions History

REQUEST

GET /v1/transactions/history HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/transactions/history"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/transactions/history")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/transactions/history")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/transactions/history",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "mobile_payments",
      "attributes": {
        "account_id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "amount": "17.0",
        "status": {
          "code": "pending",
          "message": "Pending"
        },
        "payment_type": "Withdraw",
        "currency": "USD",
        "basic_info": "9120237",
        "created_at": "2016-12-20T15:42:21.048Z"
      }
    },
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "mobile_payments",
      "attributes": {
        "account_id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "amount": "11.0",
        "status": {
          "code": "unknown",
          "message": "Unknown"
        },
        "payment_type": "BankDeposit",
        "currency": "USD",
        "basic_info": "CHKWM9EP",
        "created_at": "2016-12-20T15:42:02.831Z"
      }
    },
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "mobile_payments",
      "attributes": {
        "account_id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "amount": "10000000000003.0",
        "status": {
          "group": "pending",
          "code": "unknown",
          "message": "Unknown",
          "info": ""
        },
        "payment_type": "Transfer",
        "currency": "VND",
        "basic_info": {
          "recipient_name": "Test Test Test",
          "recipient_contact_number": "+12025550145",
          "address": null
        },
        "created_at": "2016-11-22T13:23:38.171Z"
      }
    },
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "mobile_payments",
      "attributes": {
        "account_id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
        "amount": "1.0",
        "status": {
          "code": "approved",
          "message": "Approved"
        },
        "payment_type": "TopUp",
        "currency": "HKD",
        "basic_info": "Adress info here.",
        "created_at": "2016-11-14T15:55:14.150Z"
      }
    }
  ]
}

ENDPOINT

/transactions/history

DESCRIPTION

This endpoint retrieves all created transactions with details.

TRANSACTION GENERAL RESPONSE DETAILS

Key Type Description
status[code] [string] Transaction status code
status[message] [string] Transaction status message
account_id [uuid] Account id with which transaction where committed
amount [decimal] Sent amount of money
currency [string] Destination currency
payment_type [string] Transaction type

DEPOSIT SPECIFIC DETAILS

Key Type Description
basic_info [string] Deposit Txid or btc address

WITHDRAW SPECIFIC DETAILS

Key Type Description
basic_info [string] Withdraw Txid

TOPUP SPECIFIC DETAILS

Key Type Description
basic_info [string] Recipient address

TRANSFER SPECIFIC DETAILS

Key Type Description
status[group] [string] Transfer status group
status[info] [string] Transfer status short info
exchange_rate [decimal] Send money exchange rate
destination_country [string] Destination country
tracking_number [string] Transfer tracking number
tracking_number_possible [string] Returns true if tracking_number will be present
basic_info[recipient_name] [string] Recipient full name
basic_info[recipient_contact_number] [string] Recipient contact number
basic_info[address] [string] Recipient address

Show Remmitance

REQUEST

GET /v1/transactions/remittances/ffffffff-ffff-ffff-ffff-ffffffffffff HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/transactions/remittances/ffffffff-ffff-ffff-ffff-ffffffffffff"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/transactions/remittances/ffffffff-ffff-ffff-ffff-ffffffffffff")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/transactions/remittances/ffffffff-ffff-ffff-ffff-ffffffffffff")
  .get()
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/transactions/remittances/ffffffff-ffff-ffff-ffff-ffffffffffff",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "transfers",
    "attributes": {
      "status": {
        "group": "pending",
        "code": "payment_commited_successfully",
        "message": "Payment commited",
        "info": ""
      },
      "amount": "11.11",
      "currency": "VND",
      "exchange_rate": "22222.22222",
      "destination_country": "Vietnam",
      "tracking_number": null,
      "tracking_number_possible": false,
      "created_at": "2016-09-24T22:10:38.992Z",
      "updated_at": "2016-09-24T23:15:33.853Z"
    },
    "relationships": {
      "transfer_recipient": {
        "data": {
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
          "type": "transfer_recipients"
        }
      }
    }
  }
}

ENDPOINT

/transactions/remittances/:remittance_id

DESCRIPTION

This endpoint retrieves a specific remittance.

REQUEST PARAMS

Key Required Type Default Description
include false [string] none Set it to transfer_recipient to include all transfers’ recipients

RESPONSE DETAILS

Send Money

REQUEST

POST /v1/transactions/send_money HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="account_currency"
usd
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
transfers
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][amount]"
100.0
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][delivery_method]"
delivery_method_code
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][province]"
province_code
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][provider]"
provider_code
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][destination][data][type]"
destinations
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][destination][data][attributes][code]"
philippines
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][sender][data][type]"
senders
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][sender][data][attributes][first_name]"
Teodor
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][sender][data][attributes][last_name]"
Rusvelt
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][sender][data][attributes][id_number]"
123123
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][sender][data][attributes][phone_number]"
+8611444455555
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][recipient][data][type]"
recipients
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][recipient][data][attributes][first_name]"
Antonio
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][recipient][data][attributes][last_name]"
Margaretti
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][recipient][data][attributes][phone_number]"
+8622444455555
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][recipient][data][attributes][address]"
address
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v1/transactions/send_money"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "account_currency=usd"
    -F "data[type]=transfers"
    -F "data[attributes][amount]=100.0"
    -F "data[attributes][delivery_method]=delivery_method_code"
    -F "data[attributes][province]=province_code"
    -F "data[attributes][provider]=provider_code"
    -F "data[relationships][destination][data][type]=destinations"
    -F "data[relationships][destination][data][attributes][code]=philippines"
    -F "data[relationships][sender][data][type]=senders"
    -F "data[relationships][sender][data][attributes][first_name]=Teodor"
    -F "data[relationships][sender][data][attributes][last_name]=Rusvelt"
    -F "data[relationships][sender][data][attributes][id_number]=123123"
    -F "data[relationships][sender][data][attributes][phone_number]=+8611444455555"
    -F "data[relationships][recipient][data][type]=recipients"
    -F "data[relationships][recipient][data][attributes][first_name]=Antonio"
    -F "data[relationships][recipient][data][attributes][last_name]=Margaretti"
    -F "data[relationships][recipient][data][attributes][phone_number]=+8622444455555"
    -F "data[relationships][recipient][data][attributes][address]=address"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/transactions/send_money")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ntransfers\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][delivery_method]\"\r\n\r\ndelivery_method_code\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][province]\"\r\n\r\nprovince_code\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][provider]\"\r\n\r\nprovider_code\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][destination][data][type]\"\r\n\r\ndestinations\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][destination][data][attributes][code]\"\r\n\r\nphilippines\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][type]\"\r\n\r\nsenders\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][first_name]\"\r\n\r\nTeodor\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][last_name]\"\r\n\r\nRusvelt\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][id_number]\"\r\n\r\n123123\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][phone_number]\"\r\n\r\n+8611444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][type]\"\r\n\r\nrecipients\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][first_name]\"\r\n\r\nAntonio\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][last_name]\"\r\n\r\nMargaretti\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][phone_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][address]\"\r\n\r\naddress\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ntransfers\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][delivery_method]\"\r\n\r\ndelivery_method_code\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][province]\"\r\n\r\nprovince_code\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][provider]\"\r\n\r\nprovider_code\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][destination][data][type]\"\r\n\r\ndestinations\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][destination][data][attributes][code]\"\r\n\r\nphilippines\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][type]\"\r\n\r\nsenders\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][first_name]\"\r\n\r\nTeodor\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][last_name]\"\r\n\r\nRusvelt\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][id_number]\"\r\n\r\n123123\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][sender][data][attributes][phone_number]\"\r\n\r\n+8611444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][type]\"\r\n\r\nrecipients\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][first_name]\"\r\n\r\nAntonio\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][last_name]\"\r\n\r\nMargaretti\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][phone_number]\"\r\n\r\n+8622444455555\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][recipient][data][attributes][address]\"\r\n\r\naddress\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/transactions/send_money")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("account_currency", "usd");
form.append("data[type]", "transfers");
form.append("data[attributes][amount]", "100.0");
form.append("data[attributes][delivery_method]", "delivery_method_code");
form.append("data[attributes][province]", "province_code");
form.append("data[attributes][provider]", "provider_code");
form.append("data[relationships][destination][data][type]", "destinations");
form.append("data[relationships][destination][data][attributes][code]", "philippines");
form.append("data[relationships][sender][data][type]", "senders");
form.append("data[relationships][sender][data][attributes][first_name]", "Teodor");
form.append("data[relationships][sender][data][attributes][last_name]", "Rusvelt");
form.append("data[relationships][sender][data][attributes][id_number]", "123123");
form.append("data[relationships][sender][data][attributes][phone_number]", "+8611444455555");
form.append("data[relationships][recipient][data][type]", "recipients");
form.append("data[relationships][recipient][data][attributes][first_name]", "Antonio");
form.append("data[relationships][recipient][data][attributes][last_name]", "Margaretti");
form.append("data[relationships][recipient][data][attributes][phone_number]", "+8622444455555");
form.append("data[relationships][recipient][data][attributes][address]", "address");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/transactions/send_money",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "transfers",
    "attributes": {
      "status": {
        "code": "unknown",
        "message": "Unknown"
      },
      "amount": "100.0",
      "currency": "PHP",
      "exchange_rate": "44.44",
      "destination_country": "Philippines",
      "tracking_number": null,
      "tracking_number_possible": false
    },
    "relationships": {
      "transfer_recipient": {
        "data": {
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
          "type": "transfer_recipients"
        }
      }
    }
  },
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "transfer_recipients",
      "attributes": {
        "first_name": "Antonio",
        "middle_name": null,
        "last_name": "Margaretti",
        "email": null,
        "phone_number": "+380961046401",
        "alt_phone_number": null,
        "address": "address",
        "bank_branch": null,
        "beneficiary_name": null,
        "bank_account_number": null
      }
    }
  ]
}

ENDPOINT

/transactions/send_money

DESCRIPTION

This endpoint creates new transfer. You can preview current exchange rate with Send Money Exchange Rate endpoint.

FORM DATA

Key Required Type Description
account_currency false [string] Account currency for send money from ( should be one of Available Currencies codes )
data[type] true [string] Transfer’s type ( must be transfers)
data[attributes][amount] true [decimal] Amount of Destination currency to be sent ( should be greater then 0.0)
data[attributes][delivery_method] true [string] Delivery method code
data[attributes][provider] true [string] Provider code
data[attributes][province] false [string] Province code
data[relationships][destination][data][type] true [string] Destination’s type ( must be destinations)
data[relationships][destination][data][attributes][id] true [uuid] Destination ID for send money to
data[relationships][destination][data][attributes][code] true [string] Destination code for send money to ( not required if ID specified )
data[relationships][recipient][data][type] true [string] Recipient’s type ( must be recipients)
data[relationships][recipient][data][attributes] true [hash] See Create Recipient for Recipient’s FORM DATA details.
data[relationships][sender][data][type] true [string] Sender’s type ( must be senders)
data[relationships][sender][data][attributes][first_name] true [string] Sender’s first name
data[relationships][sender][data][attributes][middle_name] false [string] Sender’s middle name
data[relationships][sender][data][attributes][last_name] true [string] Sender’s last name
data[relationships][sender][data][attributes][id_number] true [string] Sender’s ID number
data[relationships][sender][data][attributes][phone_number] true [string] Sender’s phone number
data[relationships][sender][data][attributes][alt_phone_number] false [string] Sender’s alternative phone number

RESPONSE DETAILS

Payments

Withdraw

REQUEST (USD account)

POST /v2/payments/withdraw HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_SIGN
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="account_currency"
usd
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
withdraw
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][amount]"
100.0
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][txid]"
12335352
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][bank_detail][data][type]"
bank_details
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][bank_detail][data][attributes][name]"
HSBC
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][bank_detail][data][attributes][beneficiary_name]"
Eve Moneypenny
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][bank_detail][data][attributes][account_number]"
123123123
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][bank_detail][data][attributes][swift_code]"
1234321
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[relationships][bank_detail][data][attributes][address]"
85 Albert Embankment, Vauxhall, London
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v2/payments/withdraw"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_SIGN"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "account_currency=usd"
    -F "data[type]=withdraws"
    -F "data[attributes][amount]=100.0"
    -F "data[attributes][txid]=12335352"
    -F "data[relationships][bank_detail][data][type]=bank_details"
    -F "data[relationships][bank_detail][data][attributes][name]=HSBC"
    -F "data[relationships][bank_detail][data][attributes][beneficiary_name]=Eve Moneypenny"
    -F "data[relationships][bank_detail][data][attributes][account_number]=123123123"
    -F "data[relationships][bank_detail][data][attributes][swift_code]=1234321"
    -F "data[relationships][bank_detail][data][attributes][address]=85 Albert Embankment, Vauxhall, London"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v2/payments/withdraw")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_SIGN'
request["cache-control"] = 'no-cache'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\nwithdraws\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][txid]\"\r\n\r\n12335352\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][type]\"\r\n\r\nbank_details\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][name]\"\r\n\r\nHSBC\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][beneficiary_name]\"\r\n\r\nEve Moneypenny\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][account_number]\"\r\n\r\n123123123\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][swift_code]\"\r\n\r\n1234321\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][address]\"\r\n\r\n85 Albert Embankment, Vauxhall, London\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\nwithdraws\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][txid]\"\r\n\r\n12335352\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][type]\"\r\n\r\nbank_details\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][name]\"\r\n\r\nHSBC\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][beneficiary_name]\"\r\n\r\nEve Moneypenny\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][account_number]\"\r\n\r\n123123123\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][swift_code]\"\r\n\r\n1234321\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[relationships][bank_detail][data][attributes][address]\"\r\n\r\n85 Albert Embankment, Vauxhall, London\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v2/payments/withdraw")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_SIGN")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("account_currency", "usd");
form.append("data[type]", "withdraws");
form.append("data[attributes][amount]", "100.0");
form.append("data[attributes][txid]", "12335352");
form.append("data[relationships][bank_detail][data][type]", "bank_details");
form.append("data[relationships][bank_detail][data][attributes][name]", "HSBC");
form.append("data[relationships][bank_detail][data][attributes][beneficiary_name]", "Eve Moneypenny");
form.append("data[relationships][bank_detail][data][attributes][account_number]", "123123123");
form.append("data[relationships][bank_detail][data][attributes][swift_code]", "1234321");
form.append("data[relationships][bank_detail][data][attributes][address]", "85 Albert Embankment, Vauxhall, London");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v2/payments/withdraw",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_SIGN",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (USD account)

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "withdraws",
    "attributes": {
      "amount": "100.0",
      "txid": "12335352"
    },
    "relationships": {
      "bank_detail": {
        "data": {
          "type": "bank_details",
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"
        }
      },
      "account": {
        "data": {
          "type": "accounts",
          "id": "dddddddd-dddd-dddd-dddd-dddddddddddd"
        }
      }
    }
  },
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "bank_details",
      "attributes": {
        "name": "HSBC",
        "beneficiary_name": "Eve Moneypenny",
        "account_number": "123123123",
        "address": "85 Albert Embankment, Vauxhall, London",
        "swift_code": "1234321"
      }
    }
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "accounts",
      "attributes": {
        "balance": "87597.8195418990169122",
        "shop_commission": "12.0",
        "balance_threshold": "0.0"
      },
      "relationships": {
        "currency": {
          "data": {
            "id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
            "type": "currencies"
          }
        }
      }
    },
    {
      "id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
      "type": "currencies",
      "attributes": {
        "code": "usd",
        "name": "USD",
    s    "account": true
      }
    },

  ]
}

REQUEST (Bitcoin account)

POST /v1/transactions/withdraw HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_SIGN
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="account_currency"
usd
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
deposits
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][amount]"
100.0
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][bitcoin_address]"
1q2W3e4R5t6Y7u8I9o0P1q2W3e4R5t6Y7u
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v2/payments/withdraw"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_SIGN"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "account_currency=usd"
    -F "data[type]=deposits"
    -F "data[attributes][amount]=100.0"
    -F "data[attributes][bitcoin_address]=1q2W3e4R5t6Y7u8I9o0P1q2W3e4R5t6Y7u"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v2/payments/withdraw")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_SIGN'
request["cache-control"] = 'no-cache'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ndeposits\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bitcoin_address]\"\r\n\r\n1q2W3e4R5t6Y7u8I9o0P1q2W3e4R5t6Y7u\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ndeposits\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][bitcoin_address]\"\r\n\r\n1q2W3e4R5t6Y7u8I9o0P1q2W3e4R5t6Y7u\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v2/payments/withdraw")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_SIGN")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("account_currency", "usd");
form.append("data[type]", "deposits");
form.append("data[attributes][amount]", "100.0");
form.append("data[attributes][bitcoin_address]", "1q2W3e4R5t6Y7u8I9o0P1q2W3e4R5t6Y7u");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v2/payments/withdraw",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_SIGN",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (Bitcoin account)

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "withdraws",
    "attributes": {
      "amount": "100.0",
      "bitcoin_address": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy"
    },
    "relationships": {
      "account": {
        "data": {
          "type": "accounts",
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"
        }
      }
    }
  },
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "accounts",
      "attributes": {
        "balance": "100.0",
        "shop_commission": "1.0",
        "balance_threshold": "0.0"
      },
      "relationships": {
        "currency": {
          "data": {
            "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
            "type": "currencies"
          }
        }
      }
    },
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "currencies",
      "attributes": {
        "code": "btc",
        "name": "BTC",
        "account": true
      }
    }
  ]
}

RESPONSE (fail)

{
  "errors": [
    {
      "code": 422,
      "error_code": "unprocessable_request",
      "message": "Insufficient funds on account"
    }
  ]
}

ENDPOINT

/payments/withdraw

DESCRIPTION

Withdraw money from specified account.

FORM DATA

Key Required Type Description
account_currency true [string] Account currency to withraw from ( should be one of Available Currencies codes )
data[type] true [string] Withdraw’s type ( should be withdraw)
data[attributes][txid] false [string] User’s Txid
data[attributes][amount] true [string] Amount of money to be withdrew ( should be greater then 0.0)
data[relationships][bank_detail][data][type] false [string] Bank Detail’s type ( should be bank_details)
data[relationships][bank_detail][data][attributes][name] true [string] Bank name
data[relationships][bank_detail][data][attributes][beneficiary_name] false [string] User’s Beneficiary Name
data[relationships][bank_detail][data][attributes][account_number] false [string] User’s Account Number
data[relationships][bank_detail][data][attributes][swift_code] false [string] User’s Swift Code
data[relationships][bank_detail][data][attributes][address] false [string] User’s Address
data[attributes][bitcoin_address] false [string] User’s Personal Bitcoin Address

Deposit

REQUEST

POST /v2/payments/deposit HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_SIGN
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="account_currency"
usd
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
deposits
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][amount]"
100.0
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v2/payments/deposit"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_SIGN"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "account_currency=usd"
    -F "data[type]=deposits"
    -F "data[attributes][amount]=100.0"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v2/payments/deposit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_SIGN'
request["cache-control"] = 'no-cache'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ndeposits\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"account_currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ndeposits\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n100.0\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v2/payments/deposit")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_SIGN")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("account_currency", "usd");
form.append("data[type]", "deposits");
form.append("data[attributes][amount]", "100.0");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v2/payments/deposit",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_SIGN",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (USD account)

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "deposits",
    "attributes": {
      "amount": "100.0",
      "txid": "1PSKC85N",
      "bank_name": "HSBC",
      "bank_address": "HSBC- No.1, Queens road, Central, Hong Kong",
      "beneficiary_name": "Generic Corp",
      "account_number": "123 456 789",
      "swift_code": "123SWIFT"
    },
    "relationships": {
      "account": {
        "data": {
          "type": "accounts",
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"
        }
      }
    }
  },
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "accounts",
      "attributes": {
        "balance": "87497.8195418990169122",
        "shop_commission": "12.0",
        "balance_threshold": "0.0"
      },
      "relationships": {
        "currency": {
          "data": {
            "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
            "type": "currencies"
          }
        }
      }
    },
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "currencies",
      "attributes": {
        "code": "usd",
        "name": "USD",
        "account": true
      }
    }
  ]
}

RESPONSE (Bitcoin account)

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "deposits",
    "attributes": {
      "amount": "100.0",
      "txid": "1PSKC85N",
      "bitcoin_address": "1q2W3e4R5t6Y7u8I9o0P1q2W3e4R5t6Y7u"
    },
    "relationships": {
      "account": {
        "data": {
          "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
          "type": "accounts"
        }
      }
    }
  },
  "included": [
    {
      "id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee",
      "type": "accounts",
      "attributes": {
        "balance": "100.0",
        "shop_commission": "1.0",
        "balance_threshold": "0.0"
      },
      "relationships": {
        "currency": {
          "data": {
            "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
            "type": "currencies"
          }
        }
      }
    },
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "currencies",
      "attributes": {
        "code": "btc",
        "name": "BTC",
        "account": true
      }
    }
  ]
}

ENDPOINT

/payments/deposit

DESCRIPTION

Deposit money to specified account.

FORM DATA

Key Required Type Default Description
account_currency true [string] Account currency to deposit to ( should be one of Available Currencies codes )
data[type] true [string] Deposit’s type ( should be deposits)
data[attributes][amount] true [decimal] Amount of money to be deposited ( should be greater then 0.0)

Upload

REQUEST

POST /v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/upload HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/upload"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/upload")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/upload")
  .post(null)
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/upload",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (success)

{ "Success": "200 OK" }

RESPONSE (fail)

{
  "errors": [
    {
      "code": 422,
      "error_code": "unprocessable_request",
      "message": "BTC deposits has no proofs to be uploaded"
    }
  ]
}
{
  "errors": [
    {
      "code": 422,
      "error_code": "unprocessable_request",
      "message": [
        [
          "Payment proof You are not allowed to upload \"fb2\" files, allowed types: jpg, jpeg, gif, png, bmp, pdf"
        ]
      ]
    }
  ]
}

ENDPOINT

/payments/:payment_id/upload

DESCRIPTION

This endpoint gives you ability to upload document proof for deposit with ID.

REQUEST PARAMS

Key Required Type Description
data[attributes][data_proof_attributes][proof] [file] Your Deposit proof ( file should be one of next types: jpg, jpeg, gif, png, bmp, pdf)

Cancel

REQUEST

POST /v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel")
  .post(null)
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v2/payments/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (success)

{ "Success": "200 OK" }

RESPONSE (fail)

{
  "errors": [
    {
      "code": 422,
      "error_code": "unprocessable_request",
      "message": [
        "Payment can not be canceled"
      ]
    }
  ]
}

ENDPOINT

/payments/:payment_id/cancel

DESCRIPTION

This endpoint cancels existing pending deposit by it’s ID.

Exchanges

Exchange Money

REQUEST

POST /v1/exchanges/exchange_currencies?amount=1&currency_from=usd&currency_to=hkd HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_HMAC
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v1/exchanges/exchange_currencies?amount=1&currency_from=usd&currency_to=hkd"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_HMAC"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/exchanges/exchange_currencies?amount=1&currency_from=usd&currency_to=hkd")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_HMAC'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/exchanges/exchange_currencies?amount=1&currency_from=usd&currency_to=hkd")
  .post(null)
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_HMAC")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/exchanges/exchange_currencies?amount=1&currency_from=usd&currency_to=hkd",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_HMAC",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (success)

{
  "data": {
    "id": "99999999999999",
    "type": "exchange_transaction_data",
    "attributes": {
      "status": "completed",
      "created_at": "2016-01-01T01:01:01.111+00:00",
      "fee": "0.00",
      "base_amount": "1.00",
      "quoted_amount": "7.65",
      "rate": "7.75515",
      "commission": "0.10"
    }
  }
}

RESPONSE (fail)

{
  "errors": [
    {
      "code": 422,
      "error_code": "unprocessable_request",
      "message": "Insufficient funds on account"
    }
  ]
}

ENDPOINT

/exchanges/exchange_currencies

DESCRIPTION

This endpoint exchanges money between your accounts. You can preview current exchange rate with Internal Exchange Rate endpoint.

REQUEST PARAMS

Key Required Type Description
amount true [decimal] Amount of money to be exchanged ( should be greater then 0.0)
currency_from true [string] Account currency from which will be sent money
currency_to true [string] Account currency to which will be recieved money

RESPONSE DETAILS

Key Type Description
status [string] Current status of exchange
created_at [date] Creation date of exchange
fee [decimal] Exchange fee
base_amount [decimal] Sent amount of money in currency_from
quoted_amount [decimal] Recieved amount of money in currency_to
rate [decimal] Actual exchange rate in wich exchange was performed
commission [decimal] Exchange commission

Top Ups

Top Ups History

REQUEST

GET /v1/top_ups?include=locked_commision,user_account.currency, HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_SIGN
Cache-Control: no-cache
curl -X GET "http://api.bitspark.io/v1/top_ups?include=locked_commision,user_account.currency"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_SIGN"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/top_ups?include=locked_commision%2Cuser_account.currency")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_SIGN'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/top_ups?include=locked_commision%2Cuser_account.currency")
  .get()
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_SIGN")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/top_ups?include=locked_commision%2Cuser_account.currency",
  "method": "GET",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_SIGN",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE

{
  "data": [
    {
      "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
      "type": "top_ups",
      "attributes": {
        "status_code": "pending",
        "status_message": "Pending",
        "amount": "10.0",
        "currency": "HKD",
        "shop_id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"
      },
      "relationships": {
        "user_account": {
          "data": {
            "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
            "type": "accounts"
          }
        },
        "shop_account": {
          "data": {
            "id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
            "type": "accounts"
          }
        },
        "locked_commission": {
          "data": {
            "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
            "type": "locked_commissions"
          }
        }
      }
    },
    "..."
  ],
  "included": [
    {
      "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
      "type": "locked_commissions",
      "attributes": {
        "shop_commission": "0.0",
        "bitspark_commission_percentage": "50.0"
      }
    }
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "accounts",
      "attributes": {
        "balance": "100.0",
        "shop_commission": "0.0",
        "balance_threshold": "0.0"
      },
      "relationships": {
        "currency": {
          "data": {
            "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
            "type": "currencies"
          }
        }
      }
    },
    {
      "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "type": "currencies",
      "attributes": {
        "code": "hkd",
        "name": "HKD",
        "account": true
      }
    },
    "..."
  ]
}

ENDPOINT

/top_ups

DESCRIPTION

This endpoint retrieves all created top ups with details.

REQUEST PARAMS

Key Required Type Default Description
include false [string] none Can be any subset of: locked_commision, user_account.currency, shop_account.currency

Create Top Up

REQUEST

POST /v1/top_ups?include=locked_commision,user_account.currency HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_SIGN
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="shop_code"
99999999-9999-9999-9999-999999999999
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="currency"
usd
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[type]"
top_ups
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="data[attributes][amount]"
10.0
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X POST "http://api.bitspark.io/v1/top_ups?include=locked_commision,user_account.currency"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_SIGN"
    -H "Cache-Control: no-cache"
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
    -F "shop_code=99999999-9999-9999-9999-999999999999"
    -F "currency=usd"
    -F "data[type]=top_ups"
    -F "data[attributes][amount]=10.0"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/top_ups?include=locked_commision%2Cuser_account.currency")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_SIGN'
request["cache-control"] = 'no-cache'
request["postman-token"] = 'd0dd6d79-8607-fa27-f53d-063e07694006'
request.body =
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shop_code\"\r\n\r\n99999999-9999-9999-9999-999999999999\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ntop_ups\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n10.0\r\n
  -----011000010111000001101001--"

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType,
  "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"shop_code\"\r\n\r\n99999999-9999-9999-9999-999999999999\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"currency\"\r\n\r\nusd\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[type]\"\r\n\r\ntop_ups\r\n
  -----011000010111000001101001\r\nContent-Disposition: form-data; name=\"data[attributes][amount]\"\r\n\r\n10.0\r\n
  -----011000010111000001101001--");
Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/top_ups?include=locked_commision%2Cuser_account.currency")
  .post(body)
  .addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_SIGN")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var form = new FormData();
form.append("shop_code", "99999999-9999-9999-9999-999999999999");
form.append("currency", "usd");
form.append("data[type]", "top_ups");
form.append("data[attributes][amount]", "10.0");

var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/top_ups?include=locked_commision%2Cuser_account.currency",
  "method": "POST",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_SIGN",
    "cache-control": "no-cache"
  },
  "processData": false,
  "contentType": false,
  "mimeType": "multipart/form-data",
  "data": form
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (success)

{
  "data": {
    "id": "ffffffff-ffff-ffff-ffff-ffffffffffff",
    "type": "top_ups",
    "attributes": {
      "status_code": "pending",
      "status_message": "Pending",
      "amount": "10.0",
      "currency": "USD",
      "shop_id": "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee"
    },
    "relationships": {
      "user_account": {
        "data": {
          "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
          "type": "accounts"
        }
      },
      "shop_account": {
        "data": {
          "id": "cccccccc-cccc-cccc-cccc-cccccccccccc",
          "type": "accounts"
        }
      },
      "locked_commission": {
        "data": {
          "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
          "type": "locked_commissions"
        }
      }
    }
  },
  "included": [
    {
      "id": "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb",
      "type": "locked_commissions",
      "attributes": {
        "shop_commission": "0.0",
        "bitspark_commission_percentage": "50.0"
      }
    },
    {
      "id": "dddddddd-dddd-dddd-dddd-dddddddddddd",
      "type": "accounts",
      "attributes": {
        "balance": "43.4",
        "shop_commission": "0.0",
        "balance_threshold": "0.0"
      },
      "relationships": {
        "currency": {
          "data": {
            "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
            "type": "currencies"
          }
        }
      }
    },
    {
      "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "type": "currencies",
      "attributes": {
        "code": "usd",
        "name": "USD",
        "account": true
      }
    }
  ]
}

RESPONSE (fail)

{
  "errors": [
    {
      "code": 422,
      "error_code": "unprocessable_request",
      "message": [
        "User account already been taken with 'pending' status in scope of specified shop account"
      ]
    }
  ]
}

ENDPOINT

/top_ups

DESCRIPTION

This endpoint creates new top_up.

REQUEST PARAMS

Key Required Type Default Description
include false [string] none Can be any subset of: locked_commision, user_account.currency, shop_account.currency

FORM DATA

Key Required Type Default Description
shop_code true [uuid] Shop Identifier from shop’s QR code
currency true [string] Top Up currency ( should be one of Available Currencies codes )
data[type] true [string] Top Up’s type ( must be top_ups)
data[attributes][amount] true [decimal] Amount of money to be received by user ( should be greater then 0.0)

Cancel Top Up

REQUEST

PUT /v1/top_ups/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel HTTP/1.1
Host: api.bitspark.io
Key: YOUR_API_KEY
Sign: COMPUTED_SIGN
Cache-Control: no-cache
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
curl -X PUT "http://api.bitspark.io/v1/top_ups/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel"
    -H "Key: YOUR_API_KEY"
    -H "Sign: COMPUTED_SIGN"
    -H "Cache-Control: no-cache"
require 'uri'
require 'net/http'

url = URI("http://api.bitspark.io/v1/top_ups/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Put.new(url)
request["key"] = 'YOUR_API_KEY'
request["sign"] = 'COMPUTED_SIGN'
request["cache-control"] = 'no-cache'

response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
  .url("http://api.bitspark.io/v1/top_ups/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel")
  .put(null)
  .addHeader("key", "YOUR_API_KEY")
  .addHeader("sign", "COMPUTED_SIGN")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "http://api.bitspark.io/v1/top_ups/ffffffff-ffff-ffff-ffff-ffffffffffff/cancel",
  "method": "PUT",
  "headers": {
    "key": "YOUR_API_KEY",
    "sign": "COMPUTED_SIGN",
    "cache-control": "no-cache"
  }
}

$.ajax(settings).done(function (response) {
  console.log(response);
});

RESPONSE (success)

  { "Success": "200 OK" }

RESPONSE (fail)

{
  "errors": [
    {
      "code": 422,
      "error_code": "unprocessable_request",
      "message": [
        "Top-up can not be canceled"
      ]
    }
  ]
}

ENDPOINT

/top_ups/:top_up_id/cancel

DESCRIPTION

This endpoint cancels existing pending top_up by it’s ID.

Transfer statuses list

The Bitspark API uses following status codes for transfers:

Status Meaning
unknown Initial status, presented only few second after new transfer is initialized.
performing Async worker starts perform transfer.
remittance_received_successfully Success remittance calculation response that is received external payment provider
remittance_received_unsuccessfully Unsuccess remittance calculation.
payment_created_successfully Payment created successfully on external payment provider side.
payment_created_unsuccessfully Payment created unsuccessfully on external payment provider side(can be presented because of some additional validation on external provider side or external provider currently unavailable).
insufficient_funds Not enough funds to perform a transfer.
payment_commited_successfully Successfully confirmed previously creaded payment on external payment provider.
payment_commited_unsuccessfully Unsuccessfully confirmed previously creaded payment on external payment provider.
declined Cancelled/declined by external service or admin.
accepted Transfes are successfully accepted by external payment service.
confirmed Transfer are confirmed by external service or by admin.
proved Transfer are successfully finalized. After 10 days confirmed and accepted transfers will be changed to proved status automatically.
failed Transfer finalization fails.
payout_failed Error when external service successfully received payment but cannot perform send money to selected the origin.
refund_requested Refund requested. Possible from statuses: [payment_created_successfully, payment_commited_successfully, accepted, confirmed].
refund_responce_received Bitspark system receive callback with refund details from external service(not all external services send callbacks about refund).
refund_confirmed Refund is confirmed by admin or external service(if possible). It means that funds refunded to Bitspark user’s balance.
refund_rejected Refund is rejected by admin or external service. Funds are not returned, for details contact admin.

Errors

The Bitspark API uses the following error codes:

Error Code Meaning
400 Bad Request – Invalid arguments specified
401 Unauthorized – YOUR_API_KEY or COMPUTED_HMAC is wrong
404 Not Found – The specified resource could not be found
406 Not Acceptable – Specified request format not matches Json-API specifications
422 Unprocessable Entity – Entity can not be processed
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarially offline for maintanance. Please try again later.