Vendors¶
The Vendors entity provides CRUD access to P21 vendor master records. Vendors are the supplier-side counterpart to customers — purchase orders, accounts payable, and procurement workflows all reference the vendor master.
Endpoints¶
| Method | URL | Description |
|---|---|---|
GET | /entity/vendors/ | Get all vendors (ArrayOfVendor) |
POST | /entity/vendors/ | Create a new vendor |
GET | /entity/vendors/{companyId}_{vendorId} | Get a single vendor |
PUT | /entity/vendors/{companyId}_{vendorId} | Update a vendor |
GET | /entity/vendors/new | Get a blank vendor with defaults populated |
GET | /entity/vendors/ping | Health check |
Compound Key¶
The URL key segment is {companyId}_{vendorId}:
Both components are required. The underscore _ is the separator.
Field Reference¶
Root-Level Fields¶
| Field | Type | Description |
|---|---|---|
company_id | string | Company identifier (e.g., 01) |
vendor_id | string | Unique vendor identifier |
vendor_name | string | Full vendor/supplier name |
address1 | string | Primary address line 1 |
address2 | string | Address line 2 |
city | string | City |
state | string | State or province code |
zip | string | Postal/ZIP code |
phone | string | Primary phone number |
fax | string | Fax number |
payment_terms | string | Payment terms code (e.g., NET30) |
currency_id | string | Currency code for transactions with this vendor |
lead_time | int | Standard lead time in days |
1099_flag | string | 1099 reporting flag (Y / N) |
tax_id | string | Vendor federal tax ID (EIN/SSN for 1099 purposes) |
date_last_modified | datetime | Timestamp of last record modification |
Nested Collections¶
| Collection | Description |
|---|---|
VendorAddress | Alternate remit-to or ship-from addresses |
VendorContacts | Vendor contact persons (name, phone, email, role) |
VendorItems | Approved item list — items this vendor is authorized to supply |
VendorItems and procurement
The VendorItems collection links vendor records to inventory items and may include vendor-specific part numbers, pricing, and lead time overrides. This collection is used by the purchasing module when generating suggested purchase orders.
XML Examples¶
GET — Single Vendor Response¶
<Vendor xmlns="http://www.epicor.com/entity">
<company_id>01</company_id>
<vendor_id>V200042</vendor_id>
<vendor_name>Industrial Supply Co</vendor_name>
<address1>8800 Distribution Blvd</address1>
<address2>Dock B</address2>
<city>Atlanta</city>
<state>GA</state>
<zip>30301</zip>
<phone>404-555-7700</phone>
<fax>404-555-7701</fax>
<payment_terms>NET30</payment_terms>
<currency_id>USD</currency_id>
<lead_time>7</lead_time>
<1099_flag>N</1099_flag>
<tax_id>82-1234567</tax_id>
<date_last_modified>2025-10-05T14:11:00</date_last_modified>
<VendorContacts>
<VendorContact>
<contact_name>Jane Smith</contact_name>
<phone>404-555-7702</phone>
<email>jsmith@industrialsupply.com</email>
<title>Account Manager</title>
</VendorContact>
</VendorContacts>
<VendorAddress>
<VendorRemitTo>
<address_id>REMIT</address_id>
<address1>PO Box 5500</address1>
<city>Atlanta</city>
<state>GA</state>
<zip>30302</zip>
</VendorRemitTo>
</VendorAddress>
<VendorItems>
<VendorItem>
<item_id>WIDGET-100</item_id>
<vendor_item_no>ISC-W100</vendor_item_no>
<unit_cost>12.50</unit_cost>
<lead_time>5</lead_time>
</VendorItem>
<VendorItem>
<item_id>WIDGET-200</item_id>
<vendor_item_no>ISC-W200</vendor_item_no>
<unit_cost>18.75</unit_cost>
<lead_time>7</lead_time>
</VendorItem>
</VendorItems>
</Vendor>
POST — Create Vendor (Request Body)¶
<Vendor xmlns="http://www.epicor.com/entity">
<company_id>01</company_id>
<vendor_id>V200099</vendor_id>
<vendor_name>New Supplier Inc</vendor_name>
<address1>100 Supplier Lane</address1>
<city>Dallas</city>
<state>TX</state>
<zip>75201</zip>
<phone>214-555-3300</phone>
<payment_terms>NET45</payment_terms>
<currency_id>USD</currency_id>
<lead_time>10</lead_time>
<1099_flag>N</1099_flag>
</Vendor>
Always fetch /new before creating
The snippet above shows selected fields for illustration. Always start from the /new template response in practice. The template includes system-required fields that must be present in the POST body.
C# Examples¶
Get a Vendor¶
public async Task<Vendor> GetVendorAsync(string companyId, string vendorId)
{
var url = $"{_baseUrl}/entity/vendors/{companyId}_{vendorId}";
var response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
var xml = await response.Content.ReadAsStringAsync();
var serializer = new XmlSerializer(typeof(Vendor));
using var reader = new StringReader(xml);
return (Vendor)serializer.Deserialize(reader);
}
Create a Vendor¶
public async Task<Vendor> CreateVendorAsync(VendorCreateRequest request)
{
// Step 1: Fetch the template with defaults
var response = await _httpClient.GetAsync($"{_baseUrl}/entity/vendors/new");
response.EnsureSuccessStatusCode();
var xml = await response.Content.ReadAsStringAsync();
var serializer = new XmlSerializer(typeof(Vendor));
using var reader = new StringReader(xml);
var template = (Vendor)serializer.Deserialize(reader);
// Step 2: Populate fields
template.vendor_id = request.VendorId;
template.vendor_name = request.VendorName;
template.address1 = request.Address1;
template.city = request.City;
template.state = request.State;
template.zip = request.Zip;
template.phone = request.Phone;
template.payment_terms = request.PaymentTerms;
template.currency_id = request.CurrencyId;
template.lead_time = request.LeadTime;
// Step 3: Serialize and POST
using var writer = new StringWriter();
serializer.Serialize(writer, template);
var postXml = writer.ToString();
var content = new StringContent(postXml, Encoding.UTF8, "application/xml");
var postResponse = await _httpClient.PostAsync($"{_baseUrl}/entity/vendors/", content);
postResponse.EnsureSuccessStatusCode();
var responseXml = await postResponse.Content.ReadAsStringAsync();
using var responseReader = new StringReader(responseXml);
return (Vendor)serializer.Deserialize(responseReader);
}
Update Vendor Lead Time¶
public async Task UpdateVendorLeadTimeAsync(string companyId, string vendorId, int newLeadTime)
{
var vendor = await GetVendorAsync(companyId, vendorId);
vendor.lead_time = newLeadTime;
var serializer = new XmlSerializer(typeof(Vendor));
using var writer = new StringWriter();
serializer.Serialize(writer, vendor);
var xml = writer.ToString();
var content = new StringContent(xml, Encoding.UTF8, "application/xml");
var url = $"{_baseUrl}/entity/vendors/{companyId}_{vendorId}";
var response = await _httpClient.PutAsync(url, content);
response.EnsureSuccessStatusCode();
}
Notes and Common Pitfalls¶
Vendor ID conventions
Vendor IDs are conventionally prefixed with V (e.g., V200042) in most P21 installations. As with customers, this is a convention rather than a system-enforced rule. Verify your installation's numbering scheme before assigning IDs programmatically.
1099 reporting fields
The 1099_flag and tax_id fields are required for accurate 1099 tax reporting. Set 1099_flag to Y for individuals or sole proprietors subject to 1099-NEC reporting. Ensure tax_id is populated before year-end reporting runs.
VendorItems and item authorization
In some P21 configurations, purchase orders can only be raised against items present in the vendor's VendorItems collection. If your integration creates purchase orders, verify whether your installation enforces this rule before creating vendors without populating VendorItems.