Rain API

Using the API
  1. Introduction
  2. Key Concepts
  3. Request formats
  4. Data types
  5. Authentication
  6. Status Codes & Errors
  7. Tutorial: Completing a 'Buy'
Resource List
  1. User
  2. Account
  3. Transaction
  4. Buy
  5. Sell
  6. Deposit
  7. Withdrawal
  8. Transfer
  9. Order
  10. Price

API Reference

Welcome to the Rain API documentation.

The Rain API is a powerful tool that lets you buy and sell bitcoin in exchange for fiat currency.

You can also use the API as a trading platform, which allows users to buy and sell bitcoin from one another. It uses the REST design pattern, and conforms with normal conventions and practices relating to error codes, data formats, and caching.

Key concepts

The Rain API uses HTTP resources to represent key parts of currency transactions.

The Rain API presents all resources using defined data types. It uses these to encapsulate the available fields for each resource, such as amount, currency, or date/time.

Each resource, for example, Account or Transaction, is identified by an ID number. The API uses UUIDs for this purpose. An example of a valid ID is: 48c2d60f-a0a1-47a4-8252-68fe726a73f5. The URL for each individual resource uses this ID directly, and all responses that reference individual objects list these IDs in their fields.

The most important types of objects in the API are:

Transaction

A Transaction represents a process occurring on a user's account. Each transaction has a type, such as a buy, sell, send, receive. Each transaction also has a status, such as processing or completed.

Account

An Account is a container for one or more Transactions. It has a balance, which can represent either fiat currency or bitcoin.

Buy

A Buy represents the intention of a user to buy an amount of cryptocurrency from the exchange, in exchange for a given sum of fiat currency.

Sell

A Sell represents the intention of a user to sell an amount of cryptocurrency to the exchange, in exchange for a given sum of fiat currency. It is the opposite of a Buy.

Deposit

A Deposit represents a way of adding fiat currency to a fiat account. You can then use this fiat currency to purchase cryptocurrency in a Buy request.

The source of funds is normally a bank account.

It is the opposite of a Withdrawal operation.

Withdrawal

A Withdrawal represents a way of taking fiat currency from a fiat account. You can gain fiat currency by making a deposit, or sell cryptocurrency to the exchange.

You can then transfer the funds to a bank account.

It is the opposite of a Deposit operation.

Order

An Order represents an entry in the order book of the exchange. It represents the intention of a buyer or seller to trade cryptocurrency , either as a 'limit' order for a particular price level and quantity, or a 'market' order that is fulfilled as soon as possible for a particular quantity.

Price

A Price represents a level at which the exchange is willing to trade cryptocurrency. Each price object contains a buying price, a spot price, and a selling price, as well as a reference fiat currency.

Prices are an internal resource for the exchange. Only administrative users can create Prices.

Request formats

The Rain API expects you to supply all request bodies in JSON format. Always use the application/json Content-Type when making requests.

Similarly, all responses from the API are in JSON format. The exact format of each response varies according to the endpoint. Refer to the documentation for each endpoint for further details and example requests.

Error example

This example shows a typical return message for an error state.

HTTP/1.1 400 Bad Request
Content-Length: 49
Content-Type: application/json; charset=UTF-8

{
    "code": 3005,
    "message": "Username already exists"
}

Data Types

The Rain API expects all requests in a JSON container format with a single dimension of key-value pairs. Responses are also in JSON format and can include additional levels of key-value pairs.

The data types used in the API are:

String

A simple string containing an arbitrary value.

Example:

"first_name": "Bruce"
Time

A timestamp that indicates the date, time, and time zone of an event or interaction. The API uses RFC 3339 format, with six digits of accuracy in the seconds portion, and the time zone specified as a numerical offset.

Example:

"created": "2017-06-14T22:02:19.023112+01:00"
Currency

A currency is a special case of a String that expresses the 3-character identifier of a currency. Its value can only be one of an enumerated list of supported currencies.

Currency fields are not case-sensitive.

Example:

"currency": "btc"
Money

Money fields express sums of money in a particular currency.

When you make requests that include amounts, you express the sum and the currency in separate fields. The API condenses these into a single field in its responses.

To express an amount, you can either use an integer to state a complete number (for example, 500), or a decimal that is appropriate to the currency:

  • For fiat currencies, use two decimal places - for example, 500.00.
  • For cryptocurrencies, use eight decimal places - for example, 0.01000000.

Example (request):

"amount": "500",
"currency": "USD"

Example (response):

"amount": {
        "amount": "500.00",
        "currency": "usd"
    }

Authentication

Most methods in the Rain API are authenticated, and you must supply security credentials to access them.

You can authenticate to the Rain API for the first time by using the Sign Up method. Once you have an account, you can use the Log In method to gain access.

Once you have authenticated, the API grants you an authentication token that you can use in later requests. This token is unique to the session.

To use the token, supply it as the content of the Authorization: header in each request that requires authentication.

Parsing an authentication token

The authentication token is supplied as part of the Sign Up and Log In methods. You can find it in the JSON object under the token key:

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

{
    "id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "created": "2017-06-14T22:02:19.023112+01:00",
    "token": "6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=",
    "user_id": "4c4c8da3-12f9-4674-9d48-bf7258b12332"
}

Using an authentication token

This example shows how to pass in an authentication token when requesting an authenticated method.

Pass the token as the content of the Authorization header.

GET /api/1/some-authenticated-method HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Status Codes & Errors

Rain returns HTTP status codes according to the standards and conventions of RESTful HTTP API design. In particular, 2xx status codes indicate successful requests, and 4xx and 5xx status codes indicate failures.

Also, when an error occurs, the Rain API returns a JSON object that contains more detail about the error. This JSON object contains a code element, which indicates the particular error that occurred. It also contains a message element, which describes the error in the context of the request made.

HTTP Status Code Application Status Code Description
200 OK n/a Operation completed successfully.
400 Bad Request n/a The API request was malformed or incomplete.
404 Not Found 3016 Account not found A sending or receiving account could not be located based on the ID in the request. Check it and try again.

Error example - bad request

This example shows a typical return message for a 'bad request' error state:

HTTP/1.1 400 Bad Request
Content-Length: 49
Content-Type: application/json; charset=UTF-8

{
    "code": 3005,
    "message": "Username already exists"
}

Error example - Account resource not found

This example shows a typical return message for a 'resource not found' error state in the Account resource:

HTTP/1.1 404 Not Found
Content-Length: 34
Content-Type: application/json; charset=UTF-8

{
    "code": 3016,
    "message": "Account not found"
}

Tutorial: Completing a 'Buy'

This tutorial explains how you can use the API to set up a new user login, deposit funds into your fiat currency account, and complete the process of purchasing cryptocurrency from the exchange.

Setup

