Upsert a company's location
Changed onUpsert a single location of one of the companies in your CRM — one POST handles both create and update. Include an existing location id in the body to update that location, or omit id to create a new one. The create path returns 201 and the update path returns 200; either way the response body is the full location, including its geocoded latitude/longitude. The location also appears in the company's locations array on the company endpoints; it is not returned by GET /public/v1/locations, which lists only your own company's locations.
This endpoint only manages the locations of your partner companies: the {id} in the path must be a company in your CRM other than your own company. To manage your own company's locations, use POST /public/v1/locations instead.
latitude and longitude cannot be sent — they are derived by geocoding the address, because Distru uses these coordinates to generate directions for transfer templates and to optimize delivery routes. Since those features require coordinates, an address that cannot be geocoded is rejected: nothing is saved and the request returns 400 (correct the address fields and retry). If the geocoding service itself is temporarily unavailable the request returns 503 — the address may be fine; retry later. Previously geocoded addresses resolve without contacting the geocoding service.
Updates are sparse: only the fields you send are changed, any field you omit keeps its current value, and sending null for a nullable field clears it (a required field rejects null with a 400). Changing any address field re-geocodes the location and refreshes its coordinates.
Required permission: companies_permissions_create to create a location, companies_permissions_edit to update an existing one.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Path parameters
ID of the company (as returned by GET /public/v1/companies) the location belongs to. Must be a company in your CRM other than your own company; an ID that doesn't exist for your company returns 404, and one your team restrictions hide returns 403.
Request body
Response
An updated location
Example response
{
"data": {
"address": "1234 Warehouse Street, Oakland, CA",
"company_id": "02c88a3f-d759-4973-88f9-60049d682524",
"id": "02c88a3f-d759-4973-88f9-60049d682524",
"license": {
"id": "02c88a3f-d759-4973-88f9-60049d682524",
"license_number": "C11-1234567890"
},
"license_id": "02c88a3f-d759-4973-88f9-60049d682524",
"name": "Warehouse 1"
}
}Changes
- info
endpoint added
- info