Skip to main content
POST
/
requests
/
sell
Creates an asset sell request
curl --request POST \
  --url https://api.pipevest.com/v1/requests/sell \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Digest: <content-digest>' \
  --header 'Content-Type: application/json' \
  --header 'Signature: <signature>' \
  --header 'Signature-Input: <signature-input>' \
  --header 'X-Client-Id: <x-client-id>' \
  --header 'X-Idempotency-Id: <x-idempotency-id>' \
  --data '
{
  "customerId": 123456,
  "assetId": 123456,
  "currency": "ZK",
  "sellAmount": 1550,
  "sellPercentage": 50,
  "isRecurring": false,
  "schedule": "ONCE"
}
'
import requests

url = "https://api.pipevest.com/v1/requests/sell"

payload = {
"customerId": 123456,
"assetId": 123456,
"currency": "ZK",
"sellAmount": 1550,
"sellPercentage": 50,
"isRecurring": False,
"schedule": "ONCE"
}
headers = {
"Content-Digest": "<content-digest>",
"X-Idempotency-Id": "<x-idempotency-id>",
"Signature": "<signature>",
"Signature-Input": "<signature-input>",
"X-Client-Id": "<x-client-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {
'Content-Digest': '<content-digest>',
'X-Idempotency-Id': '<x-idempotency-id>',
Signature: '<signature>',
'Signature-Input': '<signature-input>',
'X-Client-Id': '<x-client-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customerId: 123456,
assetId: 123456,
currency: 'ZK',
sellAmount: 1550,
sellPercentage: 50,
isRecurring: false,
schedule: 'ONCE'
})
};

fetch('https://api.pipevest.com/v1/requests/sell', 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.pipevest.com/v1/requests/sell",
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([
'customerId' => 123456,
'assetId' => 123456,
'currency' => 'ZK',
'sellAmount' => 1550,
'sellPercentage' => 50,
'isRecurring' => false,
'schedule' => 'ONCE'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Digest: <content-digest>",
"Content-Type: application/json",
"Signature: <signature>",
"Signature-Input: <signature-input>",
"X-Client-Id: <x-client-id>",
"X-Idempotency-Id: <x-idempotency-id>"
],
]);

$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.pipevest.com/v1/requests/sell"

payload := strings.NewReader("{\n \"customerId\": 123456,\n \"assetId\": 123456,\n \"currency\": \"ZK\",\n \"sellAmount\": 1550,\n \"sellPercentage\": 50,\n \"isRecurring\": false,\n \"schedule\": \"ONCE\"\n}")

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

req.Header.Add("Content-Digest", "<content-digest>")
req.Header.Add("X-Idempotency-Id", "<x-idempotency-id>")
req.Header.Add("Signature", "<signature>")
req.Header.Add("Signature-Input", "<signature-input>")
req.Header.Add("X-Client-Id", "<x-client-id>")
req.Header.Add("Authorization", "Bearer <token>")
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.pipevest.com/v1/requests/sell")
.header("Content-Digest", "<content-digest>")
.header("X-Idempotency-Id", "<x-idempotency-id>")
.header("Signature", "<signature>")
.header("Signature-Input", "<signature-input>")
.header("X-Client-Id", "<x-client-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customerId\": 123456,\n \"assetId\": 123456,\n \"currency\": \"ZK\",\n \"sellAmount\": 1550,\n \"sellPercentage\": 50,\n \"isRecurring\": false,\n \"schedule\": \"ONCE\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pipevest.com/v1/requests/sell")

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

request = Net::HTTP::Post.new(url)
request["Content-Digest"] = '<content-digest>'
request["X-Idempotency-Id"] = '<x-idempotency-id>'
request["Signature"] = '<signature>'
request["Signature-Input"] = '<signature-input>'
request["X-Client-Id"] = '<x-client-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customerId\": 123456,\n \"assetId\": 123456,\n \"currency\": \"ZK\",\n \"sellAmount\": 1550,\n \"sellPercentage\": 50,\n \"isRecurring\": false,\n \"schedule\": \"ONCE\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "requestId": 123456,
    "assetId": 123456,
    "customerId": 123456,
    "symbol": "APPL",
    "requestType": "SELL",
    "status": "PENDING",
    "currency": "ZK",
    "isRecurring": false,
    "schedule": "ONCE",
    "sellAmount": 1550,
    "sellPercentage": 50,
    "createdAt": 1234567890,
    "updatedAt": 1234567890
  },
  "code": 201,
  "message": "Created"
}
{
"code": 401,
"message": "Unauthorized"
}
{
"code": 404,
"message": "Not Found"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Content-Digest
string
required

Base64 encoded sha-512 hash of the http message body.

This key isn't not required for GET and DELETE requests.

Learn how to generate content digest

Example:

"sha-512=:RK/0qy18MlBSVnWgjwz6lZEWjP/lF5HF9bvEF8FabDg=:"

X-Idempotency-Id
string
required

Unique identifier passed into each a mutable request (i.e POST, PUT, PATCH, DELETE)

This key isn't not required for GET requests

Example:

"01937261-e216-754f-99ba-c1170d65dd28"

Signature
string
required

Base64 encoded signed hash of the http message request components.

Learn how signatures work

Example:

"sig1=:OTEyMjY4...A5NTNDMEQ=:"

Signature-Input
string
required

An ordered list of components that make up the signature base. It is used to recompute and verify the Signature

Learn how signatures work

Example:

"sig1=(\"Content-Type\" \"Content-Digest\"...expires=<expires>"

X-Client-Id
string
required

Unique identifier assigned to the client

Example:

"client-id"

Body

application/json

Details used to create a sell asset request

Sell Request Payload

customerId
integer
required

Unique customer identifier

Example:

123456

assetId
integer
required

Unique asset identifier

Example:

123456

currency
enum<string>
required

Associated currency

Available options:
USD,
EUR,
ZK
Example:

"ZK"

sellAmount
integer

The total amount to sell from an asset or group of assets

Not requried, if sellPercentage is specified

Example:

1550

sellPercentage
integer

The percentage amount to sell

Not requried, if sellAmount is specified

Example:

50

isRecurring
boolean

Determines whether the request should be in recurring mode

Defaults to false

Refer to Requests documentation to better understand how recurring works

Example:

false

schedule
enum<string>

The recurring schedule in which the asset should be purchased or sold.

Defaults to ONCE

Available options:
ONCE,
DAILY,
WEEKLY,
BI_WEEKLY,
MONTHLY
Example:

"ONCE"

Response

Details of a created customer asset sell request

data
object
required

Sell request entity

code
string
required

Request response code

Example:

201

message
string
required

Request response message

Example:

"Created"