To follow this tutorial, you need an HTTP client application such as Postman or Curl.

  1. Create Your Login

    The first step when interacting with the API is to create a user login that you can use for all your interactions.

    Use the Sign Up method to create a suitable user login.

    Pass in the email address, first name, last name, password, and desired username for your user login.

    The response to your Sign Up request includes the details of the account, as well as a token key containing an authentication token:

                "token": "6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2="

    Make a note of this token. You must pass it in the Authorization header of all future requests. Bear in mind that it only stays valid for 24 hours. After that, you must log in again.

  2. Promote Your Login

    To complete some steps in this tutorial, your user login must have administrative privileges.

    Use the Rain control panel to make your new user login an administrative user.

  3. List Your Accounts

    When you created your user login, the API automatically created two default accounts:

    • A bitcoin cryptocurrency account, which you can replenish by purchasing cryptocurrency with fiat currency
    • A fiat currency account, which you can replenish by depositing fiat funds.

    Make a request to see their details. Use the method to see both accounts associated with your user login.

    The API returns a list of two Account objects.

    You can identify the default bitcoin account by its name and currency value:

    "name": "BTC Account",
            "currency": "btc",

    Make a note of the IDs of each account. You need these to complete the following steps.

  4. Fund Your Fiat Account

    We're trying to make a financial transaction, so we need some cash, right? In this step, we add funds to the default fiat currency account so that you can use it to buy bitcoin.

    Use the Create Deposit method to start the process of funding your fiat currency account.

    Note down the ID of the deposit from the account object - for example:

    "id": "6a348132-04d6-4a23-b5cc-4a1b51da4a1f",

    Next, use the Confirm Deposit method to confirm your fiat currency deposit.

    Finally, use the Complete Deposit method to complete your deposit.

  5. Determine A Price

    When you buy cryptocurrency from Rain, you must do so at a price that the exchange offers.

    You can use the Get Price method to retrieve current prices.

    Once you retrieve a current price, note its ID.

  6. Purchase Cryptocurrency

    Use the Create Buy Order method to place a request to buy cryptocurrency.

    Set the request parameters as follows:

    • digital_currency: BTC
    • currency: USD
    • withdraw_account_id: Set this to the ID of your US Dollar account.
    • deposit_account_id: Set this to the ID of your bitcoin account.
    • amount: Set this to a decimal amount of bitcoin, for example 1.00000000.
    • subtotal: Set this to the net amount of the fiat currency required to purchase the bitcoin - the amount multiplied by the sell_price from the current Price object.
    • fee: Set this to the correct fee for the transaction. This is 1% of the value in the subtotal field.
    • total: Set this to the total fiat currency amount: the subtotal plus the fee.
    • price_id: Set this to the ID of the current Price object that you retrieved earlier.

    The return object contains the ID of the new Buy object. Note this for use in the next request.

  7. Confirm Your Purchase

    The final step in the 'Buy' process is to confirm the purchase that you requested.

    Use the Confirm Buy Order method.

    The response confirms that the Buy operation is in the processing state. Once Rain completes the operation, the cryptocurrency appears in your bitcoin account.

User

The User methods provide you with the means to register for a user login, perform a log in operation, and then obtain a security token that allows you to use other endpoints easily.

Sign Up

POST/api/1/signup

The Sign Up method lets you create a user login. It also automatically logs you in, creating a token that you can use for later requests.

You must supply the details of the new user login in the request JSON object.

The response provides a summary of the login session, including the session token. To get more details about the user account, make a Get User request.

  1. full_name

    The new user's full name (first and last)

  2. email

    The new user's email address

  3. password

    The password for the new user. The password must contain at least one special character.

  4. country

    The new user's country.

  5. terms_of_service_accepted

    Boolean value of true when accepted

API Example

Request:

POST /api/1/signup HTTP/1.1
Content-Type: application/json

{
    "full_name": "Bruce Wayne",
    "email": "[email protected]",
    "password": "Batman2$",
    "country": "USA",
    "terms_of_service_accepted": true
}

Response:

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

{
    "id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "created": "2017-06-14T22:02:19.023112+01:00",
    "token": "6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=",
    "user_id": "4c4c8da3-12f9-4674-9d48-bf7258b12332"
}

Log In

POST/api/1/login

Lets you log in. This method generates a token that you can use for later requests.

The response provides a summary of the login session, including the session token. To get more details about the user account, make a Get User request.

  1. email

    The email address associated with the user.

  2. password

    The password associated with the user.

API Example

Request:

POST /api/1/login HTTP/1.1
Content-Type: application/json
{
    "email": "[email protected]",
    "password": "Batman2$"
}

Response:

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

{
    "id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "created": "2017-06-14T22:02:19.023112",
    "token": "6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=",
    "user_id": "4c4c8da3-12f9-4674-9d48-bf7258b12332"
}

Get User

GET/api/1/user

Retrieves details of the current User.

The response provides a summary of the user login, including details of their currency preference and accounts.

Authenticated method.

API Example

Request:

GET /api/1/user HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "created": "2018-03-02T00:21:04.741891Z",
    "status": "pending",
    "full_name": "Bruce Wayne",
    "first_name": "",
    "last_name": "",
    "email": "[email protected]",
    "username": "",
    "email_verified": false,
    "phone_number": null,
    "phone_number_verified": null,
    "address_provided": null,
    "address_document_provided": null,
    "document_type": null,
    "national_id_front_document_provided": null,
    "national_id_back_document_provided": null,
    "passport_document_provided": null,
    "currency": "usd",
    "country": {
        "code": "usa",
        "phone_country_code": 1,
        "currency": "usd"
    }
}

Update User

PATCH/api/1/user

The Update User method lets you make changes to the logged in user.

The response provides a summary of the user login, including details of their currency preference and accounts.

Authenticated method.

  1. full_name

    The new user's full name

API Example

Request:

PATCH /api/1/user HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
        

Response:

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

{
    "id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "created": "2018-03-02T00:21:04.741891Z",
    "status": "pending",
    "full_name": "Bruce Wayne",
    "first_name": "",
    "last_name": "",
    "email": "[email protected]",
    "username": "",
    "email_verified": false,
    "phone_number": null,
    "phone_number_verified": null,
    "address_provided": null,
    "address_document_provided": null,
    "national_id_front_document_provided": null,
    "national_id_back_document_provided": null,
    "passport_document_provided": null,
    "currency": "usd",
    "country": {
        "code": "usa",
        "phone_country_code": 1,
        "currency": "usd"
    }
}
        

Log Out

GET/api/1/logout

Logs out of the Rain API and destroys the current session object.

If the log out has been successful, then this method responds with an HTTP 200 OK status code.

Authenticated method.

API Example

Request:

GET /api/1/logout HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/plain; charset=utf-8

Account

The Account methods let you interact with the accounts belong to the logged-in user.

The Rain API identifies each account with a unique ID. You can use this ID as part of certain requests, to interact with that particular account.

List Accounts

GET/api/1/accounts

The List Accounts method provides a summary of the accounts belong to the currently logged-in user, including their identifiers, balances, and last updated dates.

The JSON response is an array of individual account objects.

Authenticated method.

API Example

Request:

GET /api/1/accounts HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

[
    {
        "id": "eee06225-db68-4975-a964-7458e224f3c7",
        "created": "2017-06-15T22:33:19.023112+01:00",
        "updated": "2017-06-15T22:33:19.02271+01:00",
        "name": "BTC Account",
        "currency": "btc",
        "balance": {
            "amount": "0.00000000",
            "currency": "btc"
        },
        "unconfirmed_balance": {
            "amount": "0",
            "currency": "btc"
        },
        "address": "2N6RUnNGCTpCAxo1KrXV5hMD2suv3aM5s3p",
        "user_id": "e912fa15-4789-449b-9441-62e91eb10a9b"
    },
    {
        "id": "e383fc64-ff7e-4df9-a2b7-c14254625b18",
        "created": "2017-06-15T22:33:20.529077+01:00",
        "updated": "2017-06-15T22:33:20.52826+01:00",
        "name": "USD Account",
        "currency": "btc",
        "balance": {
            "amount": "0",
            "currency": "usd"
        },
        "unconfirmed_balance": {
            "amount": "0.00",
            "currency": "usd"
        },
        "address": "",
        "user_id": "e912fa15-4789-449b-9441-62e91eb10a9b"
    }
]

Get Account

GET/api/1/accounts/{account_id}

The Get Account method displays the details of an account associated with the currently logged-in user.

The response provides a summary of the account, including its identifiers, balances, and last updated dates.

Authenticated method.

API Example

Request:

