curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-returns \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-returns"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/purchase-returns', 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.exowpee.com/v1/catalog/purchase-returns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchase-returns"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.exowpee.com/v1/catalog/purchase-returns")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-returns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"vendor_id": "<string>",
"reference": "<string>",
"status": "<string>",
"vat_total": 123,
"replacement_expected": true,
"has_credit_note": true,
"vat_is_recoverable": true,
"returned_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>"
}{
"message": "<string>",
"errors": {}
}Create a purchase return
Prepares a return of goods to a supplier for a purchase or a confirmed reception, saying whether a replacement is expected or a credit note applies.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/purchase-returns \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.exowpee.com/v1/catalog/purchase-returns"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.exowpee.com/v1/catalog/purchase-returns', 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.exowpee.com/v1/catalog/purchase-returns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.exowpee.com/v1/catalog/purchase-returns"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.exowpee.com/v1/catalog/purchase-returns")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/purchase-returns")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"vendor_id": "<string>",
"reference": "<string>",
"status": "<string>",
"vat_total": 123,
"replacement_expected": true,
"has_credit_note": true,
"vat_is_recoverable": true,
"returned_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": "<array>"
}{
"message": "<string>",
"errors": {}
}purchase_returns.create
Conditions
- Either purchase_id or purchase_reception_id must be sent, never both.
- When a reception is given, it must be confirmed, and the return is attached to that reception’s purchase.
- The purchase must be pending or completed; a return cannot be created for a purchase in any other status.
- replacement_expected and has_credit_note are both required and cannot both be true: a supplier credit note cannot be combined with an expected replacement.
- A VAT amount above zero is refused unless has_credit_note is true.
- The reference, when sent, must be unique among the company’s supplier returns. Deleted returns are removed for good, so their references can be reused.
- When items are sent, there must be at least one, and each purchase_item_id must appear only once.
- Each item must belong to the chosen purchase, its unit must belong to the same item and measurement category and be active, and its quantity cannot exceed what was received and accepted (damaged quantities excluded) and not already taken by another return of the same purchase, draft or confirmed. When the return is attached to a reception, only that reception’s lines count.
- For a stock-tracked item, stock_sources are required; for an untracked item they are refused. Each source names either an asset or a group, never both, may not repeat, must be eligible for the company, and must hold enough stock that came from this purchase (and this reception when given). Source quantities must add up to the item quantity.
- When a replacement is expected, each item quantity must convert exactly into whole units of the purchase unit.
- Creates the return in draft status together with the items sent. Nothing leaves stock and the purchase balance is not changed until the return is confirmed.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Response mode. Default none; none answers 204 No Content.
none, resource Comma-separated JSON keys of the root resource (id is always rendered). Available: id, purchase_id, purchase_reception_id, vendor_id, reference, status, vat_total, replacement_expected, has_credit_note, vat_is_recoverable, returned_at, created_at, updated_at.
Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: items, items.purchaseItem, items.stockableUnit.
Response
Resource (only with response=resource).
Identifier of the supplier return (27-character KSUID string).
Identifier of the purchase the goods are returned to.
Identifier of the reception the return is attached to; null when the return was created for the whole purchase.
Identifier of the supplier, copied from the purchase.
Free reference of the return, unique among the company's purchase returns.
Lifecycle status: draft while it can still be edited or deleted, confirmed once the goods have left stock.
VAT on the supplier credit note in major units (the minor-unit amount divided by 10 to the power currency_exponent). 0 when there is no credit note.
True when the supplier is expected to send replacement goods; confirming then reopens the returned quantities for receiving.
True when the supplier issues a credit note for the returned goods; confirming then reduces the amount owed on the purchase. Cannot be true together with replacement_expected.
Whether the VAT of the purchase is recoverable, read from the purchase at rendering time; false when the purchase never set it.
Date and time the return was confirmed (ISO 8601); null while it is a draft.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Lines of the return. Present only when requested with include=items.