Dealer Write API
Programmatically create, update, and remove stone listings on Chaos without using the dashboard. Ideal for syncing from your existing inventory management system.
Connecting your existing inventory system
Many dealers already have their inventory in another platform (Kodllin, RapNet exports, custom in-house tools). You can connect that inventory to Chaos in two ways:
- Paste a feed URL into the Sync URL field on your Developer API dashboard. Chaos will fetch your feed (GET or POST), parse it, and upsert stones automatically β optionally every 24 hours. Most JSON shapes work: a plain array, or an object with a
stones,data, orresultarray property. - Use the Chaos write API directly from your own system β the endpoints documented below. Use this when you want to push changes the moment they happen in your source of truth, rather than waiting for the next poll.
Chaos auto-detects common dealer formats β for example, feeds that include stockNo and growthType fields are mapped to the Kodllin / Nancy Diamond format preset automatically (no manual column mapping required). If we don't recognise the shape, we fall through to using the field names as-is, so a feed that already uses Chaos field names works without configuration.
Authentication
Generate a write API key from your Developer API dashboard. Pass it as a Bearer token in the Authorization header on every request.
Authorization: Bearer chaos_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxTreat the key like a password. Rotate it from the dashboard if it leaks.
Rate limits
120 requests per minute per API key. Exceeded requests receive HTTP 429 with a Retry-After header and body {"error":"Rate limit exceeded","retry_after":60}.
Endpoints
/api/dealer/v1/stonesCreate a new stone. Required: stone_type, shape, carat_weight, wholesale_price_usd.
Request body
{
"stone_type": "diamond",
"shape": "round",
"carat_weight": 1.05,
"wholesale_price_usd": 4200,
"colour_grade": "F",
"clarity_grade": "VS1",
"cert_lab": "GIA",
"cert_number": "2191234567"
}Response
201 Created
{ "id": "uuid", "stone_type": "diamond", ... }
422 Unprocessable Entity
{ "error": "Validation failed", "errors": [{ "field": "carat_weight", "message": "Must be between 0.01 and 100" }] }curl
curl -X POST https://chaosgemstones.com/api/dealer/v1/stones \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"stone_type":"diamond","shape":"round","carat_weight":1.05,"wholesale_price_usd":4200}'JavaScript (fetch)
await fetch("https://chaosgemstones.com/api/dealer/v1/stones", {
method: "POST",
headers: { Authorization: "Bearer YOUR_KEY", "Content-Type": "application/json" },
body: JSON.stringify({ stone_type: "diamond", shape: "round", carat_weight: 1.05, wholesale_price_usd: 4200 }),
});/api/dealer/v1/stonesList your stones. Query params: status (available|reserved|sold|all, default all), limit (max 200, default 50), offset.
Response
{ "total_count": 124, "limit": 50, "offset": 0, "stones": [ { ... } ] }curl
curl "https://chaosgemstones.com/api/dealer/v1/stones?status=available&limit=50" -H "Authorization: Bearer YOUR_KEY"JavaScript (fetch)
const res = await fetch("https://chaosgemstones.com/api/dealer/v1/stones?limit=100", { headers: { Authorization: "Bearer YOUR_KEY" } });
const { stones } = await res.json();/api/dealer/v1/stones/:idGet a single stone by ID. Must belong to your account.
Response
200 OK β full stone object
404 Not Found β { "error": "Stone not found" }curl
curl https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID -H "Authorization: Bearer YOUR_KEY"JavaScript (fetch)
const res = await fetch("https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID", { headers: { Authorization: "Bearer YOUR_KEY" } });/api/dealer/v1/stones/:idPartial update β only fields you include are changed. Returns the updated stone.
Request body
{ "wholesale_price_usd": 4500, "status": "reserved" }Response
200 OK β updated stone objectcurl
curl -X PUT https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID \
-H "Authorization: Bearer YOUR_KEY" -H "Content-Type: application/json" \
-d '{"wholesale_price_usd": 4500}'JavaScript (fetch)
await fetch("https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID", {
method: "PUT",
headers: { Authorization: "Bearer YOUR_KEY", "Content-Type": "application/json" },
body: JSON.stringify({ wholesale_price_usd: 4500 }),
});/api/dealer/v1/stones/:idDelete a stone permanently. Must belong to your account.
Response
{ "deleted": true }curl
curl -X DELETE https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID -H "Authorization: Bearer YOUR_KEY"JavaScript (fetch)
await fetch("https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID", { method: "DELETE", headers: { Authorization: "Bearer YOUR_KEY" } });/api/dealer/v1/stones/:id/mark-soldMark a stone as sold. Optionally records an order row. Removes the stone from all jeweller feeds.
Request body
{ "sale_price_usd": 1200, "notes": "sold to UK buyer", "jeweller_id": "optional-uuid" }Response
200 OK β updated stone with status: "sold"curl
curl -X POST https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID/mark-sold \
-H "Authorization: Bearer YOUR_KEY" -H "Content-Type: application/json" \
-d '{"sale_price_usd": 1200}'JavaScript (fetch)
await fetch("https://chaosgemstones.com/api/dealer/v1/stones/STONE_ID/mark-sold", {
method: "POST",
headers: { Authorization: "Bearer YOUR_KEY", "Content-Type": "application/json" },
body: JSON.stringify({ sale_price_usd: 1200 }),
});/api/dealer/v1/stones/bulkBulk create or update β up to 200 stones per request. Existing stones are matched by cert_number and updated; new ones are created.
Request body
[
{ "stone_type": "diamond", "shape": "round", "carat_weight": 1.05, "wholesale_price_usd": 4200, "cert_number": "2191234567", "cert_lab": "GIA" },
{ "stone_type": "sapphire", "shape": "oval", "carat_weight": 2.10, "wholesale_price_usd": 3800 }
]Response
{ "created": 45, "updated": 12, "errors": [ { "row": 3, "field": "carat_weight", "message": "Must be between 0.01 and 100" } ] }curl
curl -X POST https://chaosgemstones.com/api/dealer/v1/stones/bulk \
-H "Authorization: Bearer YOUR_KEY" -H "Content-Type: application/json" \
--data @stones.jsonJavaScript (fetch)
// Sync your external inventory once a day:
const stones = await loadFromYourSystem(); // [{stone_type, shape, carat_weight, wholesale_price_usd, cert_number, ...}]
const res = await fetch("https://chaosgemstones.com/api/dealer/v1/stones/bulk", {
method: "POST",
headers: { Authorization: "Bearer YOUR_KEY", "Content-Type": "application/json" },
body: JSON.stringify(stones),
});
const { created, updated, errors } = await res.json();Field reference
All fields accepted by the create / update / bulk endpoints. Required fields are marked.
| Field | Type | Required | Notes |
|---|---|---|---|
| stone_type | string | yes | Stone type |
| shape | string | yes | Shape |
| carat_weight | number | yes | Carat weight |
| wholesale_price_usd | number | yes | Wholesale price (USD) |
| price_currency | enum | β | One of: USD, GBP, EUR, AUD, CAD, INR, THB, LKR, HKD, SGD, JPY, AED, CHF, ZAR |
| colour_grade | string | β | Colour grade |
| clarity_grade | enum | β | One of: FL, IF, VVS1, VVS2, VS1, VS2, SI1, SI2, I1, I2, I3, Eye Clean, Lightly Included, Moderately Included, Heavily Included |
| cut_grade | string | β | Cut grade |
| polish | string | β | Polish |
| symmetry | string | β | Symmetry |
| fluorescence | string | β | Fluorescence |
| fluorescence_colour | string | β | Fluorescence colour |
| cert_lab | enum | β | One of: GIA, IGI, HRD, AGS, GCAL, EGL, GRS, SSEF, GΓΌbelin, AGL, Lotus, GIT, GIA-coloured |
| cert_number | string | β | Cert number |
| cert_url | string | β | Certificate URL |
| origin | string | β | Origin (region) |
| country_of_origin | string | β | Country of origin |
| treatment | string | β | Treatment |
| colour_hue | string | β | Colour hue |
| colour_tone | string | β | Colour tone |
| colour_saturation | string | β | Colour saturation |
| phenomenon | string | β | Phenomenon |
| measurements_length | number | β | Length (mm) |
| measurements_width | number | β | Width (mm) |
| measurements_height | number | β | Height (mm) |
| lw_ratio | number | β | L/W ratio |
| depth_pct | number | β | Depth % |
| table_pct | number | β | Table % |
| girdle | string | β | Girdle |
| culet_size | string | β | Culet size |
| culet_condition | string | β | Culet condition |
| shade | string | β | Shade |
| milky | string | β | Milky |
| eye_clean | string | β | Eye clean |
| black_inclusion | string | β | Black inclusion |
| enhancement | string | β | Enhancement |
| listing_type | string | β | Listing type |
| parcel_quantity | number | β | Parcel quantity |
| matching_pair | boolean | β | Matching pair |
| has_video | boolean | β | Has video |
| has_360 | boolean | β | Has 360Β° |
| provenance_report | string | β | Provenance report |
| video_url | string | β | Video URL |
| image_url | string | β | Image URL |
| available_qty | number | β | Available qty |
| minimum_order_qty | number | β | Minimum order qty |
| lead_time_days | number | β | Lead time (days) |
| notes_for_buyers | string | β | Notes for buyers |
| crown_angle | number | β | Crown angle (Β°) |
| pavilion_angle | number | β | Pavilion angle (Β°) |
Enum reference β clarity_grade: FL, IF, VVS1, VVS2, VS1, VS2, SI1, SI2, I1, I2, I3, Eye Clean, Lightly Included, Moderately Included, Heavily Included. cert_lab: GIA, IGI, HRD, AGS, GCAL, EGL, GRS, SSEF, GΓΌbelin, AGL, Lotus, GIT, GIA-coloured. listing_type: single | parcel.