GET /api/1/accounts/e383fc64-ff7e-4df9-a2b7-c14254625b18 HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 828
Content-Type: application/json; charset=UTF-8
{
    "id": "eee06225-db68-4975-a964-7458e224f3c7",
    "created": "2017-06-15T22:33:19.023112+01:00",
    "updated": "2017-06-15T22:33:19.02271+01:00",
    "name": "BTC Account",
    "currency": "btc",
    "balance": {
        "amount": "0.00000000",
        "currency": "btc"
    },
    "unconfirmed_balance": {
        "amount": "0",
        "currency": "btc"
    },
    "address": "2N6RUnNGCTpCAxo1KrXV5hMD2suv3aM5s3p",
    "user_id": "e912fa15-4789-449b-9441-62e91eb10a9b"
}

Create Account

POST/api/1/accounts

The Create Account method lets you create a new account that is associated with the currently logged-in user.

The response provides a summary of the new account, including its identifier, balance, and last updated date.

Authenticated method.

  1. name

    A friendly name for the new account.

API Example

Request:

POST /api/1/accounts HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

{
    "name": "Batsuit Repair Fund Account"
}

Response:

HTTP/1.1 200 OK
Content-Length: 580
Content-Type: application/json; charset=UTF-8
{
    "id": "7e7bd0d4-d361-4966-87a0-05485534414b",
    "created": "2017-06-15T22:33:19.023112+01:00",
    "updated": "2017-06-15T22:33:19.02271+01:00",
    "deleted": null,
    "name": "Batsuit Repair Fund Account",
    "currency": "btc",
    "balance": {
        "amount": "0.00000000",
        "currency": "btc"
    },
    "unconfirmed_balance": {
        "amount": "0",
        "currency": "btc"
    },
    "address": "2N3U2CmaFcLHB1XS7dKZn1Dnde4GA83Fmn2",
    "user_id": "e912fa15-4789-449b-9441-62e91eb10a9b"
}

Update Account

PATCH/api/1/accounts/{account_id}

The Update Account method lets you make changes to an account that is associated with the currently logged-in user.

To use this method, you must supply a JSON object that includes the keys that you want to update.

The response provides a summary of the updated account, including its identifier, balance, and last updated date.

Authenticated method.

API Example

Request:

        PATCH /api/1/accounts/e96e3f1b-5a0e-47ed-8f09-afd2e99ff68d HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Length: 44
Content-Type: application/json

{
    "name": "Batsuit Replacement Fund Account"
}

Response:

HTTP/1.1 200 OK
Content-Length: 580
Content-Type: application/json; charset=UTF-8
{
    "id": "7e7bd0d4-d361-4966-87a0-05485534414b",
    "created": "2017-06-15T22:33:19.023112+01:00",
    "updated": "2017-06-15T22:33:19.02271+01:00",
    "deleted": null,
    "name": "Batsuit Repair Fund Account",
    "currency": "btc",
    "balance": {
        "amount": "0.00000000",
        "currency": "btc"
    },
    "unconfirmed_balance": {
        "amount": "0",
        "currency": "btc"
    },
    "address": "2N3U2CmaFcLHB1XS7dKZn1Dnde4GA83Fmn2",
    "user_id": "e912fa15-4789-449b-9441-62e91eb10a9b"
}

Delete Account

DELETE/api/1/accounts/{account_id}

The Delete Account method lets you delete an account that is associated with the currently logged-in user.

The response shows the updated details of the account. The JSON structure includes a deleted key. The value of this key shows the date and time when the account was deleted.

Authenticated method.

API Example

Request:

        DELETE /api/1/accounts/7e7bd0d4-d361-4966-87a0-05485534414b HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 580
Content-Type: application/json; charset=UTF-8
{
    "id": "7e7bd0d4-d361-4966-87a0-05485534414b",
    "created": "2017-06-15T22:33:19.023112+01:00",
    "updated": "2017-06-15T22:33:19.02271+01:00",
    "deleted": "2017-06-16T00:11:39.234557+01:00",
    "name": "Batsuit Repair Fund Account",
    "currency": "btc",
    "balance": {
        "amount": "0.00000000",
        "currency": "btc"
    },
    "unconfirmed_balance": {
        "amount": "0",
        "currency": "btc"
    },
    "address": "2N3U2CmaFcLHB1XS7dKZn1Dnde4GA83Fmn2",
    "user_id": "e912fa15-4789-449b-9441-62e91eb10a9b"
}

Get Account Addresses

GET/api/1/accounts/{account_id}/addresses

The Get Account Addresses method displays the cryptocurrency addresses associated with a cryptocurrency account owned by the currently logged-in user.

For example, for bitcoin, this method displays the collection of Bitcoin addresses associated with the Account.

The response provides a list of the addresses, including their ID, cryptocurrency address, and created date.

Authenticated method.

API Example

Request:

        GET /api/1/accounts/e383fc64-ff7e-4df9-a2b7-c14254625b18/addresses HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 157
Content-Type: application/json; charset=UTF-8
[
    {
        "id": "dfabc17e-cdbc-49a6-8b3b-4042601998e5",
        "account_id": "e383fc64-ff7e-4df9-a2b7-c14254625b18",
        "address": "2N8KzPFDdkSwVGzqSHzrYyQThs5c8VUchxq",
        "created": "2017-07-03T12:40:02.939508Z",
        "currency": "btc"
    }
]

Get Account Address

GET/api/1/accounts/{account_id}/addresses/{address_id}

The Get Account Address method displays the details of a cryptocurrency address.

The response provides a summary of the address, including its ID, cryptocurrency address, and created date.

Authenticated method.

API Example

Request:

        GET /api/1/accounts/e383fc64-ff7e-4df9-a2b7-c14254625b18/addresses/dfabc17e-cdbc-49a6-8b3b-4042601998e5 HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 155
Content-Type: application/json; charset=UTF-8
{
    "id": "dfabc17e-cdbc-49a6-8b3b-4042601998e5",
    "account_id": "e383fc64-ff7e-4df9-a2b7-c14254625b18",
    "address": "2N8KzPFDdkSwVGzqSHzrYyQThs5c8VUchxq",
    "created": "2017-07-03T12:40:02.939508Z",
    "currency": "btc"
}

Create Account Address

POST/api/1/accounts/{account_id}/addresses

The Create Account Address method lets you associate an extra cryptocurrency address with a cryptocurrency account owned by the currently logged-in user.

For example, for bitcoin, you can associate an extra Bitcoin wallet identifier.

The response provides a summary of the address, including its identifier, cryptocurrency address, and created date.

Authenticated method.

  1. bitcoin_address

    The extra Bitcoin address to associate with the cryptocurrency account.

API Example

Request:

        POST /api/1/accounts/e383fc64-ff7e-4df9-a2b7-c14254625b18/addresses HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 155
Content-Type: application/json; charset=UTF-8
{
    "id": "dfabc17e-cdbc-49a6-8b3b-4042601998e5",
    "account_id": "e383fc64-ff7e-4df9-a2b7-c14254625b18",
    "address": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy",
    "created": "2017-07-03T12:40:02.939508Z",
    "currency": "btc"
}

Transaction

The Transaction methods let you interact with processes that happen on user accounts.

Each transaction has a type, such as a buy, sell, send, receive. Each transaction also has a status, such as processing or completed.

The fields available on each Transaction object are determined by the type of object. All Transaction objects have a set of base fields.

List Transactions

GET/api/1/accounts/{account_id}/transactions

The List Transactions method returns a list of transactions associated with a particular account.

It provides a list of Transaction events and their details. Depending on the type of Transaction, these details can include the amount, date, currency, and the Bitcoin transaction hash.

The JSON response is an array of individual transaction objects.

Authenticated method.

API Example

Request:

        GET /api/1/accounts/eee06225-db68-4975-a964-7458e224f3c7/transactions HTTP/1.1
  Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 1410
