---
title: "Upsert a company's license"
method: POST
path: "/public/v1/companies/{id}/licenses"
tags: ["Company"]
---

# Upsert a company's license

`POST /public/v1/companies/{id}/licenses`

## Request

- Base URL: `https://app.distru.com`
- URL: `https://app.distru.com/public/v1/companies/{id}/licenses`
- Auth: HTTP bearer

Upsert a single [license](#model-license) held by one of the [companies](#model-company) in your CRM — one POST handles both create and update. Include an existing license `id` in the body to update that license, 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 license. The license also appears in the company's `licenses` array on the [company endpoints](#get-a-company), and the company can be found by its licenses via the `license_number` filter of [GET /public/v1/companies](#get-companies); it is not returned by [GET /public/v1/licenses](#get-licenses), which lists only your own company's licenses.

This endpoint only manages the licenses of your partner companies: the `{id}` in the path must be a company in your CRM other than your own company. Your own company's licenses cannot be created or modified through the API — contact Distru support to change those. Licenses created here exist only in Distru (their `compliance_type` is `NONE`): writing one does not move inventory and does not sync to Metrc or BioTrack.

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.

Required permission: `licenses_permissions_create` to create a license, `licenses_permissions_edit` to update an existing one.

## Path parameters

- `id` string, required

## Request body

- object
  - `id` string: ID of the license. Provide it to update that license — it must belong to the company in the path, otherwise the request returns 404. Omit it to create a new license.
  - `license_number` string: License number as issued by the state (e.g. `C11-0000001-LIC`). Required on create. Surrounding whitespace is trimmed, and the number must be unique among the company's licenses. Cannot be set to `null`.
  - `license_type` string: Type of the license. Required on create. Must be one of the values valid for your company's US state — call [GET /public/v1/license-types](#get-license-types) for the exact strings, which are also listed on that endpoint's documentation. Any other value is rejected with a 400. Cannot be set to `null`.
  - `active` boolean: Whether the license is currently active. Defaults to `true` when omitted on create. Cannot be set to `null`.
  - `expiry_datetime` string: ISO 8601 datetime the license expires (e.g. `2030-01-01T00:00:00Z`). Required on create. Cannot be set to `null`.
  - `issue_datetime` string: ISO 8601 datetime the license was issued, or `null` to clear it. Optional.

## Response `200`

An updated license

- LicenseResponse: A single license wrapped in a data envelope
  - `data` License: A cannabis license held by a company or tied to a location, identifying it to the state and its compliance system.
    - `active` boolean, required: Whether this license is currently active
    - `expiry_datetime` string, required: ISO 8601 datetime this license expires (e.g. "2026-08-20T00:00:00Z")
    - `id` string, required: ID for this license
    - `inserted_datetime` string, required: ISO 8601 datetime this license was created at
    - `issue_datetime` string: ISO 8601 datetime this license was issued, or null when not set
    - `license_number` string, required: License number
    - `license_type` string, required: The license type as configured in Distru. A state-specific free-form value, e.g. "Distributor" or "Type 11 Distributor-Transport"

## Other responses

- `201`: A new license
- `400`: Invalid parameters
- `401`: Missing or invalid API token
- `403`: The API token lacks the required permission, or team restrictions hide the record
- `404`: Not Found

---

[API](https://skmtc.dev/distru/apis/distru-api.md) - [All operations](https://skmtc.dev/distru/apis/distru-api/llms.txt) - [OpenAPI document](https://skmtc.dev/distru/apis/distru-api/revisions/9d851a88e82f?raw)
