curl --request POST \
--url https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"peg_id": 33012
}
'import requests
url = "https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation"
payload = { "peg_id": 33012 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({peg_id: 33012})
};
fetch('https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation', 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://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation",
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([
'peg_id' => 33012
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation"
payload := strings.NewReader("{\n \"peg_id\": 33012\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"peg_id\": 33012\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"peg_id\": 33012\n}"
response = http.request(request)
puts response.read_body{
"data": {
"removed": true,
"foTornDown": true,
"quantityReversed": 10,
"partial": true,
"shipped": true
}
}{
"message": "<string>"
}{
"message": "<string>"
}Reverse (unallocate) an allocation peg
Reverse a single allocation peg created by the Purchase-to-Order workflow (the inverse of
POST /purchase-orders/{purchaseOrderId}/allocate), freeing the pegged stock so it reposts as
available against the incoming purchase order / on-hand supply.
The peg is identified by peg_id alone — on-hand and pre-order pegs are not tied to a purchase
order, so this is a top-level path rather than a PO-scoped one. Behavior depends on how far the
allocation has progressed:
- Pure reservation (nothing released) — the peg is deleted and availability recovers automatically.
- Pre-ship fulfillment — the generated fulfillment order (or just this line’s contribution to a consolidated fulfillment order) is unwound, returning the stock, then the peg is deleted.
- Already shipped — cannot be reversed here; the request fails with
422and the allocation must instead be reversed through a Return. If only part of the allocation shipped, the unfulfilled remainder is removed and the shipped portion is retained (partial: true).
Note: This endpoint is gated by the
PURCHASE_TO_ORDERfeature flag. Contact Luminous to have it enabled for your tenant.
curl --request POST \
--url https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"peg_id": 33012
}
'import requests
url = "https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation"
payload = { "peg_id": 33012 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({peg_id: 33012})
};
fetch('https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation', 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://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation",
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([
'peg_id' => 33012
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation"
payload := strings.NewReader("{\n \"peg_id\": 33012\n}")
req, _ := http.NewRequest("POST", url, payload)
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://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"peg_id\": 33012\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{companyName}.api.joinluminous.com/external/api/v1/purchase-orders/reverse-allocation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"peg_id\": 33012\n}"
response = http.request(request)
puts response.read_body{
"data": {
"removed": true,
"foTornDown": true,
"quantityReversed": 10,
"partial": true,
"shipped": true
}
}{
"message": "<string>"
}{
"message": "<string>"
}Authorizations
Authenticate using a bearer token. To create a token, navigate to /settings/api-tokens and click Create API Token.
Body
ID of the allocation peg to reverse
x >= 133012
Response
Allocation reversed
Show child attributes
Show child attributes