Content-Type: application/json; charset=UTF-8
[
{
      "id": "b4eef7c8-502e-448a-982b-a5d64d0f6c31",
      "created": "2017-07-17T22:23:31.038833Z",
      "type": "buy",
      "status": "starting",
      "memo": "Buying some Bitcoin",
      "amount": {
          "amount": "1.00000000",
          "currency": "btc"
      },
      "subtotal": {
          "amount": "1.50",
          "currency": "usd"
      },
      "fee": {
          "amount": "0.02",
          "currency": "usd"
      },
      "total": {
          "amount": "1.52",
          "currency": "usd"
      },
      "withdraw_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
      "deposit_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
      "price_id": "d558c5a9-aba1-4609-a8de-4417b5fbf9e4"
  },
  {
        "id": "8140db2e-60b7-4ea5-81b5-1e459b0e8bc6",
        "created": "2017-07-23T22:51:58.143115Z",
        "type": "sell",
        "status": "starting",
        "memo": "Memo",
        "amount": {
            "amount": "1.00000000",
            "currency": "btc"
        },
        "subtotal": {
            "amount": "4.00",
            "currency": "usd"
        },
        "fee": {
            "amount": "0.04",
            "currency": "usd"
        },
        "total": {
            "amount": "3.96",
            "currency": "usd"
        },
        "withdraw_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
        "deposit_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
        "price_id": "628055dc-161f-4081-92b2-f534a266065b",
    }

]

Get Transaction

GET/api/1/accounts/{account_id}/transactions/{transaction_id}

The Get Transaction method returns the details of a particular transaction.

You must supply the ID of the account and the transaction as part of the request URL.

Authenticated method.

API Example

Request:

        GET /api/1/accounts/eee06225-db68-4975-a964-7458e224f3c7/transactions/66ba0c6b-f84c-4d4c-ba1b-cedf6451a564 HTTP/1.1
  Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "66ba0c6b-f84c-4d4c-ba1b-cedf6451a564",
    "created": "2017-07-03T14:30:56.021846Z",
    "type": "request_btc",
    "status": "starting",
    "amount": {
        "amount": "0.01000000",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "50.00",
        "currency": "usd"
    },
    "email_address": "[email protected]",
    "sender_id": "4d663b9c-62eb-40fa-b3ab-61abc88d1777",
    "sender_account_id": "6379b785-b431-454d-9a54-8c40e94ca7ab",
    "recipient_id": "36a0fe8f-bdfb-43a9-a457-6edd98cf9b88",
    "recipient_account_id": "4109c993-71d5-4f9d-b876-7b171ae36e36"
}

Send Money

POST/api/1/sends

The Send Money method initiates a request to send Bitcoin to another account.

You must supply the details of the transaction in the request body.

When you make a successful Send Money request, the Rain API returns the Transaction for the request with its state set to starting. You can then use the Confirm Send Money method to verify that you wish to proceed with the transaction.

Authenticated method.

  1. account_id

    The ID of the account to send the funds from. This account must belong to the logged-in user.

  2. amount

    The amount to send, denoted in the currency indicated in the currency field.

  3. currency

    The currency for the transaction. You must set this to btc (Bitcoin).

  4. memo

    A note describing the purpose or nature of the transaction.

  5. to

    The intended recipient of the send money transaction. You can specify the recipient as a bitcoin address.

API Example

Request:

POST /api/1/sends HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json
{
    "account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "amount": "0.05",
    "currency": "BTC",
    "memo": "Reimbursement for dry cleaning",
    "to": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy"
}

Response:

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 470
Content-Type: application/json; charset=UTF-8

{
    "id": "e24e9e1d-1e44-445c-b12e-2f685c09e91b",
    "created": "2017-07-08T22:15:12.872718Z",
    "type": "send",
    "status": "starting",
    "memo": "Reimbursement for dry cleaning",
    "amount": {
        "amount": "0.05000000",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "0.00",
        "currency": "usd"
    },
    "email_address": "",
    "sender_id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "sender_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "network": "bitcoin",
    "address": "3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy",
    "transaction_hash": "51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015",
    "block_explorer_url": "https://live.blockcypher.com/btc/tx/51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015"
}

Confirm Send Money

POST/api/1/sends/{transaction_id}/confirm

The Confirm Send Money method ensures that the logged-in user wishes to proceed with a 'send money' transaction, and starts the transaction.

You must specify the transaction ID in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/sends/e24e9e1d-1e44-445c-b12e-2f685c09e91b/confirm HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 470
Content-Type: application/json; charset=UTF-8

{
    "id": "e24e9e1d-1e44-445c-b12e-2f685c09e91b",
    "created": "2017-07-08T22:15:12.872718Z",
    "type": "send",
    "status": "processing",
    "memo": "Reimbursement for dry cleaning",
    "amount": {
        "amount": "0.05000000",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "0.00",
        "currency": "usd"
    },
    "email_address": "",
    "sender_id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "sender_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "network": "bitcoin",
    "address": "2N6RUnNGCTpCAxo1KrXV5hMD2suv3aM5s3p",
    "transaction_hash": "51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015",
    "block_explorer_url": "https://live.blockcypher.com/btc/tx/51eaf04f9dbbc1417dc97e789edd0c37ecda88bac490434e367ea81b71b7b015"
}

Request Money

POST/api/1/requests

The Request Money method initiates a request for another user to send bitcoin to an account owned by the currently logged-in user.

You must supply the details of the transaction in the request body.

Authenticated method.

  1. account_id

    The ID of the account that should receive the funds. This account must belong to the logged-in user.

  2. amount

    The amount to request, denoted in the currency indicated in the currency field.

  3. currency

    The currency for the transaction. You must set this to btc (bitcoin).

  4. email_address

    The email address of the person who should send the funds.

  5. memo

    A note describing the purpose or nature of the transaction.

API Example

Request:

POST /api/1/requests HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json
{
    "account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "amount": "2.00",
    "currency": "BTC",
    "email_address": "[email protected]",
    "memo": "Lodgings in Wayne Manor"
}

Response:

Response format to be confirmed.

Re-Send Request Money

POST/api/1/requests/{transaction_id}/resend

The Request Money method sends a reminder notification to the person identified in the sender_id field of a Request Money object that they should complete the request.

You must specify the ID of the Request Money transaction in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/requests/ab7a9c6b-8078-43bc-928f-43eeb94220fe/resend HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

Response format to be confirmed.

Buy

The Buy methods let you specify and place an order with the exchange to buy bitcoin at a particular price.

Each Buy object represents the user's intention to purchase bitcoin. It includes details of the status of the purchase, fees charged, and the deposit and withdrawal accounts.

You can buy bitcoin in exchange for fiat currency from one of your fiat currency accounts. After purchase, the bitcoin is deposited into an Account that you specify. The Account must be denominated in BTC.

When you conduct a Buy, the exchange charges you a 1% fee. This is reflected in the response objects that the Buy methods return.

Fields

  1. id

    The unique ID of the Buy object. You can use this in URLs to identify the object.

  2. created

    The date and time when the object was created.

  3. type

    A field that indicates the type of Transaction that this object represents. For a Buy, this is set to buy.

  4. status

    A field indicating the current status of the transaction. This field changes as you interact with the object.

  5. memo

    A technical field that the API sets as it processes the Buy Order.

  6. amount

    The amount requested in the Buy, denoted in a cryptocurrency .

  7. subtotal

    The net amount of the Buy Order, denoted in a fiat currency. This amount is equivalent to the amount field. It does not include any fees - these are indicated in the fees field.

  8. fee

    The fee charged by the exchange for processing this Buy Order. This is 1% of the subtotal amount.

  9. total

    The total value of the Buy Order, denoted in a fiat currency. This includes the fee. It is subtotal amount plus the fee amount.

  10. withdraw_account_id

    The ID of the fiat currency account to use to fund the Buy Order request. The API withdraws the amount specified in the total field from this account.

  11. deposit_account_id

    The ID of the cryptocurrency account to deposit the cryptocurrency into, once the purchase has completed.

  12. price_id

    The ID of the Price object to use for this Buy Order.

List Buys

