Skip to content

Metrc Pages

GET /v2/metrc/pages lists the pages of the Metrc web app and the tables on each one, with links that open them for one of your licenses. Use it to link from your own tool into Metrc, such as from a search result to the table it came from.

A T3+ subscription is not required to use this endpoint.

Listing Pages

Parameter Required Description
licenseNumber yes The license the links open
import requests

response = requests.get(
    "https://api.trackandtrace.tools/v2/metrc/pages",
    params={"licenseNumber": "LIC-00001"},
    headers={"Authorization": f"Bearer {access_token}"},
).json()

for page in response["pages"]:
    print(page["group"], ">", page["title"], page["url"])
{
  "hostname": "ca.metrc.com",
  "licenseNumber": "LIC-00001",
  "pages": [
    {
      "key": "plants",
      "group": "Plants",
      "title": "Plants",
      "path": "/industry/LIC-00001/plants",
      "url": "https://ca.metrc.com/industry/LIC-00001/plants",
      "tables": [
        {
          "key": "plantbatchesonhold",
          "title": "Immature On Hold",
          "label": "On Hold",
          "gridSelector": "#plantbatchesonhold-grid",
          "hasTab": true,
          "endpointId": "ONHOLD_PLANTBATCHES"
        }
      ]
    }
  ]
}

Pages are in the order of Metrc's navigation menu, and tables in the order of the page's tabs.

Every page is listed for every license, including pages your state, license type or Metrc permissions do not let you open. Check access with Permissions.

Links use your session's Metrc hostname, so a sandbox session gets sandbox links.

Page Fields

Field Description
key A stable identifier, e.g. transfers-licensed-templates
group The Metrc menu the page is listed under, e.g. Transfers
title The page's link text in that menu, e.g. Templates
path The path that opens the page for the license
url The full URL that opens the page for the license
tables The tables on the page. Empty for a page with none

Table Fields

Field Description
key The table's name, unique within its page. Also its sub-view name in Permissions, e.g. plants/plantbatchesonhold
title A name unique within the page. Metrc's own tab labels repeat: the plants page has four "On Hold" tabs
label The text of the table's tab in Metrc, or null when Metrc renders no tab for it
gridSelector Identifies the table's tab on the Metrc page
hasTab Whether the table has its own tab. When false, link to the page
endpointId The collection the table lists, matching the endpointId of a search result. null when T3 does not serve it

Linking a Search Result to Its Table

Index the tables by endpointId, then look up each search result:

import requests

BASE = "https://api.trackandtrace.tools"
HEADERS = {"Authorization": f"Bearer {access_token}"}
LICENSE = "LIC-00001"

pages = requests.get(
    f"{BASE}/v2/metrc/pages",
    params={"licenseNumber": LICENSE},
    headers=HEADERS,
).json()["pages"]

tables = {
    table["endpointId"]: (page, table)
    for page in pages
    for table in page["tables"]
    if table["endpointId"]
}

results = requests.get(
    f"{BASE}/v2/search",
    params={"licenseNumber": LICENSE, "query": "0000123"},
    headers=HEADERS,
).json()["data"]

for result in results:
    match = tables.get(result["endpointId"])
    if match:
        page, table = match
        print(f"{page['title']} > {table['title']}: {page['url']}")

Limits and Behavior

  • One license per request. licenseNumber must be one of your session's licenses, or the response is 403 with the code FORBIDDEN.
  • Static. The list does not depend on your Metrc data, so it answers immediately.
  • Free. No T3+ subscription required.

Next Steps

  • Permissions: check which pages and tabs your account can open
  • Search: find records across collections