CryptoExchange API :: Escrow API Basics
Escrow API Basics
The Escrow API allows you to create transactions between yourself and another party, or between two other parties. It also allows you to update details on your account, such as setting your disbursement method.
Base URL
All URLs referenced in the documentation have the following base url: https://cryptoexchange.com/api/v1/escrow/partner/ The Escrow API is served over HTTPS and unencrypted HTTP connections are not supported.
Authentication
The Escrow API supports basic authentication as defined in RFC2617. There are two supported methods for authentication, using your username and password and using API keys. While using a user name and password allows you to start using the API immediately, all of the examples in the documentation are using API keys. We recommend that users switch to using API keys in production before deploying their implementations.
Most clients will implement basic authentication for you, however if you need to implement it yourself, you need to base64 encode your email address and password or API key seperated by a colon. For example, if your email address is [email protected] and your API key is myhorseisamazing, then you would base64 encode [email protected]:myhorseisamazing, which would result in a2VhbnUucmVldmVzQGVzY3Jvdy5jb206bXlob3JzZWlzYW1hemluZw==. Using this value, you would then pass the Authorization header with the value: Bearer a2VhbnUucmVldmVzQGVzY3Jvdy5jb206bXlob3JzZWlzYW1hemluZw==
Example: Authentication with email address and password
This is the easiest method of authentication you can use with the Escrow API as you can start using it as soon as you have signed up for an Cryptoexchange.com account. However, this tightly couples any integration with us that you have to your user credentials. For this reason, it is recommended that you use API keys, which you can have multiple of.
Consider this example where your Cryptoexchange.com email address is [email protected], and your Cryptoexchange.com password isEscrow1234. The code snippets below show how you can use your chosen client to perform authentication.
curl 'https://cryptoexchange.com/api/v1/escrow/partner/transaction/44165ddd-e469-415f-a7f0-e7f5a5c316e6' \
-H 'Authorization:Bearer your-api-key' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://cryptoexchange.com/api/v1/escrow/partner/transaction/44165ddd-e469-415f-a7f0-e7f5a5c316e6',
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization:Bearer your-api-key',
'Content-Type: application/json'
)
));
$output = curl_exec($curl);
echo $output;
curl_close($curl);
Note that the rest of the documentation and guides will simply include email-address and api-key for the examples. You must include your authentication header for all requests.
Example: Authentication with API keys
From within the account settings page, you can generate API keys associated with your account. This is preferable to using your user name and password, as it allows you to recycle your credentials without changing the password on your account. Using an API key is almost identical to using a username and password for authentication. Simply provide your API key as your password and we will handle the rest.
Consider this example where your Cryptoexchange.com email address is [email protected], and you have created an API key with value 99_ABCDefGHIKFD93423489023eejkfjkdjkjkjkjkjkjkabcdefgyz4534343kdlPp. The code snippets below show how you can use your chosen client to perform authentication.
curl 'https://cryptoexchange.com/api/v1/escrow/partner/customer/123' \
-H 'Authorization:Bearer your-api-key' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://cryptoexchange.com/api/v1/escrow/partner/customer/123',
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization:Bearer your-api-key',
'Content-Type: application/json'
),
));
$output = curl_exec($curl);
echo $output;
curl_close($curl);
Note that the rest of the documentation and guides will simply include email-address and api-key for the examples. You must include your authentication header for all requests.
Rate limiting
In order to provide a stable platform to all users of the Escrow API, we enforce rate limiting on all Escrow API endpoints. The rate limiting is implemented per endpoint and the number of remaining requests you have is returned in the HTTP header RateLimit-Remaining on every API call you make. If you require higher rate limits, please contact us and we will consider your use case.
Errors
We do our best to ensure that the Escrow API is error free, however sometimes we will have to return an error. If an error occurs, we will always set the HTTP response code appropriately. See below for a list of HTTP codes we return.
HTTP Code | Description |
---|---|
200 | The API request was performed successfully |
400 | The client submitted a bad request |
401 | You are trying to perform an action that requires you to be authenticated |
403 | You are trying to perform an action that you are not permitted to perform |
404 | You are trying to access a resource that doesn`t exist |
422 | Your request was malformed |
429 | You have performed too many requests and have been rate limited. |
500 | There was an unexpected server error |