Skip to content

Scraps ​

Part of the Inventory API. Base URL https://your-domain.com/admin/api/v1 — replace the host with your own installation and the token placeholder with a real Bearer token (see Authentication).

List scraps ​

GET /admin/api/v1/inventories/scraps

Retrieve a paginated list of scraps with filtering and sorting

🔒 Requires a valid Bearer token.

Query parameters

ParameterTypeRequiredDescriptionExample
includestringNoComma-separated list of relationships to include. Available options: product, uom, lot, package, partner, operation, sourceLocation, destinationLocation, company, creator, tags, moves, moveLinesproduct,sourceLocation
filter[id]stringNoComma-separated list of IDs to filter byarchitecto
filter[name]stringNoFilter by scrap nameSP/1
filter[state]stringNoFilter by scrap statedraft
filter[product_id]stringNoFilter by product IDsarchitecto
filter[source_location_id]stringNoFilter by source location IDsarchitecto
filter[destination_location_id]stringNoFilter by destination location IDsarchitecto
sortstringNoSort field-created_at
bash
curl -X GET "https://your-domain.com/admin/api/v1/inventories/scraps?include=product%2CsourceLocation&filter%5Bid%5D=architecto&filter%5Bname%5D=SP%2F1&filter%5Bstate%5D=draft&filter%5Bproduct_id%5D=architecto&filter%5Bsource_location_id%5D=architecto&filter%5Bdestination_location_id%5D=architecto&sort=-created_at" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/inventories/scraps?include=product%2CsourceLocation&filter%5Bid%5D=architecto&filter%5Bname%5D=SP%2F1&filter%5Bstate%5D=draft&filter%5Bproduct_id%5D=architecto&filter%5Bsource_location_id%5D=architecto&filter%5Bdestination_location_id%5D=architecto&sort=-created_at", {
  method: "GET",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/inventories/scraps?include=product%2CsourceLocation&filter%5Bid%5D=architecto&filter%5Bname%5D=SP%2F1&filter%5Bstate%5D=draft&filter%5Bproduct_id%5D=architecto&filter%5Bsource_location_id%5D=architecto&filter%5Bdestination_location_id%5D=architecto&sort=-created_at', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/inventories/scraps?include=product%2CsourceLocation&filter%5Bid%5D=architecto&filter%5Bname%5D=SP%2F1&filter%5Bstate%5D=draft&filter%5Bproduct_id%5D=architecto&filter%5Bsource_location_id%5D=architecto&filter%5Bdestination_location_id%5D=architecto&sort=-created_at"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

response = requests.get(url, headers=headers)

data = response.json()
print(data)

Example response 200

json
{
  "data": [
    {
      "id": 1,
      "name": "SP/00001",
      "origin": null,
      "state": "draft",
      "qty": 1,
      "should_replenish": false,
      "closed_at": null,
      "created_at": "2026-10-12T10:00:29.000000Z",
      "updated_at": "2026-10-12T10:00:29.000000Z"
    },
    {
      "id": 1,
      "name": "SP/00001",
      "origin": null,
      "state": "draft",
      "qty": 1,
      "should_replenish": false,
      "closed_at": null,
      "created_at": "2026-10-12T10:00:29.000000Z",
      "updated_at": "2026-10-12T10:00:29.000000Z"
    }
  ],
  "links": {
    "first": "/?page=1",
    "last": "/?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "links": [
      {
        "url": null,
        "label": "&laquo; Previous",
        "page": null,
        "active": false
      },
      {
        "url": "/?page=1",
        "label": "1",
        "page": 1,
        "active": true
      },
      {
        "url": null,
        "label": "Next &raquo;",
        "page": null,
        "active": false
      }
    ],
    "path": "/",
    "per_page": 10,
    "to": 2,
    "total": 2
  }
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Create scrap ​

POST /admin/api/v1/inventories/scraps

Create a new scrap

🔒 Requires a valid Bearer token.

Body parameters

