# Vendors

> Manage vendor records, contacts, and duplicate detection.

- **Category:** Guides
- HTML version: https://www.ondayzero.com/docs/guides/vendors
- All guides: https://www.ondayzero.com/docs/guides/index.md
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md

---

# 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"
  }'
```

`name` and `email` are required. Optional: `tax_id`, `website`, `notes`, `category`, `status` (`active` — the default — `inactive` or `blocked`), `credit_limit_cents` and `default_payment_term_id` (see [Payment Terms](/docs/guides/payment-terms)).

## 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) |
| `status` | string | `active`, `inactive` or `blocked` |

Plus the standard [pagination](/docs/guides/pagination) parameters.

## 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`. Update or remove one with `PUT` / `DELETE /api/v1/vendors/{vendor_id}/contacts/{contact_id}`.

## Bulk Upload

Download the CSV template with `GET /api/v1/vendors/bulk-upload/template`, then import:

```bash
curl -X POST "https://api.ondayzero.com/api/v1/vendors/bulk-upload" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -F "file=@vendors.csv"
```

The response includes counts and any row-level errors.

## Duplicate Detection

Check for similar existing vendors before creating:

```bash
curl "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). `name` is required; `email`, `tax_id` and `exclude_id` are optional.

## 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"
```