GET/api/1/buys

The List Buys method returns details of all Buys associated with the logged-in user.

The JSON response is an array of individual Buy objects.

Each Buy object represents the user's intention to purchase bitcoin. It includes details of the status of the purchase, fees charged, and the deposit and withdrawal accounts.

Authenticated method.

API Example

Request:

GET /api/1/buys HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

[
    {
        "id": "b4eef7c8-502e-448a-982b-a5d64d0f6c31",
        "created": "2017-07-17T22:23:31.038833Z",
        "type": "buy",
        "status": "starting",
        "memo": "Buying some bitcoin",
        "amount": {
            "amount": "1.00000000",
            "currency": "btc"
        },
        "subtotal": {
            "amount": "1.50",
            "currency": "usd"
        },
        "fee": {
            "amount": "0.02",
            "currency": "usd"
        },
        "total": {
            "amount": "1.52",
            "currency": "usd"
        },
        "withdraw_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
        "deposit_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
        "price_id": "d558c5a9-aba1-4609-a8de-4417b5fbf9e4"
    }
]

Get Buy

GET/api/1/buys/{buy_id}

The Get Buy method displays the details of a Buy object associated with the currently logged-in user.

You must specify the ID of the Buy object in the URL.

The response includes details of the status of the purchase, fees charged, and the deposit and withdrawal accounts.

Authenticated method.

API Example

Request:

GET /api/1/buys/b4eef7c8-502e-448a-982b-a5d64d0f6c31 HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "b4eef7c8-502e-448a-982b-a5d64d0f6c31",
    "created": "2017-07-17T22:23:31.038833Z",
    "type": "buy",
    "status": "starting",
    "memo": "Buying some bitcoin",
    "amount": {
        "amount": "1.00000000",
        "currency": "btc"
    },
    "subtotal": {
        "amount": "1.50",
        "currency": "usd"
    },
    "fee": {
        "amount": "0.02",
        "currency": "usd"
    },
    "total": {
        "amount": "1.52",
        "currency": "usd"
    },
    "withdraw_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "deposit_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "price_id": "d558c5a9-aba1-4609-a8de-4417b5fbf9e4"
}

Create Buy Order

POST/api/1/buys

The Create Buy Order method creates a new Buy order object.

You must supply the details of the Buy order in the request body.

Authenticated method.

  1. withdraw_account_id

    The ID of the fiat currency account to use to fund the Buy Order request. The API withdraws the amount specified in the total field from this account.

  2. deposit_account_id

    The ID of the cryptocurrency account to deposit the cryptocurrency into, once the purchase has completed.

  3. amount

    The amount of cryptocurrency to be bought, denoted in the cryptocurrency of the deposit account.

  4. subtotal

    The corresponding fiat amount to be bought, denoted in the fiat currency of the withdraw account. This amount is equivalent to the amount field. It does not include any fees - these are indicated in the fee field.

  5. fee

    The fee amount required for completing the buy.

  6. total

    The total amount that results from adding the subtotal and the fee.

API Example

Request:

POST /api/1/buys HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json
{
    "withdraw_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2"
    "deposit_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "amount": "1.00",
    "subtotal": "2.00",
    "fee": "1.00", // minimum fee
    "total": "3.00"
}

Response:

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 437
Content-Type: application/json; charset=UTF-8

{
    "id": "b4eef7c8-502e-448a-982b-a5d64d0f6c31",
    "created": "2017-07-17T22:23:31.038833Z",
    "type": "buy",
    "status": "starting",
    "memo": "Buying some bitcoin",
    "amount": {
        "amount": "1.00000000",
        "currency": "btc"
    },
    "subtotal": {
        "amount": "1.50",
        "currency": "usd"
    },
    "fee": {
        "amount": "0.02",
        "currency": "usd"
    },
    "total": {
        "amount": "1.52",
        "currency": "usd"
    },
    "withdraw_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "deposit_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "price_id": "d558c5a9-aba1-4609-a8de-4417b5fbf9e4"
}

Confirm Buy Order

POST/api/1/buys/{buy_id}/confirm

The Confirm Buy Order method ensures that the logged-in user wishes to proceed with a 'Buy Order' transaction, and starts the transaction.

You must specify the transaction ID in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/buys/b4eef7c8-502e-448a-982b-a5d64d0f6c31/confirm HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 437
Content-Type: application/json; charset=UTF-8

{
    "id": "b4eef7c8-502e-448a-982b-a5d64d0f6c31",
    "created": "2017-07-17T22:23:31.038833Z",
    "type": "buy",
    "status": "processing",
    "memo": "Buying some bitcoin",
    "amount": {
        "amount": "1.00000000",
        "currency": "btc"
    },
    "subtotal": {
        "amount": "1.50",
        "currency": "usd"
    },
    "fee": {
        "amount": "0.02",
        "currency": "usd"
    },
    "total": {
        "amount": "1.52",
        "currency": "usd"
    },
    "withdraw_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "deposit_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "price_id": "d558c5a9-aba1-4609-a8de-4417b5fbf9e4"
}

Sell

The Sell methods let you specify and place an order with the exchange to sell bitcoin at a particular price.

Each Sell object represents the user's intention to sell bitcoin. It includes details of the status of the purchase, fees charged, and the deposit and withdrawal accounts.

You can sell bitcoin from your bitcoin-denominated Accounts to the exchange and earn fiat currency. After purchase, the fiat currency is deposited into an Account that you specify. The Account must be denominated in the appropriate fiat currency.

When you conduct a Sell, the exchange charges you a 1% fee. This is reflected in the response objects that the Sell methods return.

Fields

  1. id

    The unique ID of the Sell object. You can use this in URLs to identify the object.

  2. created

    The date and time when the object was created.

  3. type

    A field that indicates the type of Transaction that this object represents. For a Sell, this is set to sell.

  4. status

    A field indicating the current status of the transaction. This field changes as you interact with the object.

  5. memo

    A technical field that the API sets as it processes the Sell Order.

  6. amount

    The amount requested in the Sell, denoted in a cryptocurrency .

  7. subtotal

    The net amount of the Sell Order, denoted in a fiat currency. This amount is equivalent to the amount field. It does not include any fees - these are indicated in the fees field.

  8. fee

    The fee charged by the exchange for processing this Sell Order. This is 1% of the subtotal amount.

  9. total

    The total value of the Sell Order, denoted in a fiat currency. This includes the fee. It is subtotal amount plus the fee amount.

  10. withdraw_account_id

    The ID of the cryptocurrency account to use to fund the Sell Order request. The API withdraws the amount specified in the amount field from this account.

  11. deposit_account_id

    The ID of the account to deposit the fiat currency into, once the sale has completed.

  12. price_id

    The ID of the Price object to use for this Sell Order.

List Sells

GET/api/1/sells

The List Sells method returns details of all Sells associated with the logged-in user.

The JSON response is an array of individual Sell objects.

Each Sell object represents the user's intention to sell bitcoin. It includes details of the status of the sale, fees charged, and the deposit and withdrawal accounts.

Authenticated method.

API Example

Request:

GET /api/1/sells HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

[
    {
        "id": "8140db2e-60b7-4ea5-81b5-1e459b0e8bc6",
        "created": "2017-07-23T22:51:58.143115Z",
        "type": "sell",
        "status": "starting",
        "memo": "Memo",
        "amount": {
            "amount": "1.00000000",
            "currency": "btc"
        },
        "subtotal": {
            "amount": "4.00",
            "currency": "usd"
        },
        "fee": {
            "amount": "0.04",
            "currency": "usd"
        },
        "total": {
            "amount": "3.96",
            "currency": "usd"
        },
        "withdraw_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
        "deposit_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
        "price_id": "628055dc-161f-4081-92b2-f534a266065b",
    }
]

Get Sell

GET/api/1/sells/{sell_id}

