curl --request POST \
--url https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase_order_id": 1042,
"sku": "WIDGET-BLUE",
"quantity": 3,
"defect_type": 10,
"reported_date": "2026-11-03",
"reported_by": "Emily",
"remarks": "Cracked housing"
}
'import requests
url = "https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports"
payload = {
"purchase_order_id": 1042,
"sku": "WIDGET-BLUE",
"quantity": 3,
"defect_type": 10,
"reported_date": "2026-11-03",
"reported_by": "Emily",
"remarks": "Cracked housing"
}
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({
purchase_order_id: 1042,
sku: 'WIDGET-BLUE',
quantity: 3,
defect_type: 10,
reported_date: '2026-11-03',
reported_by: 'Emily',
remarks: 'Cracked housing'
})
};
fetch('https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports', 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/defective-reports",
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([
'purchase_order_id' => 1042,
'sku' => 'WIDGET-BLUE',
'quantity' => 3,
'defect_type' => 10,
'reported_date' => '2026-11-03',
'reported_by' => 'Emily',
'remarks' => 'Cracked housing'
]),
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/defective-reports"
payload := strings.NewReader("{\n \"purchase_order_id\": 1042,\n \"sku\": \"WIDGET-BLUE\",\n \"quantity\": 3,\n \"defect_type\": 10,\n \"reported_date\": \"2026-11-03\",\n \"reported_by\": \"Emily\",\n \"remarks\": \"Cracked housing\"\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/defective-reports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase_order_id\": 1042,\n \"sku\": \"WIDGET-BLUE\",\n \"quantity\": 3,\n \"defect_type\": 10,\n \"reported_date\": \"2026-11-03\",\n \"reported_by\": \"Emily\",\n \"remarks\": \"Cracked housing\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports")
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 \"purchase_order_id\": 1042,\n \"sku\": \"WIDGET-BLUE\",\n \"quantity\": 3,\n \"defect_type\": 10,\n \"reported_date\": \"2026-11-03\",\n \"reported_by\": \"Emily\",\n \"remarks\": \"Cracked housing\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"reported_date": "2026-11-03",
"reported_by": "<string>",
"reported_at": "<string>",
"defect_type": 10,
"total_quantity": "<string>",
"total_cost": 123,
"total_tax": 123,
"status": 123,
"created_by": 123,
"updated_by": 123,
"created_at": "<string>",
"updated_at": "<string>",
"defective_report_rfq": [
{
"id": 123,
"defective_report_id": 123,
"purchase_order_id": 123,
"purchase_order_rfq_id": 123,
"quantity": "2.000000",
"defective_uom_id": 123,
"base_uom_id": 123,
"defective_qty": "<string>",
"unit": "pcs",
"unit_price": 123,
"line_total": 123,
"remarks": "<string>",
"factory_id": 123,
"factory_name": "<string>",
"receiving_report_id": 123,
"received_date": "2023-12-25",
"sku": "<string>",
"product_name": "<string>",
"stock_id": 123,
"location_id": 123,
"lot_id": 123,
"created_at": "<string>",
"updated_at": "<string>",
"purchase_order_rfq": {},
"factory": {},
"stock": {},
"rfq": {}
}
]
}{
"error": "<string>"
}{
"message": "<string>"
}{
"error": "No stock for this SKU in the warehouse."
}Create a defective report
Record defective units of one SKU received on a purchase order, the way the Inventory > Defectives screen’s “add item” picker does. The report gets one line, built from the SKU’s latest receiving-report line on that purchase order (unit price, unit, vendor, product name and received date come from that receipt). There is no update or delete over the API.
Inventory: unless is_affecting_inventory is false, the quantity (converted to the
SKU’s base unit of measure) is deducted from on hand in the warehouse, from location_id
or, when omitted, the warehouse’s first picking location, else its default receiving, else
its default shipping location. Only an existing stock row is deducted from; a warehouse
with no stock of the SKU is refused rather than creating one.
Defaults: warehouse_id defaults to the warehouse the units were received into,
defective_uom_id to the SKU’s base unit of measure (a variant without its own units
uses its parent’s), reported_date to today.
Idempotency: creating a defective report moves inventory, so this endpoint supports
the optional Idempotency-Key request header. Send the same key when retrying a call that
timed out and the original stored response is replayed (with an Idempotent-Replay: true
header) instead of deducting twice. Reusing a key with a different request body is
rejected with 409. Keys are honored for 24 hours.
curl --request POST \
--url https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase_order_id": 1042,
"sku": "WIDGET-BLUE",
"quantity": 3,
"defect_type": 10,
"reported_date": "2026-11-03",
"reported_by": "Emily",
"remarks": "Cracked housing"
}
'import requests
url = "https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports"
payload = {
"purchase_order_id": 1042,
"sku": "WIDGET-BLUE",
"quantity": 3,
"defect_type": 10,
"reported_date": "2026-11-03",
"reported_by": "Emily",
"remarks": "Cracked housing"
}
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({
purchase_order_id: 1042,
sku: 'WIDGET-BLUE',
quantity: 3,
defect_type: 10,
reported_date: '2026-11-03',
reported_by: 'Emily',
remarks: 'Cracked housing'
})
};
fetch('https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports', 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/defective-reports",
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([
'purchase_order_id' => 1042,
'sku' => 'WIDGET-BLUE',
'quantity' => 3,
'defect_type' => 10,
'reported_date' => '2026-11-03',
'reported_by' => 'Emily',
'remarks' => 'Cracked housing'
]),
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/defective-reports"
payload := strings.NewReader("{\n \"purchase_order_id\": 1042,\n \"sku\": \"WIDGET-BLUE\",\n \"quantity\": 3,\n \"defect_type\": 10,\n \"reported_date\": \"2026-11-03\",\n \"reported_by\": \"Emily\",\n \"remarks\": \"Cracked housing\"\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/defective-reports")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase_order_id\": 1042,\n \"sku\": \"WIDGET-BLUE\",\n \"quantity\": 3,\n \"defect_type\": 10,\n \"reported_date\": \"2026-11-03\",\n \"reported_by\": \"Emily\",\n \"remarks\": \"Cracked housing\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{companyName}.api.joinluminous.com/external/api/v1/defective-reports")
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 \"purchase_order_id\": 1042,\n \"sku\": \"WIDGET-BLUE\",\n \"quantity\": 3,\n \"defect_type\": 10,\n \"reported_date\": \"2026-11-03\",\n \"reported_by\": \"Emily\",\n \"remarks\": \"Cracked housing\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"reported_date": "2026-11-03",
"reported_by": "<string>",
"reported_at": "<string>",
"defect_type": 10,
"total_quantity": "<string>",
"total_cost": 123,
"total_tax": 123,
"status": 123,
"created_by": 123,
"updated_by": 123,
"created_at": "<string>",
"updated_at": "<string>",
"defective_report_rfq": [
{
"id": 123,
"defective_report_id": 123,
"purchase_order_id": 123,
"purchase_order_rfq_id": 123,
"quantity": "2.000000",
"defective_uom_id": 123,
"base_uom_id": 123,
"defective_qty": "<string>",
"unit": "pcs",
"unit_price": 123,
"line_total": 123,
"remarks": "<string>",
"factory_id": 123,
"factory_name": "<string>",
"receiving_report_id": 123,
"received_date": "2023-12-25",
"sku": "<string>",
"product_name": "<string>",
"stock_id": 123,
"location_id": 123,
"lot_id": 123,
"created_at": "<string>",
"updated_at": "<string>",
"purchase_order_rfq": {},
"factory": {},
"stock": {},
"rfq": {}
}
]
}{
"error": "<string>"
}{
"message": "<string>"
}{
"error": "No stock for this SKU in the warehouse."
}Authorizations
Headers
Body
Response
Defective report created
A defective report from Inventory > Defectives.