ParameterTypeRequiredDescription
originstringNoSource document reference. Must not be greater than 255 characters.
qtynumberYesQuantity to scrap. Must be at least 1. Must not be greater than 99999999999.
product_idintegerYesProduct ID. Must match an existing stored value.
uom_idintegerNoUnit of measure ID. Must match an existing stored value.
lot_idintegerNoLot ID. Must match an existing stored value.
package_idintegerNoPackage ID. Must match an existing stored value.
partner_idintegerNoOwner partner ID. Must match an existing stored value.
source_location_idintegerNoSource location ID. Must match an existing stored value.
destination_location_idintegerNoDestination scrap location ID. Must match an existing stored value.
company_idintegerNoCompany ID. Must match an existing stored value.
tagsinteger[]NoMust match an existing stored value.
bash
curl -X POST "https://your-domain.com/admin/api/v1/inventories/scraps" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "WH/OUT/0001",
  "qty": 2,
  "product_id": 1,
  "uom_id": 1,
  "lot_id": 1,
  "package_id": 1,
  "partner_id": 1,
  "source_location_id": 1,
  "destination_location_id": 2,
  "company_id": 1,
  "tags": [
    16
  ]
}'
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/inventories/scraps", {
  method: "POST",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "origin": "WH/OUT/0001",
  "qty": 2,
  "product_id": 1,
  "uom_id": 1,
  "lot_id": 1,
  "package_id": 1,
  "partner_id": 1,
  "source_location_id": 1,
  "destination_location_id": 2,
  "company_id": 1,
  "tags": [
    16
  ]
}),
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/inventories/scraps', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
    'origin' => 'WH/OUT/0001',
    'qty' => 2,
    'product_id' => 1,
    'uom_id' => 1,
    'lot_id' => 1,
    'package_id' => 1,
    'partner_id' => 1,
    'source_location_id' => 1,
    'destination_location_id' => 2,
    'company_id' => 1,
    'tags' => [
      16,
    ],
  ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/inventories/scraps"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

payload = {
    "origin": "WH/OUT/0001",
    "qty": 2,
    "product_id": 1,
    "uom_id": 1,
    "lot_id": 1,
    "package_id": 1,
    "partner_id": 1,
    "source_location_id": 1,
    "destination_location_id": 2,
    "company_id": 1,
    "tags": [
        16,
    ],
}

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

data = response.json()
print(data)

Example response 201

json
{
  "data": {
    "id": 1,
    "name": "SP/00001",
    "origin": null,
    "state": "draft",
    "qty": 1,
    "should_replenish": false,
    "closed_at": null,
    "created_at": "2026-10-12T10:00:29.000000Z",
    "updated_at": "2026-10-12T10:00:29.000000Z"
  },
  "message": "Scrap created successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Show scrap ​

GET /admin/api/v1/inventories/scraps/{id}

Retrieve a specific scrap by ID

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe scrap ID

Query parameters

ParameterTypeRequiredDescriptionExample
includestringNoComma-separated list of relationships to include. Available options: product, uom, lot, package, partner, operation, sourceLocation, destinationLocation, company, creator, tags, moves, moveLinesproduct,company
bash
curl -X GET "https://your-domain.com/admin/api/v1/inventories/scraps/{id}?include=product%2Ccompany" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/inventories/scraps/{id}?include=product%2Ccompany", {
  method: "GET",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://your-domain.com/admin/api/v1/inventories/scraps/{id}?include=product%2Ccompany', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/inventories/scraps/{id}?include=product%2Ccompany"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

response = requests.get(url, headers=headers)

data = response.json()
print(data)

Example response 200

json
{
  "data": {
    "id": 1,
    "name": "SP/00001",
    "origin": null,
    "state": "draft",
    "qty": 1,
    "should_replenish": false,
    "closed_at": null,
    "created_at": "2026-10-12T10:00:29.000000Z",
    "updated_at": "2026-10-12T10:00:29.000000Z"
  }
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Update scrap ​

PUT /admin/api/v1/inventories/scraps/{id}

Update an existing scrap

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe scrap ID

Body parameters

ParameterTypeRequiredDescription
originstringNoSource document reference. Must not be greater than 255 characters.
qtynumberNoQuantity to scrap. Must be at least 1. Must not be greater than 99999999999.
product_idintegerNoProduct ID. Must match an existing stored value.
uom_idintegerNoUnit of measure ID. Must match an existing stored value.
lot_idintegerNoLot ID. Must match an existing stored value.
package_idintegerNoPackage ID. Must match an existing stored value.
partner_idintegerNoOwner partner ID. Must match an existing stored value.
source_location_idintegerNoSource location ID. Must match an existing stored value.
destination_location_idintegerNoDestination scrap location ID. Must match an existing stored value.
company_idintegerNoCompany ID. Must match an existing stored value.
tagsinteger[]NoMust match an existing stored value.
bash
curl -X PUT "https://your-domain.com/admin/api/v1/inventories/scraps/{id}" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "origin": "WH/OUT/0001",
  "qty": 2,
  "product_id": 1,
  "uom_id": 1,
  "lot_id": 1,
  "package_id": 1,
  "partner_id": 1,
  "source_location_id": 1,
  "destination_location_id": 2,
  "company_id": 1,
  "tags": [
    16
  ]
}'
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/inventories/scraps/{id}", {
  method: "PUT",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "origin": "WH/OUT/0001",
  "qty": 2,
  "product_id": 1,
  "uom_id": 1,
  "lot_id": 1,
  "package_id": 1,
  "partner_id": 1,
  "source_location_id": 1,
  "destination_location_id": 2,
  "company_id": 1,
  "tags": [
    16
  ]
}),
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://your-domain.com/admin/api/v1/inventories/scraps/{id}', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
    'origin' => 'WH/OUT/0001',
    'qty' => 2,
    'product_id' => 1,
    'uom_id' => 1,
    'lot_id' => 1,
    'package_id' => 1,
    'partner_id' => 1,
    'source_location_id' => 1,
    'destination_location_id' => 2,
    'company_id' => 1,
    'tags' => [
      16,
    ],
  ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/inventories/scraps/{id}"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

