nodestash

Deals

Track sales opportunities through your pipeline

Deals represent sales opportunities. Each deal has a monetary value, belongs to a pipeline stage, and can be linked to contacts and companies.

Data Model

FieldTypeDescription
idstringUnique ID with dl_ prefix
titlestringDeal name (required, max 300 chars)
valuestring | nullMonetary value as string for precision (e.g., "50000.00")
currencystring3-letter currency code (default: EUR)
pipeline_idstringPipeline this deal belongs to (pp_ prefix)
stage_idstringCurrent stage in the pipeline (ps_ prefix)
contact_idstring | nullAssociated contact (ct_ prefix)
company_idstring | nullAssociated company (co_ prefix)
owner_idstring | nullDeal owner
expected_close_datestring | nullExpected close date (ISO 8601 date)
closed_atstring | nullWhen the deal was closed (auto-set)
custom_fieldsobjectCustom field key-value pairs
tagsstring[]Tags for categorization
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp

Create a Deal

curl -X POST https://api.nodestash.io/v1/deals \
  -H "Authorization: Bearer $NODESTASH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Acme Corp Enterprise License",
    "value": 50000,
    "currency": "EUR",
    "pipeline_id": "pp_abc123",
    "stage_id": "ps_def456",
    "contact_id": "ct_ghi789",
    "company_id": "co_jkl012",
    "expected_close_date": "2026-06-30",
    "tags": ["enterprise"]
  }'
const deal = await client.deals.create({
  title: 'Acme Corp Enterprise License',
  value: 50000,
  currency: 'EUR',
  pipeline_id: 'pp_abc123',
  stage_id: 'ps_def456',
  contact_id: 'ct_ghi789',
  company_id: 'co_jkl012',
  expected_close_date: '2026-06-30',
  tags: ['enterprise'],
})

Stage Progression

Move a deal through pipeline stages by updating stage_id:

curl -X PATCH https://api.nodestash.io/v1/deals/dl_abc123 \
  -H "Authorization: Bearer $NODESTASH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stage_id": "ps_won_stage"
  }'
await client.deals.update('dl_abc123', {
  stage_id: 'ps_won_stage',
})

When a deal moves to a won or lost stage, closed_at is automatically set to the current timestamp. Moving it back to an open stage clears closed_at.

Filter and Sort Deals

# Deals in a specific pipeline
curl "https://api.nodestash.io/v1/deals?pipeline_id=pp_abc123&sort=-value" \
  -H "Authorization: Bearer $NODESTASH_API_KEY"

# Deals by value range
curl "https://api.nodestash.io/v1/deals?min_value=10000&max_value=100000" \
  -H "Authorization: Bearer $NODESTASH_API_KEY"
// Deals in a pipeline, sorted by value
const { data } = await client.deals.list({
  pipeline_id: 'pp_abc123',
  sort: '-value',
})

// High-value deals
for await (const deal of client.deals.listAll({
  min_value: '10000',
  max_value: '100000',
})) {
  console.log(`${deal.title}: ${deal.value} ${deal.currency}`)
}

Available Filters

ParameterMatch TypeDescription
pipeline_idExactFilter by pipeline
stage_idExactFilter by stage
contact_idExactFilter by associated contact
company_idExactFilter by associated company
tagsAll matchComma-separated, must have all
min_valueRangeMinimum deal value
max_valueRangeMaximum deal value

Sorting

  • created_at / -created_at
  • updated_at / -updated_at
  • value / -value
  • expected_close_date / -expected_close_date
  • title / -title

API Reference

On this page