The Get Sell method displays the details of a Sell object associated with the currently logged-in user.

You must specify the ID of the Sell object in the URL.

The response includes details of the status of the sale, fees charged, and the deposit and withdrawal accounts.

Authenticated method.

API Example

Request:

GET /api/1/sells/8140db2e-60b7-4ea5-81b5-1e459b0e8bc6 HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "8140db2e-60b7-4ea5-81b5-1e459b0e8bc6",
    "created": "2017-07-23T22:51:58.143115Z",
    "type": "sell",
    "status": "starting",
    "memo": "Selling some bitcoin",
    "amount": {
        "amount": "1.00000000",
        "currency": "btc"
    },
    "subtotal": {
        "amount": "4.00",
        "currency": "usd"
    },
    "fee": {
        "amount": "0.04",
        "currency": "usd"
    },
    "total": {
        "amount": "3.96",
        "currency": "usd"
    },
    "withdraw_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869"
    "price_id": "bd9d591e-b66c-436a-8b14-0fe066ae0640"
}

Create Sell Order

POST/api/1/sells

The Create Sell Order method creates a new Sell order object.

You must supply the details of the Sell order in the request body.

Authenticated method.

  1. withdraw_account_id

    The ID of the account to use to fund the Sell Order request. The API withdraws the amount specified in the amount field from this account.

  2. deposit_account_id

    The ID of the account to deposit the earned fiat currency into, once the sale has completed.

  3. amount

    The amount to sell, denoted in the cryptocurrency indicated in the digital_currency field.

  4. subtotal

    The net amount of the Sell Order, denoted in the fiat currency indicated in the currency. This amount is equivalent to the amount field. This amount should be equal to the selling price per unit of cryptocurrency multiplied by the amount.

  5. fee

    The fee amount required for completing the sell.

  6. total

    The total amount that results from adding the subtotal and the fee.

API Example

Request:

POST /api/1/sells HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json
{
    "withdraw_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869"
    "deposit_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "amount": "1.00",
    "subtotal": "4.00",
    "fee": "1.00",
    "total": "3.00"
}

Response:

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 438
Content-Type: application/json; charset=UTF-8

{
    "id": "8140db2e-60b7-4ea5-81b5-1e459b0e8bc6",
    "created": "2017-07-23T22:51:58.143115Z",
    "type": "sell",
    "status": "starting",
    "memo": "Selling some bitcoin",
    "amount": {
        "amount": "1.00000000",
        "currency": "btc"
    },
    "subtotal": {
        "amount": "4.00",
        "currency": "usd"
    },
    "fee": {
        "amount": "0.04",
        "currency": "usd"
    },
    "total": {
        "amount": "3.96",
        "currency": "usd"
    },
    "withdraw_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869"
    "price_id": "bd9d591e-b66c-436a-8b14-0fe066ae0640"
}

Confirm Sell Order

POST/api/1/sells/{sell_id}/confirm

The Confirm Sell Order method ensures that the logged-in user wishes to proceed with a 'Sell Order' transaction, and starts the transaction.

You must specify the transaction ID in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/sells/8140db2e-60b7-4ea5-81b5-1e459b0e8bc6/confirm HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "8140db2e-60b7-4ea5-81b5-1e459b0e8bc6",
    "created": "2017-07-23T22:51:58.143115Z",
    "type": "sell",
    "status": "processing",
    "memo": "Selling some bitcoin",
    "amount": {
        "amount": "1.00000000",
        "currency": "btc"
    },
    "subtotal": {
        "amount": "4.00",
        "currency": "usd"
    },
    "fee": {
        "amount": "0.04",
        "currency": "usd"
    },
    "total": {
        "amount": "3.96",
        "currency": "usd"
    },
    "withdraw_account_id": "a893583f-9bf1-4264-aeea-ee13fc262869"
    "price_id": "bd9d591e-b66c-436a-8b14-0fe066ae0640"
}

Deposit

The Deposit methods let you add fiat currency into your accounts.

'Deposit' Object Fields

  1. id

    The unique ID of the Deposit object. You can use this in URLs to identify the object.

  2. created

    The date and time when the object was created.

  3. type

    A field that indicates the type of Transaction that this object represents. For a Deposit, this is set to deposit.

  4. status

    A field indicating the current status of the transaction. This field changes as you interact with the object.

  5. memo

    A technical field that the API sets as it processes the Deposit.

  6. amount

    The amount to deposit, denoted in the fiat currency indicated in the currency field.

  7. fiat_amount

    The deposit amount, denoted in the user’s local currency.

  8. deposit_account_id

    The ID of the account to deposit the fiat currency into, once the operation has completed.

List Deposits

GET/api/1/deposits

The List Deposits method returns details of all Deposits associated with the logged-in user.

Authenticated method.

API Example

Request:

GET /api/1/deposits HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

[
    {
        "id": "6a348132-04d6-4a23-b5cc-4a1b51da4a1f",
        "created": "2017-06-26T23:32:56.899925+01:00",
        "type": "deposit",
        "status": "starting",
        "memo": "Money for Batmobile gasoline fund.",
        "amount": {
            "amount": "500.00",
            "currency": "usd"
        },
        "fiat_amount": {
            "amount": "500.00",
            "currency": "usd"
        },
        deposit_account_id: "a893583f-9bf1-4264-aeea-ee13fc262869"
    }
]

Get Deposit

GET/api/1/deposits/{deposit_id}

The Get Deposit method displays the details of a Deposit object associated with the currently logged-in user.

You must specify the ID of the Deposit object in the URL.

Authenticated method.

API Example

Request:

GET /api/1/deposits/6a348132-04d6-4a23-b5cc-4a1b51da4a1f HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "6a348132-04d6-4a23-b5cc-4a1b51da4a1f",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "deposit",
    "status": "starting",
    "memo": "Money for Batmobile gasoline fund.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    deposit_account_id: "a893583f-9bf1-4264-aeea-ee13fc262869"
}

Create Deposit

POST/api/1/deposits

The Create Deposit method creates a new Deposit object. This object starts the process of depositing fiat currency into one of the accounts owned by the currently logged-in user.

You must supply the details of the Deposit in the request body.

Authenticated method.

  1. account_id

    The ID of the account to deposit the fiat currency into.

  2. amount

    The amount to deposit, denoted in the fiat currency indicated in the currency field.

  3. currency

    The fiat currency used to describe value in the amount field.

  4. memo

    A note describing the purpose or nature of the transaction.

API Example

Request:

POST /api/1/deposits HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json
{
    "account_id": "a893583f-9bf1-4264-aeea-ee13fc262869",
    "amount": "500.00",
    "currency": "USD",
    "memo": "Money for Batmobile gasoline fund."
}

Response:

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

{
    "id": "6a348132-04d6-4a23-b5cc-4a1b51da4a1f",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "deposit",
    "status": "starting",
    "memo": "Money for Batmobile gasoline fund.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    deposit_account_id: "a893583f-9bf1-4264-aeea-ee13fc262869"
}

Confirm Deposit

POST/api/1/deposits/{deposit_id}/confirm

The Confirm Deposit method ensures that the logged-in user wishes to proceed with a 'Deposit' transaction, and starts the transaction.

You must specify the ID of the deposit in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/deposits/6a348132-04d6-4a23-b5cc-4a1b51da4a1f/confirm HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

HTTP/1.1 200 OK
Content-Length: 441
Content-Type: application/json; charset=UTF-8
{
    "id": "6a348132-04d6-4a23-b5cc-4a1b51da4a1f",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "deposit",
    "status": "processing",
    "memo": "Money for Batmobile gasoline fund.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    deposit_account_id: "a893583f-9bf1-4264-aeea-ee13fc262869"
}

Complete Deposit

POST/api/1/deposits/{deposit_id}/complete

The Complete Deposit method lets an administrator finish a deposit operation.

The transaction must be in the processing state before you invoke the Complete Deposit method.

