Location

Upsert a location

Changed on

Upsert a single location belonging to your own company — 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. Locations written here are the ones returned by GET /public/v1/locations and referenced across the API: • a purchase receives inventory into a location, and an order ships from one • every package sits at a location, and can be moved from one location to another • inventory quantities are always tracked per location • an assembly claims its inputs and produces its outputs at locations • stock adjustments add or remove inventory at a location

To manage the locations of your partner companies instead, use POST /public/v1/companies/{id}/locations.

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.

Any location that will hold cannabis inventory must be associated with one of your licenses via license_id — compliance is tracked per license, so a location without one is only suitable for non-regulated items. Choose the license carefully: once a location is linked to a Metrc or BioTrack license, the link is permanent — it can never be changed or cleared. Only links to Distru-only licenses (compliance_type NONE) can be swapped or removed later.

This endpoint never writes to Metrc: it does not create Metrc rooms, and metrc_id is read-only — it stays null unless the location is synced through the Distru app. Linking the first location to a Metrc license that cannot assign locations to plant batches auto-assigns that location as the license's intake location.

Companies with a BioTrack integration cannot manage locations through the API at all — their requests return a 400, because BioTrack locations require room configuration and syncing this endpoint does not support.

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.

post/public/v1/locations

Request

  • Base URL
    https://app.distru.com
  • Auth
    HTTP bearer

Request body

idstring

ID of the location. Provide it to update that location — it must belong to your company and not be soft-deleted, otherwise the request returns 404. Omit it to create a new location.

namestring

Display name of the location. Required on create; cannot be set to null. Characters with diacritics are replaced with their closest ASCII equivalent (e.g. Española becomes Espanola).

street_addressstring

Street address (e.g. 1234 Mission St). Required on create; cannot be set to null. Part of the geocoded address.

aptstring

Apartment, suite, or unit within the street address, or null to clear it. Optional.

citystring

City of the address. Required on create; cannot be set to null.

statestring

State or region of the address. Required on create; cannot be set to null. When country is US, must be a two-letter US state abbreviation (e.g. CA).

zipstring

Postal code of the address. Required on create; cannot be set to null. When country is US, must be a valid ZIP code (##### or #####-####) whose prefix matches the state.

countrystring

Country of the address as an ISO 3166-1 alpha-2 code (e.g. US). Required on create; cannot be set to null. Official country names and common spellings are normalized to their code (e.g. United States becomes US).

license_idstring

ID of one of your company's licenses (as returned by GET /public/v1/licenses), linking the location to that license, or null to unlink. Optional. A license that doesn't belong to your company is rejected with a 400. Once linked to a Metrc or BioTrack license the link is permanent and cannot be changed or cleared; only Distru-only licenses can be relinked.

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