Create Order
curl --request POST \
--url https://api.copper.co/platform/orders \
--header 'Content-Type: application/json' \
--data '
{
"amount": "0.1",
"baseCurrency": "BTC",
"externalOrderId": "<string>",
"orderType": "withdraw",
"portfolioId": "<string>",
"toPortfolioId": "<string>",
"description": "Withdrawal to my wallet",
"mainCurrency": "<string>"
}
'import requests
url = "https://api.copper.co/platform/orders"
payload = {
"amount": "0.1",
"baseCurrency": "BTC",
"externalOrderId": "<string>",
"orderType": "withdraw",
"portfolioId": "<string>",
"toPortfolioId": "<string>",
"description": "Withdrawal to my wallet",
"mainCurrency": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '0.1',
baseCurrency: 'BTC',
externalOrderId: '<string>',
orderType: 'withdraw',
portfolioId: '<string>',
toPortfolioId: '<string>',
description: 'Withdrawal to my wallet',
mainCurrency: '<string>'
})
};
fetch('https://api.copper.co/platform/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.copper.co/platform/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '0.1',
'baseCurrency' => 'BTC',
'externalOrderId' => '<string>',
'orderType' => 'withdraw',
'portfolioId' => '<string>',
'toPortfolioId' => '<string>',
'description' => 'Withdrawal to my wallet',
'mainCurrency' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.copper.co/platform/orders"
payload := strings.NewReader("{\n \"amount\": \"0.1\",\n \"baseCurrency\": \"BTC\",\n \"externalOrderId\": \"<string>\",\n \"orderType\": \"withdraw\",\n \"portfolioId\": \"<string>\",\n \"toPortfolioId\": \"<string>\",\n \"description\": \"Withdrawal to my wallet\",\n \"mainCurrency\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.copper.co/platform/orders")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"0.1\",\n \"baseCurrency\": \"BTC\",\n \"externalOrderId\": \"<string>\",\n \"orderType\": \"withdraw\",\n \"portfolioId\": \"<string>\",\n \"toPortfolioId\": \"<string>\",\n \"description\": \"Withdrawal to my wallet\",\n \"mainCurrency\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.copper.co/platform/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"0.1\",\n \"baseCurrency\": \"BTC\",\n \"externalOrderId\": \"<string>\",\n \"orderType\": \"withdraw\",\n \"portfolioId\": \"<string>\",\n \"toPortfolioId\": \"<string>\",\n \"description\": \"Withdrawal to my wallet\",\n \"mainCurrency\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"amount": "<string>",
"baseCurrency": "<string>",
"createdAt": "<string>",
"externalOrderId": "<string>",
"orderId": "<string>",
"orderType": "sell",
"portfolioId": "<string>",
"portfolioType": "custody",
"status": "new",
"createdBy": "<string>",
"extra": {
"availableCoSigners": [
"<string>"
],
"availableSnapshot": "<string>",
"balanceSnapshot": "<string>",
"blockchainTransactionType": "send",
"clearLoop": true,
"clearLoopExtra": {
"clearLoopExternalNetted": true,
"clearLoopSettlementId": "<string>"
},
"clientAccountId": "<string>",
"coSigners": [
"<string>"
],
"coSignersNumber": "<string>",
"confirmations": "<string>",
"counterpartyPortfolioId": "<string>",
"deliveryType": "free-of-payment",
"depositOrderId": "<string>",
"depositTargetId": "<string>",
"description": "<string>",
"estimatedFees": {
"fee": "<string>",
"feeCurrency": "<string>",
"baseFeePerGas": "<string>",
"estimatedTime": "<string>",
"feePerByte": {},
"gasLimit": {},
"gasPriceGwei": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"reportingCurrencyRate": "<string>",
"transactionBytes": "<string>"
},
"externalBroadcast": true,
"feeLevel": "low",
"fees": [
{
"fee": "<string>",
"feeCurrency": "<string>",
"baseFeePerGas": "<string>",
"estimatedTime": "<string>",
"feePerByte": {},
"gasLimit": {},
"gasPriceGwei": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"reportingCurrencyRate": "<string>",
"transactionBytes": "<string>"
}
],
"fromAddresses": [
"<string>"
],
"fromCounterpartyId": "<string>",
"fromCryptoAddress": {
"address": "<string>",
"addressType": "externally-owned-account",
"createdAt": "<string>",
"createdBy": "<string>",
"cryptoAddressId": "<string>",
"currency": "<string>",
"isWhitelist": true,
"name": "<string>",
"_embedded": {
"currencyConfigurations": [
{
"createdAt": "<string>",
"createdBy": "<string>",
"cryptoAddressId": "<string>",
"currency": "<string>",
"currencyConfigurationId": "<string>",
"isWhitelist": true,
"extra": {},
"lastUsedAt": "<string>",
"portfolioIds": [
"<string>"
],
"updatedAt": "<string>",
"updatedBy": "<string>"
}
]
},
"acceptTokens": true,
"addressTags": [],
"category": "smart-contract",
"extra": {},
"lastUsedAt": "<string>",
"mainCurrency": "<string>",
"memo": "<string>",
"organizationId": "<string>",
"portfolioIds": [
"<string>"
],
"updatedAt": "<string>",
"updatedBy": "<string>"
},
"fromCryptoAddressId": "<string>",
"fromPortfolioId": "<string>",
"includeFeeInWithdraw": true,
"invoiceId": "<string>",
"marketPrice": "<string>",
"memo": "<string>",
"nextTransferTo": [
{
"targetType": "external",
"cryptoAddressId": "<string>",
"portfolioId": "<string>"
}
],
"originalDepositAmount": "<string>",
"partSigned": {},
"payload": "<string>",
"payloads": [
"<string>"
],
"reportingCurrencyRate": "<string>",
"reportingQuoteCurrencyRate": "<string>",
"signed": {},
"spenderAddress": "<string>",
"terminatedReportingCurrencyRate": "<string>",
"toAddress": "<string>",
"toCounterpartyId": "<string>",
"toCryptoAddressId": "<string>",
"toInvoiceId": "<string>",
"toLendingInvoiceId": "<string>",
"toPortfolioId": "<string>",
"totalQuoteAmount": "<string>",
"transactionId": "<string>",
"transactionRequest": {},
"transferAmount": "<string>",
"transferChainId": "<string>",
"transferDepositTargetId": "<string>",
"transferFees": "<string>",
"transferFeesCurrency": "<string>",
"transferTransactionId": "<string>",
"withdrawFee": "<string>",
"withdrawOrderId": "<string>"
},
"limitType": "otc",
"mainCurrency": "<string>",
"organizationId": "<string>",
"quoteCurrency": "<string>",
"quoteMainCurrency": "<string>",
"terminatedAt": "<string>",
"updatedAt": "<string>"
}{
"error": "bad-request",
"message": "<string>"
}{
"error": "forbidden",
"message": "<string>"
}{
"error": "conflict",
"message": "<string>"
}ClearLoop
Delegate (lock) and transfer funds
POST
/
orders
Create Order
curl --request POST \
--url https://api.copper.co/platform/orders \
--header 'Content-Type: application/json' \
--data '
{
"amount": "0.1",
"baseCurrency": "BTC",
"externalOrderId": "<string>",
"orderType": "withdraw",
"portfolioId": "<string>",
"toPortfolioId": "<string>",
"description": "Withdrawal to my wallet",
"mainCurrency": "<string>"
}
'import requests
url = "https://api.copper.co/platform/orders"
payload = {
"amount": "0.1",
"baseCurrency": "BTC",
"externalOrderId": "<string>",
"orderType": "withdraw",
"portfolioId": "<string>",
"toPortfolioId": "<string>",
"description": "Withdrawal to my wallet",
"mainCurrency": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '0.1',
baseCurrency: 'BTC',
externalOrderId: '<string>',
orderType: 'withdraw',
portfolioId: '<string>',
toPortfolioId: '<string>',
description: 'Withdrawal to my wallet',
mainCurrency: '<string>'
})
};
fetch('https://api.copper.co/platform/orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.copper.co/platform/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '0.1',
'baseCurrency' => 'BTC',
'externalOrderId' => '<string>',
'orderType' => 'withdraw',
'portfolioId' => '<string>',
'toPortfolioId' => '<string>',
'description' => 'Withdrawal to my wallet',
'mainCurrency' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.copper.co/platform/orders"
payload := strings.NewReader("{\n \"amount\": \"0.1\",\n \"baseCurrency\": \"BTC\",\n \"externalOrderId\": \"<string>\",\n \"orderType\": \"withdraw\",\n \"portfolioId\": \"<string>\",\n \"toPortfolioId\": \"<string>\",\n \"description\": \"Withdrawal to my wallet\",\n \"mainCurrency\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.copper.co/platform/orders")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"0.1\",\n \"baseCurrency\": \"BTC\",\n \"externalOrderId\": \"<string>\",\n \"orderType\": \"withdraw\",\n \"portfolioId\": \"<string>\",\n \"toPortfolioId\": \"<string>\",\n \"description\": \"Withdrawal to my wallet\",\n \"mainCurrency\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.copper.co/platform/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"0.1\",\n \"baseCurrency\": \"BTC\",\n \"externalOrderId\": \"<string>\",\n \"orderType\": \"withdraw\",\n \"portfolioId\": \"<string>\",\n \"toPortfolioId\": \"<string>\",\n \"description\": \"Withdrawal to my wallet\",\n \"mainCurrency\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"amount": "<string>",
"baseCurrency": "<string>",
"createdAt": "<string>",
"externalOrderId": "<string>",
"orderId": "<string>",
"orderType": "sell",
"portfolioId": "<string>",
"portfolioType": "custody",
"status": "new",
"createdBy": "<string>",
"extra": {
"availableCoSigners": [
"<string>"
],
"availableSnapshot": "<string>",
"balanceSnapshot": "<string>",
"blockchainTransactionType": "send",
"clearLoop": true,
"clearLoopExtra": {
"clearLoopExternalNetted": true,
"clearLoopSettlementId": "<string>"
},
"clientAccountId": "<string>",
"coSigners": [
"<string>"
],
"coSignersNumber": "<string>",
"confirmations": "<string>",
"counterpartyPortfolioId": "<string>",
"deliveryType": "free-of-payment",
"depositOrderId": "<string>",
"depositTargetId": "<string>",
"description": "<string>",
"estimatedFees": {
"fee": "<string>",
"feeCurrency": "<string>",
"baseFeePerGas": "<string>",
"estimatedTime": "<string>",
"feePerByte": {},
"gasLimit": {},
"gasPriceGwei": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"reportingCurrencyRate": "<string>",
"transactionBytes": "<string>"
},
"externalBroadcast": true,
"feeLevel": "low",
"fees": [
{
"fee": "<string>",
"feeCurrency": "<string>",
"baseFeePerGas": "<string>",
"estimatedTime": "<string>",
"feePerByte": {},
"gasLimit": {},
"gasPriceGwei": "<string>",
"maxFeePerGas": "<string>",
"maxPriorityFeePerGas": "<string>",
"reportingCurrencyRate": "<string>",
"transactionBytes": "<string>"
}
],
"fromAddresses": [
"<string>"
],
"fromCounterpartyId": "<string>",
"fromCryptoAddress": {
"address": "<string>",
"addressType": "externally-owned-account",
"createdAt": "<string>",
"createdBy": "<string>",
"cryptoAddressId": "<string>",
"currency": "<string>",
"isWhitelist": true,
"name": "<string>",
"_embedded": {
"currencyConfigurations": [
{
"createdAt": "<string>",
"createdBy": "<string>",
"cryptoAddressId": "<string>",
"currency": "<string>",
"currencyConfigurationId": "<string>",
"isWhitelist": true,
"extra": {},
"lastUsedAt": "<string>",
"portfolioIds": [
"<string>"
],
"updatedAt": "<string>",
"updatedBy": "<string>"
}
]
},
"acceptTokens": true,
"addressTags": [],
"category": "smart-contract",
"extra": {},
"lastUsedAt": "<string>",
"mainCurrency": "<string>",
"memo": "<string>",
"organizationId": "<string>",
"portfolioIds": [
"<string>"
],
"updatedAt": "<string>",
"updatedBy": "<string>"
},
"fromCryptoAddressId": "<string>",
"fromPortfolioId": "<string>",
"includeFeeInWithdraw": true,
"invoiceId": "<string>",
"marketPrice": "<string>",
"memo": "<string>",
"nextTransferTo": [
{
"targetType": "external",
"cryptoAddressId": "<string>",
"portfolioId": "<string>"
}
],
"originalDepositAmount": "<string>",
"partSigned": {},
"payload": "<string>",
"payloads": [
"<string>"
],
"reportingCurrencyRate": "<string>",
"reportingQuoteCurrencyRate": "<string>",
"signed": {},
"spenderAddress": "<string>",
"terminatedReportingCurrencyRate": "<string>",
"toAddress": "<string>",
"toCounterpartyId": "<string>",
"toCryptoAddressId": "<string>",
"toInvoiceId": "<string>",
"toLendingInvoiceId": "<string>",
"toPortfolioId": "<string>",
"totalQuoteAmount": "<string>",
"transactionId": "<string>",
"transactionRequest": {},
"transferAmount": "<string>",
"transferChainId": "<string>",
"transferDepositTargetId": "<string>",
"transferFees": "<string>",
"transferFeesCurrency": "<string>",
"transferTransactionId": "<string>",
"withdrawFee": "<string>",
"withdrawOrderId": "<string>"
},
"limitType": "otc",
"mainCurrency": "<string>",
"organizationId": "<string>",
"quoteCurrency": "<string>",
"quoteMainCurrency": "<string>",
"terminatedAt": "<string>",
"updatedAt": "<string>"
}{
"error": "bad-request",
"message": "<string>"
}{
"error": "forbidden",
"message": "<string>"
}{
"error": "conflict",
"message": "<string>"
}Delegate (lock) funds to an exchange
You can delegate funds to an exchange on the ClearLoop Network using the Copper user interface or API. When funds are delegated, they are locked in the client’s Copper Trading Account and credited to the exchange account. Two orders are created as a result:- Withdrawal order in the Trading portfolio, containing
isClearLoopDelegationunder orderextra. - Deposit order in the ClearLoop portfolio.
Both orders are linked under order extra by withdrawOrderId and depositOrderId.
Note that the terms “account” and “transaction” in the user interface correspond to the terms “portfolio” and “order” in the API and codebase.
To delegate funds to a ClearLoop exchange, create an order with the following parameters, where:
-
portfolioIdis the ID of the Trading Account. -
toPortfolioIdis the ID of a ClearLoop Settlement Account that is bound to the exchange.
For an example of a ClearLoop accounts structure, see Connect Exchange Account.
Transfer funds between the main exchange account and subaccounts
Once the funds are delegated to an exchange and automatically credited to your main exchange account, you can transfer funds to exchange sub-accounts. In that case,portfolioId is the ID of the main exchange account and toPortfolioId is the ID of the sub-account.
You cannot transfer to a sub-account from a ClearLoop Settlement Account.
Body
application/json
Response
OK
Order type. See details
Available options:
sell, buy, deposit, withdraw, multi-withdraw, wallet-message, retrieved-deposit, earn-reward, earn-shared-reward, claim-shared-reward, cross-chain-deposit, cross-chain-withdraw Portfolio type. See details
Available options:
custody, trading-vault, trading, external, clearloop Order status. Note: When an order has completed processing, it enters one of the final states and returns a 'terminal' status. terminalStatuses are: EXECUTED, CANCELED, LIQUIDATED, ERROR, BLOCKED, DECLINED, SUSPENDED, REJECTED. See details
Available options:
new, waiting-funds, reserving, reserved, queued, validating-funds, working, waiting-approve, co-sign-require, approved, processing, executed, canceled, rejecting, rejected, declining, declined, suspending, suspended, blocked, action-required, accepting, accepted, require-initializer-approve, waiting-counterparty-approve, require-counterparty-approve, ready-for-settlement, settled, part-signed-tx-added, full-signed-tx-added, rejected-part-signed-tx-added, rejected-full-signed-tx-added, accepted-part-signed-tx-added, accepted-full-signed-tx-added, awaiting-settlement, master-password-required, manual-resolving, error, pending-atomic-settlement-confirmation, atomic-settlement-reservation-completed, require-finalize, waiting-accept-deposit, waiting-reject-deposit Limit type of the order. See details
Available options:
otc, rfq Was this page helpful?