Endpoints
| Method | Path | Purpose |
|---|
GET | /deals | List, paginated. ?expand=primary_company,primary_person |
POST | /deals | Create |
GET | /deals/:id | Fetch one. Same ?expand= options |
PATCH | /deals/:id | Update |
DELETE | /deals/:id | Delete |
Fields
| Field | Type | Notes |
|---|
id | uuid | |
name | string | Required |
stage | string | Defaults to "open". Free-form — no enum enforcement in v1 |
value_cents | string | null | bigint serialized as a string (avoids JS precision loss) |
currency | string | null | Defaults to "USD"; 3 chars |
primary_company_id | uuid | null | |
primary_person_id | uuid | null | |
custom_attributes | object | Validated by the schema engine |
closed_at | datetime | null | Set when stage moves to a closed state |
created_at, updated_at | datetime | |
Create
curl -X POST $SALTY_API/deals \
-H "Authorization: Bearer $SALTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme - Enterprise Q3",
"stage": "negotiation",
"value_cents": "15000000",
"currency": "USD",
"primary_company_id": "<company-uuid>",
"primary_person_id": "<person-uuid>"
}'
value_cents is a string in JSON because Postgres bigint exceeds JavaScript’s Number.MAX_SAFE_INTEGER. Parse it client-side with BigInt(deal.value_cents) if you need to do arithmetic.
Expand both relations
curl "$SALTY_API/deals/<id>?expand=primary_company,primary_person" \
-H "Authorization: Bearer $SALTY_API_KEY"
The response inlines primary_company and primary_person using the same serializers as /companies/:id and /people/:id.