You must specify the ID of the deposit in the URL.

Authenticated method. Only administrative users can call this method.

API Example

Request:

        POST /api/1/deposits/6a348132-04d6-4a23-b5cc-4a1b51da4a1f/complete HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "6a348132-04d6-4a23-b5cc-4a1b51da4a1f",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "deposit",
    "status": "completed",
    "memo": "Money for Batmobile gasoline fund.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    deposit_account_id: "a893583f-9bf1-4264-aeea-ee13fc262869"
}

Withdrawal

The Withdrawal methods let you withdraw fiat currency from your accounts.

'Withdrawal' Object Fields

  1. id

    The unique ID of the Withdrawal object. You can use this in URLs to identify the object.

  2. created

    The date and time when the object was created.

  3. type

    A field that indicates the type of Transaction that this object represents. For a Withdrawal, this is set to withdrawal.

  4. status

    A field indicating the current status of the transaction. This field changes as you interact with the object.

  5. memo

    A technical field that the API sets as it processes the Withdrawal.

  6. amount

    The amount to withdraw, denoted in the user's local currency.

  7. fiat_amount

    The amount requested in the Withdrawal, denoted in the fiat currency indicated in the currency field.

  8. withdraw_account_id

    The ID of the account to withdraw fiat currency from.

List Withdrawals

GET/api/1/withdraws

The List Withdrawals method returns details of all Withdrawals associated with the logged-in user.

Authenticated method.

API Example

Request:

GET /api/1/withdraws HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

[
    {
        "id": "10470ab8-644c-47a2-9f10-839dc5649de8",
        "created": "2017-06-26T23:32:56.899925+01:00",
        "type": "withdrawal",
        "status": "starting",
        "memo": "Walking about Gotham money.",
        "amount": {
            "amount": "0",
            "currency": "btc"
        },
        "fiat_amount": {
            "amount": "500.00",
            "currency": "usd"
        },
        withdraw_account_id: "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2"
    }
]

Get Withdrawal

GET/api/1/withdraws/{withdrawal_id}

The Get Withdrawal method displays the details of a Withdrawal object associated with the currently logged-in user.

You must specify the ID of the Withdrawal object in the URL.

Authenticated method.

API Example

Request:

GET /api/1/withdraws/10470ab8-644c-47a2-9f10-839dc5649de8 HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "10470ab8-644c-47a2-9f10-839dc5649de8",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "withdrawal",
    "status": "starting",
    "memo": "Walking about Gotham money.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    withdraw_account_id: "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2"
}

Create Withdrawal

POST/api/1/withdraws

The Create Withdrawal method creates a new Withdrawal object. This object starts the process of withdrawing fiat currency from one of the accounts owned by the currently logged-in user.

You must supply the details of the Withdrawal in the request body.

Authenticated method.

  1. account_id

    The ID of the account to withdraw fiat currency from.

  2. amount

    The amount to withdraw, denoted in the fiat currency indicated in the currency field.

  3. currency

    The fiat currency used to describe value in the amount field.

  4. memo

    A note describing the purpose or nature of the transaction.

API Example

Request:

POST /api/1/withdraws HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json

{
    "account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "amount": "500.00",
    "currency": "USD",
    "memo": "Walking about Gotham money."
}

Response:

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

{
    "id": "10470ab8-644c-47a2-9f10-839dc5649de8",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "withdrawal",
    "status": "starting",
    "memo": "Walking about Gotham money.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    withdraw_account_id: "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2"
}

Confirm Withdrawal

POST/api/1/withdraws/{withdrawal_id}/confirm

The Confirm Withdrawal method ensures that the logged-in user wishes to proceed with a 'Withdrawal' transaction, and starts the transaction.

You must specify the ID of the withdrawal in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/withdraws/10470ab8-644c-47a2-9f10-839dc5649de8/confirm HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "10470ab8-644c-47a2-9f10-839dc5649de8",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "withdrawal",
    "status": "confirmed",
    "memo": "Walking about Gotham money.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    withdraw_account_id: "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2"
}

Complete Withdrawal

POST/api/1/withdraws/{withdrawal_id}/complete

The Complete Withdrawal method lets an administrator finish a withdrawal operation.

You must specify the ID of the withdrawal in the URL.

Authenticated method. Only administrative users can call this method.

API Example

Request:

        POST /api/1/withdraws/10470ab8-644c-47a2-9f10-839dc5649de8/complete HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id": "10470ab8-644c-47a2-9f10-839dc5649de8",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "withdrawal",
    "status": "completed",
    "memo": "Walking about Gotham money.",
    "amount": {
        "amount": "0",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "500.00",
        "currency": "usd"
    },
    withdraw_account_id: "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2"
}

Transfer

The Transfer methods let you transfer both fiat and digital currencies between accounts that you own.

'Transfer' Object Fields

  1. id

    The unique ID of the Transfer object. You can use this in URLs to identify the object.

  2. created

    The date and time when the object was created.

  3. type

    A field that indicates the type of Transaction that this object represents. For a Transfer, this is set to transfer.

  4. status

    A field indicating the current status of the transaction. This field changes as you interact with the object.

  5. memo

    A technical field that the API sets as it processes the Deposit.

  6. amount

    The amount to transfer, denoted in a cryptocurrency.

  7. fiat_amount

    The amount to transfer, denoted in the user’s local currency.

  8. sender_id

    The ID of the user sending the Transfer.

  9. sender_account_id

    The ID of the account to take the funds from.

  10. recipient_id

    The ID of the user receiving the Transfer.

  11. recipient_account_id

    The ID of the account to deposit the money into.

Create Transfer

POST/api/1/transfers

The Create Transfer method creates a new Transfer object.

You must supply the details of the Transfer in the request body, including the sending and receiving account identifiers, the currency, the amount, and a description of the transfer.

Authenticated method.

  1. sender_account_id

    The ID of the account to take the funds from.

  2. recipient_account_id

    The ID of the account to deposit the money into.

  3. amount

    The amount to transfer, denoted in the currency indicated in the currency field.

  4. currency

    The currency for the transaction.

  5. memo

    A note describing the purpose or nature of the transaction.

API Example

Request:

POST /api/1/transfers HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json

{
    "sender_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "recipient_account_id": "9eb74045-f996-4e5d-b68b-4caced45e9ef",
    "amount": "700.00",
    "currency": "USD",
    "memo": "Moving Batmobile insurance money"
}

Response:

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

{
    "id:" "a42375b2-5272-4b3c-b264-a167f22bd41b",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "transfer",
    "status": "starting",
    "memo": "Moving Batmobile insurance money",
    "amount": {
        "amount": "0.00",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "700.00",
        "currency": "usd"
    },
    "sender_id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "sender_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "recipient_id": "36a0fe8f-bdfb-43a9-a457-6edd98cf9b88",
    "recipient_account_id": "4109c993-71d5-4f9d-b876-7b171ae36e36"
}

Confirm Transfer

POST/api/1/transfers/{transfer_id}/confirm

The Confirm Transfer method ensures that the logged-in user wishes to proceed with a 'transfer' transaction, and starts the transaction.

You must specify the transfer ID in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/transfers/a42375b2-5272-4b3c-b264-a167f22bd41b/confirm HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id:" "a42375b2-5272-4b3c-b264-a167f22bd41b",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "type": "transfer",
    "status": "confirmed",
    "memo": "Moving Batmobile insurance money",
    "amount": {
        "amount": "0.00",
        "currency": "btc"
    },
    "fiat_amount": {
        "amount": "700.00",
        "currency": "usd"
    },
    "sender_id": "e912fa15-4789-449b-9441-62e91eb10a9b",
    "sender_account_id": "66aba5d7-30c0-4f5c-a5aa-b04aa75e1fe2",
    "recipient_id": "36a0fe8f-bdfb-43a9-a457-6edd98cf9b88",
    "recipient_account_id": "4109c993-71d5-4f9d-b876-7b171ae36e36"
}

