Skip to main content
POST
/
order
/
create
Create an exchange order
curl --request POST \
  --url https://api.privataswap.com/partner/v1/order/create \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "quote_id": "<string>",
  "address": "<string>",
  "extra_id": "<string>",
  "refund_address": "<string>",
  "refund_extra_id": "<string>",
  "refund_preference": {
    "default": "return_to_refund_address",
    "fallback_if_refund_address_missing": "manual_review"
  },
  "partner_order_ref": "<string>"
}
'
import requests

url = "https://api.privataswap.com/partner/v1/order/create"

payload = {
"quote_id": "<string>",
"address": "<string>",
"extra_id": "<string>",
"refund_address": "<string>",
"refund_extra_id": "<string>",
"refund_preference": {
"default": "return_to_refund_address",
"fallback_if_refund_address_missing": "manual_review"
},
"partner_order_ref": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quote_id: '<string>',
address: '<string>',
extra_id: '<string>',
refund_address: '<string>',
refund_extra_id: '<string>',
refund_preference: {
default: 'return_to_refund_address',
fallback_if_refund_address_missing: 'manual_review'
},
partner_order_ref: '<string>'
})
};

fetch('https://api.privataswap.com/partner/v1/order/create', 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.privataswap.com/partner/v1/order/create",
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([
'quote_id' => '<string>',
'address' => '<string>',
'extra_id' => '<string>',
'refund_address' => '<string>',
'refund_extra_id' => '<string>',
'refund_preference' => [
'default' => 'return_to_refund_address',
'fallback_if_refund_address_missing' => 'manual_review'
],
'partner_order_ref' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$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.privataswap.com/partner/v1/order/create"

payload := strings.NewReader("{\n \"quote_id\": \"<string>\",\n \"address\": \"<string>\",\n \"extra_id\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"refund_extra_id\": \"<string>\",\n \"refund_preference\": {\n \"default\": \"return_to_refund_address\",\n \"fallback_if_refund_address_missing\": \"manual_review\"\n },\n \"partner_order_ref\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
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.privataswap.com/partner/v1/order/create")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quote_id\": \"<string>\",\n \"address\": \"<string>\",\n \"extra_id\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"refund_extra_id\": \"<string>\",\n \"refund_preference\": {\n \"default\": \"return_to_refund_address\",\n \"fallback_if_refund_address_missing\": \"manual_review\"\n },\n \"partner_order_ref\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.privataswap.com/partner/v1/order/create")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quote_id\": \"<string>\",\n \"address\": \"<string>\",\n \"extra_id\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"refund_extra_id\": \"<string>\",\n \"refund_preference\": {\n \"default\": \"return_to_refund_address\",\n \"fallback_if_refund_address_missing\": \"manual_review\"\n },\n \"partner_order_ref\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "order_id": "prv-9f0e...",
  "provider_order_id": "<string>",
  "from": "<string>",
  "to": "<string>",
  "amount_from": "<string>",
  "amount_to_expected": "<string>",
  "amount_to_actual": "<string>",
  "deposit_address": "<string>",
  "deposit_extra_id": "<string>",
  "payout_address": "<string>",
  "failed_reason_message": "<string>",
  "refund_window_hours": 123,
  "refund_sla_hours": 123,
  "tx_in_hash": "<string>",
  "tx_out_hash": "<string>",
  "expires_at": "2023-11-07T05:31:56Z",
  "created_at": "2023-11-07T05:31:56Z",
  "tracking_url": "<string>",
  "timeline": [
    {
      "status": "<string>",
      "at": "2023-11-07T05:31:56Z"
    }
  ]
}
{
"error": {
"message": "<string>",
"request_id": "<string>"
}
}
{
"error": {
"message": "<string>",
"request_id": "<string>"
}
}

Authorizations

X-API-Key
string
header
required

Partner API key issued in the dashboard. Use pk_live_... in production, pk_test_... against sandbox.

Body

application/json
quote_id
string
required
address
string
required

Payout address.

extra_id
string | null

Memo for XRP/XLM/TON.

refund_address
string | null
refund_extra_id
string | null
refund_preference
object
partner_order_ref
string

Your internal id. Returned back in webhooks. Used for logical-dupe detection.

Response

Created

order_id
string
Example:

"prv-9f0e..."

provider_order_id
string
from
string
to
string
amount_from
string
amount_to_expected
string
amount_to_actual
string | null
deposit_address
string
deposit_extra_id
string | null
payout_address
string
status
enum<string>
Available options:
waiting_deposit,
confirming,
exchanging,
sending,
completed,
failed,
expired,
refund_required,
refunded,
manual_review
failed_reason_code
enum<string> | null
Available options:
kyt_block,
amount_out_of_range,
rate_changed,
provider_timeout,
provider_internal,
underpayment,
overpayment,
network_congestion,
unknown
failed_reason_message
string | null
refund_capability
enum<string>
Available options:
programmatic,
ticket,
none
refund_window_hours
integer | null
refund_sla_hours
integer | null
tx_in_hash
string | null
tx_out_hash
string | null
expires_at
string<date-time>
created_at
string<date-time>
tracking_url
string<uri>

Signed URL with embedded HMAC token. Do not modify.

timeline
object[]