Create, update or delete a company address

distru-mutate-company-locationWrite

Creates, updates or deletes one location (address) of a customer or vendor company.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
actionenum
CREATEUPDATEDELETE
Yes
idstringNoRequired for UPDATE and DELETE. Resolve via distru-get-company (includeLocations).
companyIdstringNoRequired for CREATE; cannot change afterwards. The customer or vendor, not your own company. Resolve via distru-search-companies.
namestringNoRequired for CREATE. Write - for – and ' for ’. "()" written together is refused. Allowed: a-z, A-Z, 0-9, spaces and the symbols . , : ? ' ! @ # $ % ^ & * ( ) [ ] / \ | > + - _
streetAddressstringNoRequired for CREATE.
aptstring or nullNoSend null to clear it.
citystringNoRequired for CREATE.
statestringNoRequired for CREATE. In the US, the two-letter state code, e.g. CA; full state names are converted. Elsewhere free text.
zipstringNoRequired for CREATE. In the US, ##### or #####-####, within the state.
countrystringNoRequired for CREATE. ISO 3166-1 alpha-2 code, e.g. US; country names are converted.
licenseIdstring or nullNoOne of the same company's licenses. Resolve via distru-get-company (includeLicenses). Send null to clear it.

Output

This tool returns one of 2 shapes, depending on its inputs.

Presence on a nested field assumes its parent exists.

Result with location

FieldTypePresence
locationobjectAlways
location.idstringAlways
location.namestringAlways
location.streetAddressstringAlways
location.aptstringNull or absent
location.citystringAlways
location.statestringAlways
location.zipstringAlways
location.countrystringAlways
location.licenseobjectNull or absent
location.license.idstringAlways
location.license.licenseNumberstringAlways

Result with id

FieldTypePresence
idstringAlways
What the AI reads

Creates, updates or deletes one location (address) of a customer or vendor company. A new or changed address must geocode, or the save is refused. Read current values with distru-get-company first (includeLocations). Your own company's locations can't be changed here; they are managed in Settings → Company Info. DELETE soft-deletes the location; refused while a sales order shipment uses it as its shipping or billing address. Sales orders and purchase orders that use it as their address keep it. CREATE and UPDATE return the location as distru-get-company does; DELETE returns its id. Sparse update: UPDATE changes only the fields sent; a field sent as null is cleared.