Upsert a company
Create or update one company in your CRM through a single endpoint. Omit id to create; pass an existing company id to update that entry. The response is the same object returned by GET /public/v1/companies/{id}, with status 201 on create and 200 on update.
A company here is your relationship with another business plus the underlying business record. The two are written together: name, category, legal_business_name, default_email, phone_number, website, default_sales_order_notes, and default_purchase_order_notes describe the business itself, while the emails, owner_id, group_id, relationship_type_id, default_payment_term_id, outstanding_balance_threshold, and custom_data describe your relationship with it. On create both records are created in one call; on update both are amended in place — no second company is created.
Updates are sparse: only the fields you send change, and any field you omit keeps its current value. Sending custom_data, however, replaces the entire custom-field map — any custom field not present in the map you send is cleared, so send the full set you want to keep. Required custom fields are enforced on both create and update, so a create or update that leaves a required custom field unset is rejected. Renaming a company also updates its public menu URLs, so previously shared menu links for that company change.
This endpoint does not touch inventory and has no state-traceability (Metrc/BioTrack) effect — companies are CRM records only. A few response fields are read-only and cannot be set here: the computed outstanding_balance, leaflink_brand_id, and the nested licenses and locations — manage a company's licenses with POST /public/v1/companies/{id}/licenses instead.
You can link this company to your QuickBooks Online and LeafLink records through qb_customer_id, qb_vendor_id, and leaflink_customer_id. These run the same checks and side effects as the in-app mapping screens: the id must exist in your synced QuickBooks Online / LeafLink data, each may be linked to only one company on your account, and linking a leaflink_customer_id reassigns that customer's existing LeafLink orders to this company. Send an explicit null to unlink; omit the field to leave the current link unchanged. The link runs in the same transaction as the rest of the upsert, so if it is rejected the whole request is rolled back and nothing is persisted.
Validation is all-or-nothing: if any field is rejected the whole upsert fails and nothing is persisted; errors come back as a 400 with an errors array. Referencing an id that does not exist on your account (or that your team restrictions hide) returns 404.
Required permission: companies_permissions_create to create; companies_permissions_edit, plus access to the company under team restrictions, to update. Setting qb_customer_id or qb_vendor_id additionally requires settings_permissions_quickbooks; setting leaflink_customer_id additionally requires companies_permissions_update_leaflink_data.
Request body
Response
An updated company relationship
Changes
No recorded changes to this endpoint across all 1 revision of this API.