payload = {
    "origin": "WH/OUT/0001",
    "qty": 2,
    "product_id": 1,
    "uom_id": 1,
    "lot_id": 1,
    "package_id": 1,
    "partner_id": 1,
    "source_location_id": 1,
    "destination_location_id": 2,
    "company_id": 1,
    "tags": [
        16,
    ],
}

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

data = response.json()
print(data)

Example response 200

json
{
  "data": {
    "id": 1,
    "name": "SP/00001",
    "origin": null,
    "state": "draft",
    "qty": 1,
    "should_replenish": false,
    "closed_at": null,
    "created_at": "2026-10-12T10:00:29.000000Z",
    "updated_at": "2026-10-12T10:00:29.000000Z"
  },
  "message": "Scrap updated successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Delete scrap ​

DELETE /admin/api/v1/inventories/scraps/{id}

Delete a scrap

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe scrap ID
bash
curl -X DELETE "https://your-domain.com/admin/api/v1/inventories/scraps/{id}" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/inventories/scraps/{id}", {
  method: "DELETE",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('DELETE', 'https://your-domain.com/admin/api/v1/inventories/scraps/{id}', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/inventories/scraps/{id}"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

response = requests.delete(url, headers=headers)

data = response.json()
print(data)

Example response 200

json
{
  "message": "Scrap deleted successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Validate scrap ​

POST /admin/api/v1/inventories/scraps/{id}/validate

Validate a draft scrap and update stock quantities

🔒 Requires a valid Bearer token.

Path parameters

ParameterTypeRequiredDescription
idintegerYesThe scrap ID
bash
curl -X POST "https://your-domain.com/admin/api/v1/inventories/scraps/{id}/validate" \
  -H "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json"
javascript
const response = await fetch("https://your-domain.com/admin/api/v1/inventories/scraps/{id}/validate", {
  method: "POST",
  headers: {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
  },
});

const data = await response.json();
console.log(data);
php
<?php

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://your-domain.com/admin/api/v1/inventories/scraps/{id}/validate', [
    'headers' => [
        'Authorization' => 'Bearer {YOUR_AUTH_TOKEN}',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
]);

$data = json_decode($response->getBody(), true);
python
import requests

url = "https://your-domain.com/admin/api/v1/inventories/scraps/{id}/validate"

headers = {
    "Authorization": "Bearer {YOUR_AUTH_TOKEN}",
    "Accept": "application/json",
    "Content-Type": "application/json",
}

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

data = response.json()
print(data)

Example response 200

json
{
  "data": {
    "id": 1,
    "name": "SP/00001",
    "origin": null,
    "state": "draft",
    "qty": 1,
    "should_replenish": false,
    "closed_at": null,
    "created_at": "2026-10-12T10:00:29.000000Z",
    "updated_at": "2026-10-12T10:00:29.000000Z"
  },
  "message": "Scrap validated successfully."
}
Error response — 401
json
{
  "message": "Unauthenticated."
}

Released under the MIT License.