Products
Retrieve and manage product data with secure, RESTful API endpoints.
Overview
The Products API provides secure endpoints to retrieve and manage product data. Start by calling the Products endpoint to find products of interest, then use Get Product for complete product details.
https://developer.traceallglobal.com/api/v1
Product Specification Access
Access product specifications using the unique Product Spec ID (psid) for detailed product information.
Key Features
- JSON formatted responses
- Schema-based validation
- Role-based permissions
- Flexible data attributes
API Endpoints
Get detailed information for a specific product by providing its unique psid in the path.
Parameters
X-API-Key (header, string, Required) - Your API key for authentication. Handles JWT validation automatically.
psid (path, integer, Required) - Product Spec ID to fetch. Must provide a valid product psid in the URL path.
Test this endpoint
Response Examples
{
"success": true,
"data": {
"psid": 123,
"productname": "Professional Grade Laptop",
"category": "Electronics",
"brand": "TechCorp",
"model": "TC-LP-2024",
"sku": "TC24LP001",
"description": "High-performance laptop for business professionals",
"price": 1299.99,
"currency": "USD",
"instock": true,
"stocklevel": 45,
"weight": 1.8,
"dimensions": "35.5 x 24.1 x 1.9 cm",
"created": "2024-12-01 10:00:00",
"lastupdated": "2025-01-15 14:30:00",
"active": 1
}
}
{
"success": false,
"error": "Missing API key"
}
{
"success": false,
"error": "Product not found"
}
Code Examples
curl -X GET "https://localhost/developer/api/v1/products/getProduct/123" \
-H "X-API-Key: YOUR_API_KEY"
fetch('https://localhost/developer/api/v1/products/getProduct/123', {
method: 'GET',
headers: {
'X-API-Key': 'YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));
import requests
url = "https://localhost/developer/api/v1/products/getProduct/123"
headers = {
"X-API-Key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://localhost/developer/api/v1/products/getProduct/123"))
.header("X-API-Key", "YOUR_API_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$url = 'https://localhost/developer/api/v1/products/getProduct/123';
$headers = [
'X-API-Key: YOUR_API_KEY'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
print_r($data);
?>
Update product specification details. Only the fields provided in the request body will be updated.
Parameters
X-API-Key (header, string, Required) - Your API key for authentication. Handles JWT validation automatically.
Content-Type (header, string, Required) - Must be set to "application/json".
X-HTTP-Method-Override (header, string, Optional) - Automatically handled by the API. Client can send PUT requests which are internally converted to POST for IIS compatibility.
psid (path, integer, Required) - Product specification ID to update. Must provide a valid product specification ID in the URL path.
Body (JSON) (object, Optional) - Fields to update. Any combination of the following:
productdescription(string)version(integer)fopdescription(string)bopdescription(string)preparation_instuctions(string)weight(string)uom(integer)countryid(integer)launchdate(datetime)submissiondate(datetime)totallife(string)shelflife(string)minlife(string)supportingdocumentation(string)suppliercomments(string)supplierdeclarationname(string)supplierdeclarationtitle(string)supplierdeclarationdate(datetime)buyingsignoffcomments(string)buyingsignoffname(string)buyingsignofftitle(string)buyingsignoffdate(datetime)technicalsignoffcomments(string)technicalsignoffname(string)technicalsignofftitle(string)technicalsignoffdate(datetime)readytoeat(boolean)comments(string)statusid(integer)productname(string)productcode(string)description(string)producttype(integer)category(integer)buyer(string)buyercomments(string)submitted(integer)vendorcode(string)companyname(string)address1(string)address2(string)address3(string)city(string)postcode(string)companycountryid(integer)technicalcontactname(string)technicalcontactemail(string)technicalmobileno(string)commercialcontactname(string)commercialcontactemail(string)commercialmobileno(string)suppliertype(integer)companycomments(string)enabled(integer)active(integer, optional)
{
"productdescription": "Updated Product Name",
"version": 2,
"comments": "Testing the update endpoint",
"productname": "Updated Test Product",
"productcode": "TEST00110001",
"description": "This is an updated description",
"category": 1,
"buyer": "4"
}
Test this endpoint
Response Examples
{
"success": true,
"message": "Product updated successfully",
"data": {
"newlineid": 1,
"companyid": 2,
"siteid": 2,
"statusid": 1,
"userid": 0,
"productdescription": "Updated Product Name",
"version": 2,
"fopdescription": null,
"bopdescription": null,
"preparation_instuctions": null,
"weight": null,
"uom": null,
"countryid": null,
"launchdate": {
"date": "1970-01-01 00:00:00.000000",
"timezone_type": 3,
"timezone": "Europe/London"
},
"submissiondate": null,
"totallife": null,
"shelflife": null,
"minlife": null,
"supportingdocumentation": null,
"suppliercomments": null,
"supplierdeclarationname": null,
"supplierdeclarationtitle": null,
"supplierdeclarationdate": null,
"buyingsignoffcomments": null,
"buyingsignoffname": null,
"buyingsignofftitle": null,
"buyingsignoffdate": null,
"technicalsignoffcomments": null,
"technicalsignoffname": null,
"technicalsignofftitle": null,
"technicalsignoffdate": null,
"readytoeat": null,
"comments": "Testing the update endpoint",
"lastupdated": {
"date": "2025-10-17 13:33:04.433000",
"timezone_type": 3,
"timezone": "Europe/London"
},
"created": {
"date": "2025-09-22 11:27:48.920000",
"timezone_type": 3,
"timezone": "Europe/London"
},
"isactive": 1,
"productname": "Updated Test Product",
"productcode": "TEST00110001",
"description": "This is an updated description",
"producttype": 1,
"category": 1,
"alcoholic": 0,
"cannedfish": 0,
"cbd": 0,
"chocolate": 0,
"coffee": 0,
"curedmeats": 0,
"freshfish": 0,
"freshfruit": 0,
"freshmeat": 0,
"honey": 0,
"jam": 0,
"oliveoil": 0,
"smokedfish": 0,
"supplements": 0,
"cheese": 1,
"fish": 0,
"mcs": 0,
"buyer": "4",
"buyercomments": "",
"copysupplierdeclarationdate": null,
"copytechnicalsignoffdate": null,
"statuslevel": "New",
"companyname": "Test Supplier"
},
"accordionHeader": 1
}
{
"success": false,
"error": "Missing API key"
}
{
"success": false,
"error": "No valid fields provided for update"
}
Code Examples
curl -X POST "https://developer.traceallglobal.com/api/v1/products/updateProduct/{psid}" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"productdescription": "Updated Product Name",
"version": 2,
"productname": "Premium Product",
"category": 1
}'
fetch('https://developer.traceallglobal.com/api/v1/products/updateProduct/{psid}', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
productdescription: 'Updated Product Name',
version: 2,
productname: 'Premium Product',
category: 1
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json
url = "https://developer.traceallglobal.com/api/v1/products/updateProduct/{psid}"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"productdescription": "Updated Product Name",
"version": 2,
"productname": "Premium Product",
"category": 1
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String jsonData = """
{
"productdescription": "Updated Product Name",
"version": 2,
"productname": "Premium Product",
"category": 1
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://developer.traceallglobal.com/api/v1/products/updateProduct/{psid}"))
.header("X-API-Key", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$url = 'https://developer.traceallglobal.com/api/v1/products/updateProduct/{psid}';
$headers = [
'X-API-Key: YOUR_API_KEY',
'Content-Type: application/json'
];
$data = [
'productdescription' => 'Updated Product Name',
'version' => 2,
'productname' => 'Premium Product',
'category' => 1
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => json_encode($data),
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
print_r($data);
?>
Get detailed information for a specific newline by providing its unique newlineid in the path.
Parameters
X-API-Key (header, string, Required) - Your API key for authentication. Handles JWT validation automatically.
newlineid (path, integer, Required) - Newline ID to fetch. Must provide a valid newline newlineid in the URL path.
Test this endpoint
Response Examples
{
"success": true,
"data": {
"newlineid": 123,
"companyname": "Food Company Ltd",
"technicaluser": "John Smith",
"companyid": 1,
"buyer": 4,
"mcs": null,
"active": 1,
"created": "2024-12-01 10:00:00",
"lastupdated": "2025-01-15 14:30:00"
}
}
{
"success": false,
"error": "Missing API key"
}
{
"success": false,
"error": "Newline not found"
}
Code Examples
curl -X GET "https://localhost/developer/api/v1/products/getNewline/123" \
-H "X-API-Key: YOUR_API_KEY"
fetch('https://localhost/developer/api/v1/products/getNewline/123', {
method: 'GET',
headers: {
'X-API-Key': 'YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));
import requests
url = "https://localhost/developer/api/v1/products/getNewline/123"
headers = {
"X-API-Key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
<?php
$url = 'https://localhost/developer/api/v1/products/getNewline/123';
$headers = [
'X-API-Key: YOUR_API_KEY'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
print_r($data);
?>
Update fields for a specific newline by ID. Only provided fields are updated.
Parameters
X-API-Key (header, string, Required) - Your API key for authentication. Handles JWT validation automatically.
Content-Type (header, string, Required) - Must be set to "application/json".
X-HTTP-Method-Override (header, string, Optional) - Automatically handled by the API. Client can send PUT requests which are internally converted to POST for IIS compatibility.
newlineid (path, integer, Required) - Newline ID to update. Must provide a valid newline ID in the URL path.
Body (JSON) (object, Optional) - Fields to update. Any combination of the following:
companyid(integer)productname(string)productcode(string)description(string)producttype(string)category(integer)alcoholic(boolean)cannedfish(boolean)cbd(boolean)chocolate(boolean)coffee(boolean)curedmeats(boolean)freshfish(boolean)freshfruit(boolean)freshmeat(boolean)honey(boolean)jam(boolean)oliveoil(boolean)smokedfish(boolean)supplements(boolean)cheese(boolean)fish(boolean)mcs(string)buyer(integer)buyercomments(string)isactive(boolean)companyname(string)technicaluser(string)
{
"productname": "Updated Product Name",
"productcode": "PROD-123-UPDATED",
"description": "Updated product description",
"category": 2,
"chocolate": 1,
"buyer": 4,
"buyercomments": "Approved for distribution",
"isactive": 1
}
Test this endpoint
Response Examples
{
"success": true,
"message": "Newline updated successfully",
"data": {
"newlineid": 123,
"companyid": 1,
"productname": "Updated Product Name",
"productcode": "PROD-123",
"description": "Updated product description",
"producttype": "Food",
"category": 2,
"alcoholic": 0,
"cannedfish": 0,
"cbd": 0,
"chocolate": 1,
"coffee": 0,
"curedmeats": 0,
"freshfish": 0,
"freshfruit": 0,
"freshmeat": 0,
"honey": 0,
"jam": 0,
"oliveoil": 0,
"smokedfish": 0,
"supplements": 0,
"cheese": 0,
"fish": 0,
"mcs": null,
"buyer": 4,
"buyercomments": "Approved for distribution",
"lastupdated": "2025-10-24 14:30:00",
"created": "2024-12-01 10:00:00",
"isactive": 1,
"companyname": "Food Company Ltd",
"technicaluser": "John Smith"
}
}
{
"success": false,
"error": "Missing API key"
}
{
"success": false,
"error": "No valid fields provided for update"
}
Code Examples
curl -X POST "https://localhost/developer/api/v1/products/updateNewline/123" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"productname": "Updated Product Name",
"productcode": "PROD-123-UPDATED",
"description": "Updated product description",
"category": 2,
"chocolate": 1,
"buyer": 4,
"buyercomments": "Approved for distribution",
"isactive": 1
}'
fetch('https://localhost/developer/api/v1/products/updateNewline/123', {
method: 'POST',
headers: {
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
productname: 'Updated Product Name',
productcode: 'PROD-123-UPDATED',
description: 'Updated product description',
category: 2,
chocolate: 1,
buyer: 4,
buyercomments: 'Approved for distribution',
isactive: 1
})
})
.then(response => response.json())
.then(data => console.log(data));
import requests
import json
url = "https://localhost/developer/api/v1/products/updateNewline/123"
headers = {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"productname": "Updated Product Name",
"productcode": "PROD-123-UPDATED",
"description": "Updated product description",
"category": 2,
"chocolate": 1,
"buyer": 4,
"buyercomments": "Approved for distribution",
"isactive": 1
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String jsonData = """
{
"productname": "Updated Product Name",
"productcode": "PROD-123-UPDATED",
"description": "Updated product description",
"category": 2,
"chocolate": 1,
"buyer": 4,
"buyercomments": "Approved for distribution",
"isactive": 1
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://localhost/developer/api/v1/products/updateNewline/123"))
.header("X-API-Key", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonData))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$url = 'https://localhost/developer/api/v1/products/updateNewline/123';
$headers = [
'X-API-Key: YOUR_API_KEY',
'Content-Type: application/json'
];
$data = [
'productname' => 'Updated Product Name',
'productcode' => 'PROD-123-UPDATED',
'description' => 'Updated product description',
'category' => 2,
'chocolate' => 1,
'buyer' => 4,
'buyercomments' => 'Approved for distribution',
'isactive' => 1
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => json_encode($data),
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
print_r($data);
?>
Get detailed allergen information for a specific product by providing its unique psid in the path.
Parameters
X-API-Key (header, string, Required) - Your API key for authentication. Handles JWT validation automatically.
psid (path, integer, Required) - Product Spec ID to fetch. Must provide a valid product psid in the URL path.
Test this endpoint
Response Examples
{
"success": true,
"data": {
"psid": 24,
"shellfish": "No",
"molluscs": "No",
"peanuts": "No",
"sulphurdioxide": "No",
"eggs": "Yes",
"nuts": "No",
"almonds": "No",
"hazelnuts": "No",
"walnuts": "No",
"cashews": "No",
"pecans": "No",
"pistachio": "No",
"brazil": "No",
"macadamia": "No",
"queensland": "No",
"fish": "No",
"sesame": "No",
"celery": "No",
"gluten": "Yes",
"wheat": "Yes",
"oats": "No",
"rye": "No",
"spelt": "No",
"kamut": "No",
"barley": "No",
"soya": "May",
"mustard": "No",
"lactose": "Yes",
"lupin": "No",
"productname": "Demo Test Product",
"productcode": "TEST00110004",
"statuslevel": "Approved",
"companyname": "Test Supplier"
}
}
{
"success": false,
"error": "Missing API key"
}
{
"success": false,
"error": "Product not found"
}
Code Examples
curl -X GET "https://localhost/developer/api/v1/products/getAllergens/123" \
-H "X-API-Key: YOUR_API_KEY"
fetch('https://localhost/developer/api/v1/products/getAllergens/123', {
method: 'GET',
headers: {
'X-API-Key': 'YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));
import requests
url = "https://localhost/developer/api/v1/products/getAllergens/123"
headers = {
"X-API-Key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://localhost/developer/api/v1/products/getAllergens/123"))
.header("X-API-Key", "YOUR_API_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$url = 'https://localhost/developer/api/v1/products/getAllergens/123';
$headers = [
'X-API-Key: YOUR_API_KEY'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
print_r($data);
?>
Get detailed nutritional information for a specific product by providing its unique psid in the path. Returns both per-100g and per-portion nutritional values.
Parameters
X-API-Key (header, string, Required) - Your API key for authentication. Handles JWT validation automatically.
psid (path, integer, Required) - Product Spec ID to fetch. Must provide a valid product psid in the URL path.
Test this endpoint
Response Examples
{
"success": true,
"data": {
"psid": 24,
"statusid": 7,
"portionsize": 75,
"kj100gcontains": "988.0000",
"kjperportion": "741.0000",
"kcal100gcontains": "233.4000",
"kcalperportion": "175.0000",
"fat100gcontains": "5.8000",
"fatperportion": "4.3000",
"saturates100gcontains": "0.0000",
"saturatesperportion": "0.0000",
"carbs100gcontains": "34.6000",
"carbsperportion": "26.0000",
"sugar100gcontains": "1.9000",
"sugarperportion": "1.4000",
"fibre100gcontains": "0.0000",
"fibreperportion": "0.0000",
"protein100gcontains": "12.9000",
"proteinperportion": "9.7000",
"water100gcontains": "43.0000",
"waterperportion": "32.3000",
"sodium100gcontains": "519.5000",
"sodiumperportion": "389.6000",
"productname": "Demo Test Product",
"productcode": "TEST00110004",
"copysupplierdeclarationdate": "2026-03-17 00:00:00.000",
"copytechnicalsignoffdate": "2026-03-17 10:41:09.297",
"statuslevel": "Approved",
"companyname": "Test Supplier"
}
}
{
"success": false,
"error": "Missing API key"
}
{
"success": false,
"error": "Product not found"
}
Code Examples
curl -X GET "https://localhost/developer/api/v1/products/getNutritionalInfo/123" \
-H "X-API-Key: YOUR_API_KEY"
fetch('https://localhost/developer/api/v1/products/getNutritionalInfo/123', {
method: 'GET',
headers: {
'X-API-Key': 'YOUR_API_KEY'
}
})
.then(response => response.json())
.then(data => console.log(data));
import requests
url = "https://localhost/developer/api/v1/products/getNutritionalInfo/123"
headers = {
"X-API-Key": "YOUR_API_KEY"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://localhost/developer/api/v1/products/getNutritionalInfo/123"))
.header("X-API-Key", "YOUR_API_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
<?php
$url = 'https://localhost/developer/api/v1/products/getNutritionalInfo/123';
$headers = [
'X-API-Key: YOUR_API_KEY'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
curl_close($curl);
print_r($data);
?>
Create a new allergen record for a product spec. Returns 409 if a record already exists — use updateAllergens instead.
Parameters
X-API-Key (header, string, Required)
Content-Type (header) — application/json
psid (body, integer, Required) — Product Spec ID to attach allergens to.
Allergen value key — each allergen field accepts one of these integer values:
0 No
1 Yes — Contains
2 May Contain
Body (JSON) — Optional allergen fields. All default to 0 (No) if omitted:
shellfish,molluscs,peanuts,sulphurdioxide,eggsnuts,almonds,hazelnuts,walnuts,cashews,pecans,pistachio,brazil,macadamia,queenslandfish,sesame,celerygluten,wheat,oats,rye,spelt,kamut,barleysoya,mustard,lactose,lupin
{
"psid": 24,
"gluten": 1,
"wheat": 1,
"eggs": 1,
"lactose": 1,
"soya": 2,
"mustard": 0,
"peanuts": 0,
"nuts": 0
}
Test this endpoint
Response Examples
{ "success": true, "data": { "psid": 24 } }{ "success": false, "error": "Missing API key" }{ "success": false, "error": "Allergen record already exists for this psid. Use update instead." }Code Examples
curl -X POST "https://developer.traceallglobal.com/api/v1/products/addAllergens" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"psid":24,"gluten":1,"wheat":1,"eggs":1,"lactose":1,"soya":2}'fetch('https://developer.traceallglobal.com/api/v1/products/addAllergens', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ psid: 24, gluten: 1, wheat: 1, eggs: 1, lactose: 1, soya: 2 })
}).then(r => r.json()).then(console.log);<?php
$data = ['psid' => 24, 'gluten' => 1, 'wheat' => 1, 'eggs' => 1, 'lactose' => 1, 'soya' => 2];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://developer.traceallglobal.com/api/v1/products/addAllergens',
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['x-api-key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($data),
]);
print_r(json_decode(curl_exec($curl), true));
curl_close($curl);Update allergen values for an existing record. Only the fields you provide are changed — unspecified fields keep their current values.
Parameters
X-API-Key (header, string, Required)
Content-Type (header) — application/json
psid (path, integer, Required) — Product Spec ID in the URL.
Allergen value key — each allergen field accepts one of these integer values:
0 No
1 Yes — Contains
2 May Contain
Body (JSON) — Any allergen fields to update. See addAllergens for the full list of 29 fields.
{
"soya": 1,
"mustard": 2,
"lactose": 1
}
Test this endpoint
Response Examples
{ "success": true, "data": { "message": "Allergens updated successfully", "psid": 24 } }{ "success": false, "error": "No valid allergen fields provided for update" }{ "success": false, "error": "Product spec not found or inactive" }Code Examples
curl -X POST "https://developer.traceallglobal.com/api/v1/products/updateAllergens/24" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"soya":1,"mustard":2}'fetch('https://developer.traceallglobal.com/api/v1/products/updateAllergens/24', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ soya: 1, mustard: 2 })
}).then(r => r.json()).then(console.log);<?php
$data = ['soya' => 1, 'mustard' => 2];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://developer.traceallglobal.com/api/v1/products/updateAllergens/24',
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['x-api-key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($data),
]);
print_r(json_decode(curl_exec($curl), true));
curl_close($curl);Create a new nutritional info record for a product spec. Returns 409 if a record already exists — use updateNutritionalInfo instead. All numeric values are stored to 4 decimal places.
Parameters
X-API-Key (header, string, Required)
Content-Type (header) — application/json
psid (body, integer, Required) — Product Spec ID.
Body (JSON) — Optional nutritional decimal fields:
portionsizekj100gcontains,kjperportionkcal100gcontains,kcalperportionfat100gcontains,fatperportionsaturates100gcontains,saturatesperportioncarbs100gcontains,carbsperportionsugar100gcontains,sugarperportionfibre100gcontains,fibreperportionprotein100gcontains,proteinperportionwater100gcontains,waterperportionsodium100gcontains,sodiumperportion
{
"psid": 24,
"portionsize": 75,
"kj100gcontains": 988,
"kjperportion": 741,
"kcal100gcontains": 233.4,
"kcalperportion": 175,
"fat100gcontains": 11.2,
"fatperportion": 8.4,
"saturates100gcontains": 4.1,
"saturatesperportion": 3.1,
"carbs100gcontains": 26.5,
"carbsperportion": 19.9,
"sugar100gcontains": 3.2,
"sugarperportion": 2.4,
"protein100gcontains": 7.8,
"proteinperportion": 5.9,
"sodium100gcontains": 0.4,
"sodiumperportion": 0.3
}
Test this endpoint
Response Examples
{ "success": true, "data": { "psid": 24 } }{ "success": false, "error": "Missing API key" }{ "success": false, "error": "Nutritional info record already exists for this psid. Use update instead." }Code Examples
curl -X POST "https://developer.traceallglobal.com/api/v1/products/addNutritionalInfo" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"psid":24,"portionsize":75,"kj100gcontains":988,"kjperportion":741,"kcal100gcontains":233.4,"kcalperportion":175}'fetch('https://developer.traceallglobal.com/api/v1/products/addNutritionalInfo', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ psid: 24, portionsize: 75, kj100gcontains: 988, kjperportion: 741, kcal100gcontains: 233.4, kcalperportion: 175 })
}).then(r => r.json()).then(console.log);<?php
$data = ['psid' => 24, 'portionsize' => 75, 'kj100gcontains' => 988, 'kjperportion' => 741, 'kcal100gcontains' => 233.4, 'kcalperportion' => 175];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://developer.traceallglobal.com/api/v1/products/addNutritionalInfo',
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['x-api-key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($data),
]);
print_r(json_decode(curl_exec($curl), true));
curl_close($curl);Update nutritional values for an existing record. Only the fields you provide are changed (COALESCE pattern).
Parameters
X-API-Key (header, string, Required)
Content-Type (header) — application/json
psid (path, integer, Required) — Product Spec ID in the URL.
Body (JSON) — Any nutritional decimal fields to update. See addNutritionalInfo for the full list of 21 fields.
{
"portionsize": 100,
"kj100gcontains": 1050,
"kjperportion": 1050,
"kcal100gcontains": 251,
"kcalperportion": 251
}
Test this endpoint
Response Examples
{ "success": true, "data": { "message": "Nutritional info updated successfully", "psid": 24 } }{ "success": false, "error": "No valid nutritional fields provided for update" }{ "success": false, "error": "Product spec not found or inactive" }Code Examples
curl -X POST "https://developer.traceallglobal.com/api/v1/products/updateNutritionalInfo/24" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"portionsize":100,"kj100gcontains":1050}'fetch('https://developer.traceallglobal.com/api/v1/products/updateNutritionalInfo/24', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ portionsize: 100, kj100gcontains: 1050 })
}).then(r => r.json()).then(console.log);<?php
$data = ['portionsize' => 100, 'kj100gcontains' => 1050];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://developer.traceallglobal.com/api/v1/products/updateNutritionalInfo/24',
CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['x-api-key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode($data),
]);
print_r(json_decode(curl_exec($curl), true));
curl_close($curl);