curl --request POST \
--url https://api.exowpee.com/v1/catalog/inventory-damages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"reference": "<string>",
"items": [
{
"stockable_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
],
"stockable_unit_id": "<string>"
}
]
}
'import requests
url = "https://api.exowpee.com/v1/catalog/inventory-damages"
payload = {
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"reference": "<string>",
"items": [
{
"stockable_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
],
"stockable_unit_id": "<string>"
}
]
}
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_id: '<string>',
purchase_reception_id: '<string>',
reference: '<string>',
items: [
{
stockable_id: '<string>',
stock_sources: [{quantity: 123, asset_id: '<string>', group_id: '<string>'}],
stockable_unit_id: '<string>'
}
]
})
};
fetch('https://api.exowpee.com/v1/catalog/inventory-damages', 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/inventory-damages",
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_id' => '<string>',
'purchase_reception_id' => '<string>',
'reference' => '<string>',
'items' => [
[
'stockable_id' => '<string>',
'stock_sources' => [
[
'quantity' => 123,
'asset_id' => '<string>',
'group_id' => '<string>'
]
],
'stockable_unit_id' => '<string>'
]
]
]),
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://api.exowpee.com/v1/catalog/inventory-damages"
payload := strings.NewReader("{\n \"purchase_id\": \"<string>\",\n \"purchase_reception_id\": \"<string>\",\n \"reference\": \"<string>\",\n \"items\": [\n {\n \"stockable_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ],\n \"stockable_unit_id\": \"<string>\"\n }\n ]\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://api.exowpee.com/v1/catalog/inventory-damages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase_id\": \"<string>\",\n \"purchase_reception_id\": \"<string>\",\n \"reference\": \"<string>\",\n \"items\": [\n {\n \"stockable_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ],\n \"stockable_unit_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/inventory-damages")
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_id\": \"<string>\",\n \"purchase_reception_id\": \"<string>\",\n \"reference\": \"<string>\",\n \"items\": [\n {\n \"stockable_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ],\n \"stockable_unit_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"reference": "<string>",
"status": "<string>",
"damage_reason": "<string>",
"confirmed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": [
{
"id": "<string>",
"inventory_damage_id": "<string>",
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"quantity": 123,
"stock_sources": "<array>",
"cost_total": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"message": "<string>",
"errors": {}
}Declare damaged stock
Records a draft damage declaration with the items and quantities lost, optionally tied to a purchase or confirmed delivery.
curl --request POST \
--url https://api.exowpee.com/v1/catalog/inventory-damages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"reference": "<string>",
"items": [
{
"stockable_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
],
"stockable_unit_id": "<string>"
}
]
}
'import requests
url = "https://api.exowpee.com/v1/catalog/inventory-damages"
payload = {
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"reference": "<string>",
"items": [
{
"stockable_id": "<string>",
"stock_sources": [
{
"quantity": 123,
"asset_id": "<string>",
"group_id": "<string>"
}
],
"stockable_unit_id": "<string>"
}
]
}
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_id: '<string>',
purchase_reception_id: '<string>',
reference: '<string>',
items: [
{
stockable_id: '<string>',
stock_sources: [{quantity: 123, asset_id: '<string>', group_id: '<string>'}],
stockable_unit_id: '<string>'
}
]
})
};
fetch('https://api.exowpee.com/v1/catalog/inventory-damages', 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/inventory-damages",
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_id' => '<string>',
'purchase_reception_id' => '<string>',
'reference' => '<string>',
'items' => [
[
'stockable_id' => '<string>',
'stock_sources' => [
[
'quantity' => 123,
'asset_id' => '<string>',
'group_id' => '<string>'
]
],
'stockable_unit_id' => '<string>'
]
]
]),
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://api.exowpee.com/v1/catalog/inventory-damages"
payload := strings.NewReader("{\n \"purchase_id\": \"<string>\",\n \"purchase_reception_id\": \"<string>\",\n \"reference\": \"<string>\",\n \"items\": [\n {\n \"stockable_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ],\n \"stockable_unit_id\": \"<string>\"\n }\n ]\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://api.exowpee.com/v1/catalog/inventory-damages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase_id\": \"<string>\",\n \"purchase_reception_id\": \"<string>\",\n \"reference\": \"<string>\",\n \"items\": [\n {\n \"stockable_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ],\n \"stockable_unit_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.exowpee.com/v1/catalog/inventory-damages")
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_id\": \"<string>\",\n \"purchase_reception_id\": \"<string>\",\n \"reference\": \"<string>\",\n \"items\": [\n {\n \"stockable_id\": \"<string>\",\n \"stock_sources\": [\n {\n \"quantity\": 123,\n \"asset_id\": \"<string>\",\n \"group_id\": \"<string>\"\n }\n ],\n \"stockable_unit_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"purchase_id": "<string>",
"purchase_reception_id": "<string>",
"reference": "<string>",
"status": "<string>",
"damage_reason": "<string>",
"confirmed_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"items": [
{
"id": "<string>",
"inventory_damage_id": "<string>",
"stockable_id": "<string>",
"stockable_unit_id": "<string>",
"quantity": 123,
"stock_sources": "<array>",
"cost_total": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"message": "<string>",
"errors": {}
}inventory_damages.create
Conditions
- At least one item is required, and each item needs at least one stock source.
- purchase_id and purchase_reception_id cannot both be sent; when sent, the purchase or reception must belong to the current company.
- A purchase reception can only be targeted when its status is confirmed.
- damage_reason is required and must be ordinary or exceptional.
- reference, when sent, must be unique among the damage records of the company, whatever their status.
- Each item must be tracked in inventory, and an item cannot appear twice in the same record.
- A stockable_unit_id must be an active unit of that item whose measurement category matches the item.
- Each stock source must name exactly one of asset_id or group_id, and the same source cannot be listed twice for an item.
- A source asset must be a location the company is eligible to use, and the source must hold stock of the item; when the record is tied to a purchase or reception, only stock coming from that purchase or reception counts.
- The quantity declared on a source cannot exceed the stock available there, after subtracting the quantities already reserved by other draft damage records.
- Creates the record in draft status together with its items; the cost of each item is 0 until the record is confirmed.
- Stock levels do not change until the record is confirmed.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Optional purchase the damage relates to, as a 27-character identifier of a purchase of the current company. Accepted on creation only and cannot be sent together with purchase_reception_id. When set, only stock coming from this purchase can be declared.
Optional confirmed purchase reception the damage relates to, as a 27-character identifier of a reception of the current company. Accepted on creation only and cannot be sent together with purchase_id. When set, only stock received through it can be declared.
Optional free reference of the record, up to 255 characters, unique among the company's damage records. Can be changed while the record is a draft.
255Why the stock was damaged: ordinary (expected loss) or exceptional. Required on creation, optional on update.
ordinary, exceptional Damaged items of the record, at least one. Accepted on creation only; on update use the items endpoints.
Show child attributes
Show child attributes
Response
InventoryDamageResource
Identifier of the damage record (27-character KSUID).
Purchase the damage is tied to; null when the record has no purchase origin.
Purchase reception the damage is tied to; null when the record has no reception origin.
Free reference of the record; null when none was given.
State of the record: draft (editable, no stock moved) or confirmed (stock removed, no more changes).
Reason of the damage: ordinary or exceptional.
Date and time of confirmation (ISO 8601); null while the record is a draft.
Date and time the record was created (ISO 8601, UTC).
Date and time the record was last changed (ISO 8601, UTC).
Damaged items of the record.
Show child attributes
Show child attributes