Vendors

Vendors represent the people and businesses you pay. They are linked to bills, purchase orders, and payment records.

Create a Vendor

bash
curl -X POST "https://api.ondayzero.com/api/v1/vendors" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Office Depot",
    "email": "ap@officedepot.com",
    "phone": "+1-555-0200",
    "address": "456 Supply Rd, Austin, TX 78701",
    "default_payment_term_id": "PAYMENT_TERM_UUID"
  }'

List Vendors

bash
curl "https://api.ondayzero.com/api/v1/vendors?search=office&limit=25" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"

Filter Parameters

Parameter Type Description
search string Fuzzy search by vendor name (1-200 chars, trigram matching)

Get a Vendor

bash
curl "https://api.ondayzero.com/api/v1/vendors/{vendor_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"

Update a Vendor

bash
curl -X PUT "https://api.ondayzero.com/api/v1/vendors/{vendor_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Office Depot Inc.",
    "website": "https://officedepot.com"
  }'

Contacts

Each vendor can have multiple contacts:

bash
curl -X POST "https://api.ondayzero.com/api/v1/vendors/{vendor_id}/contacts" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "john@officedepot.com",
    "role": "Account Manager",
    "is_primary": true
  }'

List contacts: GET /api/v1/vendors/{vendor_id}/contacts

Duplicate Detection

Check for similar existing vendors before creating:

bash
curl -X POST "https://api.ondayzero.com/api/v1/vendors/check-duplicates?name=Office%20Depot&email=ap@officedepot.com" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"

Returns matches with similarity_score and match_type (name, email, or tax ID).

Delete a Vendor

bash
curl -X DELETE "https://api.ondayzero.com/api/v1/vendors/{vendor_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"