Order

The Order methods let you specify and place an order into the order book of the exchange.

List Orders

GET/api/1/orders

The List Orders method returns a list of transactions associated with a particular account.

The JSON response is an array of individual Order objects.

Authenticated method.

API Example

Request:

GET /api/1/orders HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

[
    {
        "id:" "eee06225-db68-4975-a964-7458e224f3c7",
        "created": "2017-06-26T23:32:56.899925+01:00",
        "completed": "2017-06-26T23:40:10.295526+01:00",
        "canceled": "2017-06-26T23:43:16.217526+01:00",
        "type": "limit",
        "side": "ask",
        "quantity": "20.13",
        "price": "200",
        "user_id": "a893583f-9bf1-4264-aeea-ee13fc26286"
    },
    {
        "id:" "ae4ff4bc-8fb5-4202-a4ed-12f1869b0700",
        "created": "2017-06-24T12:45:12.183576+01:00",
        "completed": "2017-06-25T06:34:15.571348+01:00",
        "canceled": "2017-06-26T23:43:16.217526+01:00",
        "type": "limit",
        "side": "ask",
        "quantity": "40.26",
        "price": "400",
        "user_id": "a893583f-9bf1-4264-aeea-ee13fc26286"
    }
]

Create Order

POST/api/1/orders

The Create Order method creates a new Order object.

You must supply the details of the Order in the request body.

Authenticated method.

  1. product

    The currency pair that the exchange wants to perform. Only the value BTCUSD (bitcoin to USD exchange) is currently supported.

  2. type

    This field represents the type of order.

    Valid values are:

    • limit

      A Limit order lets you set your desired price, and the quantity you want to buy. As soon as the Rain API finds a matching order in the order book, it fulfills your order.

      If no orders are found in the order book - either because the price does not meet the requirement that you specified in the price attribute, or because the order book does not have enough quantity available, then the Rain API does not proceed with the order.

    • market

      A Market order only lets you specify the quantity of currency you want to buy. The Rain API then fulfills the order immediately at the best price it can find.

  3. side

    This field determines the side of the transaction that this order represents.

    Valid values are:

    • buy

      A 'buy' order represents an intention to buy.

    • sell

      An 'sell' order represents an intention to sell.

  4. quantity

    When the side parameter is set to buy, this field represents the quantity of the virtual currency that the exchange wants to buy.

    When the side parameter is set to sell, this field represents the quantity of the virtual currency that the exchange wants to sell.

  5. price

    The price to buy or sell the cryptocurrency at.

  6. withdraw_account_id

    The ID of the account to withdraw the sold currency from. In a buy order, this is the virtual currency account. In an sell order, this is the fiat currency account.

  7. deposit_account_id

    The ID of the account to deposit the fiat currency into.

API Example

Request:

POST /api/1/orders HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json

{
    "product": "BTCUSD",
    "type": "limit",
    "side": "buy",
    "quantity": "20.13",
    "price": "200",
    "withdraw_account_id": "e96e3f1b-5a0e-47ed-8f09-afd2e99ff68d",
    "deposit_account_id": "e383fc64-ff7e-4df9-a2b7-c14254625b18"
}

Response:

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

{
    "id:" "eee06225-db68-4975-a964-7458e224f3c7",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "completed": "2017-06-26T23:40:10.295526+01:00",
    "canceled": "2017-06-26T23:43:16.217526+01:00",
    "type": "limit",
    "side": "buy",
    "quantity": "20.13",
    "price": "200",
    "user_id": "a893583f-9bf1-4264-aeea-ee13fc26286"
}

Get Order

GET/api/1/orders/{order_id}

The Get Order method displays the details of an Order object.

You must specify the ID of the Order object in the URL.

Authenticated method.

API Example

Request:

GET /api/1/orders/eee06225-db68-4975-a964-7458e224f3c7 HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id:" "eee06225-db68-4975-a964-7458e224f3c7",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "completed": "2017-06-26T23:40:10.295526+01:00",
    "canceled": "2017-06-26T23:43:16.217526+01:00",
    "type": "limit",
    "side": "ask",
    "quantity": "20.13",
    "price": "200",
    "user_id": "a893583f-9bf1-4264-aeea-ee13fc26286"
}

Cancel Order

POST/api/1/orders/{order_id}/cancel

The Cancel Order method lets you delete an outstanding Order object.

You must specify the ID of the Order object in the URL.

Authenticated method.

API Example

Request:

        POST /api/1/orders/eee06225-db68-4975-a964-7458e224f3c7/delete HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=

Response:

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

{
    "id:" "eee06225-db68-4975-a964-7458e224f3c7",
    "created": "2017-06-26T23:32:56.899925+01:00",
    "completed": "2017-06-26T23:40:10.295526+01:00",
    "canceled": "2017-06-26T23:43:16.217526+01:00",
    "type": "limit",
    "side": "ask",
    "quantity": "20.13",
    "price": "200",
    "user_id": "a893583f-9bf1-4264-aeea-ee13fc26286"
}

Price

The Price methods let you access the latest prices on the exchange and create a price at which the exchange is willing to buy or sell cryptocurrency. It is expressed in a fiat currency.

Get Latest Price

GET/api/1/prices/:product

The Get Latest Price method allows us to get the latest price of a cryptocurrency relative to a fiat currency on the exchange. This endpoint is most commonly used to display a quote to the user during a buy/sell operation or for showing a global spot price.

API Example

Request:

GET /api/1/prices/BTCUSD HTTP/1.1

Response:

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

{
    "id": "8c941aea-6a09-436c-9bca-56ca8ac6c51c",
    "created": "2017-07-11T21:31:26.435435Z",
    "base_currency": "btc",
    "ref_currency": "usd",
    "buy_price": {
        "amount": "100.00",
        "currency": "usd"
    },
    "sell_price": {
        "amount": "100.00",
        "currency": "usd"
    },
    "spot_price": {
        "amount": "100.00",
        "currency": "usd"
    }
}

Create Price

POST/api/1/prices

The Create Price method lets an administrator create a new Price for a cryptocurrency at a particular rate in fiat currency.

You must specify the details of the price in the request body, including the base cryptocurrency, the reference fiat currency, and the prices you want to create (including the 'buy' price, the 'sell' price, and the 'spot' price).

Authenticated method. Only administrative users can call this method.

  1. base_currency

    The cryptocurrency that should form the basis of the price. You must set this to btc.

  2. ref_currency

    The fiat currency that the price is expressed in.

  3. buy_price

    The price at which the exchange is willing to buy one unit of the cryptocurrency indicated in base_currency. Express the amount in the currency set in ref_currency.

  4. sell_price

    The price at which the exchange is willing to sell one unit of the cryptocurrency indicated in base_currency. Express the amount in the currency set in ref_currency.

  5. spot_price

    The spot price of the cryptocurrency. Express the amount in the currency set in ref_currency.

API Example

Request:

POST /api/1/prices HTTP/1.1
Authorization: 6duT-1qzJXL8EiAGGLA3FOVq95nfo_jjOxKbKLDRJV2=
Content-Type: application/json
{
    "base_currency": "btc",
    "ref_currency": "usd",
    "buy_price": "100.00",
    "sell_price": "100.00",
    "spot_price": "100.00"
}

Response:

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

{
    "id": "8c941aea-6a09-436c-9bca-56ca8ac6c51c",
    "created": "2017-07-11T21:31:26.435435Z",
    "base_currency": "btc",
    "ref_currency": "usd",
    "buy_price": {
        "amount": "100.00",
        "currency": "usd"
    },
    "sell_price": {
        "amount": "100.00",
        "currency": "usd"
    },
    "spot_price": {
        "amount": "100.00",
        "currency": "usd"
    }
}