budtags/skills/metrc-api/SKILL.md
Use this skill when working with Metrc cannabis tracking API integration, finding specific endpoints, understanding request/response formats, or implementing Metrc workflows.
npx skillsauth add jwilly246/budtags-claude-plugin metrc-apiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are now equipped with comprehensive knowledge of the complete Metrc API v2 via modular category files, scenario templates, and pattern guides. This skill uses progressive disclosure to load only the information relevant to your task.
When the user asks about Metrc API integration, you can:
This skill has access to 26 category files, 8 scenario templates, and 9 pattern files:
Core Operations:
categories/packages.md - 32 endpoints (all license types)categories/items.md - 16 endpoints (all license types)categories/transfers.md - 28 endpoints (all license types)categories/labtests.md - 8 endpoints (all license types)Cultivation-Only (AU-C-######):
categories/plants.md - 36 endpoints (CULTIVATION ONLY)categories/plantbatches.md - 21 endpoints (CULTIVATION ONLY)categories/harvests.md - 15 endpoints (cultivation + processing)Retail-Only (AU-R-######):
categories/sales.md - 36 endpoints (RETAIL ONLY)Processing/Manufacturing (AU-P-######):
categories/processingjob.md - 17 endpoints (PROCESSING ONLY)Reference Data:
categories/locations.md - 7 endpointscategories/sublocations.md - 6 endpointscategories/strains.md - 6 endpointscategories/tags.md - 3 endpointscategories/facilities.md - 1 endpointcategories/unitsofmeasure.md - 2 endpointscategories/wastemethods.md - 1 endpointQR Codes & Retail ID:
categories/retailid.md - 6 endpoints (QR codes, package merge, consumer lookup)Transporters & Logistics:
categories/transporters.md - 10 endpoints (drivers, vehicles)Medical/Patient Management:
categories/patients.md - 5 endpointscategories/patientcheckins.md - 5 endpointscategories/patientsstatus.md - 1 endpointcategories/caregiversstatus.md - 1 endpointSpecialized:
categories/additivestemplates.md - 5 endpoints (fertilizer/pesticide templates)categories/employees.md - 2 endpointscategories/webhooks.md - 5 endpoints (real-time notifications)categories/sandbox.md - 1 endpoint (integrator testing)scenarios/create-packages-from-harvest.md - Package creation workflowscenarios/move-plants-to-flowering.md - Plant phase changesscenarios/record-sales-receipt.md - Retail sales recordingscenarios/check-in-incoming-transfer.md - Transfer check-in workflowscenarios/record-lab-test-results.md - Lab test submissionscenarios/adjust-package-quantity.md - Package adjustmentsscenarios/create-new-strain.md - Strain managementscenarios/replace-plant-tags.md - Tag replacement workflowCore Patterns:
patterns/authentication.md - API key setup, license number requirementspatterns/license-types.md - Cultivation vs Processing vs Retail restrictionspatterns/error-handling.md - HTTP status codes, rate limiting, retry strategies, HTTP 413patterns/pagination.md - pageNumber/pageSize patterns, iterationpatterns/date-formats.md - ISO 8601 requirements, common date fieldsCritical Constraints (⚠️ Production-Breaking):
patterns/object-limiting.md - 10 object maximum per request (HTTP 413 if exceeded)patterns/batch-operations.md - Array-based requests, chunking strategies, transactionsBest Practices:
patterns/inventory-management.md - Active/inactive endpoints, lastModified chronological orderingpatterns/transfer-workflows.md - Outgoing transfer cascading API calls, multi-step workflowscollections/ directory - 26 Postman collection JSON files with complete endpoint detailsMETRC_API_RULES.md.backup - Original comprehensive API rules (now split into pattern files)ALWAYS determine license type before recommending endpoints.
Different Metrc license types have access to different endpoints:
Full Access To:
/plants/v2/*, /plantbatches/v2/*)Load These Categories:
categories/plants.mdcategories/plantbatches.mdcategories/harvests.mdcategories/packages.mdcategories/items.mdFull Access To:
NO ACCESS To:
/plants/v2/*)/plantbatches/v2/*)Load These Categories:
categories/packages.mdcategories/items.mdcategories/processingjob.mdcategories/labtests.mdFull Access To:
/sales/v2/*)NO ACCESS To:
Load These Categories:
categories/sales.mdcategories/packages.mdcategories/transfers.mdcategories/patients.md (if medical state)Full Access To:
Load These Categories:
categories/labtests.mdIMPORTANT: Only load files relevant to the user's question. DO NOT load all categories.
Ask the user or determine from context:
"What Metrc API task are you working on? Please provide:
Determine scope:
User asks: "How do I create packages from a harvest?"
Load:
scenarios/create-packages-from-harvest.md (workflow guide)categories/harvests.md (endpoint details)patterns/batch-operations.md (IF batch creation)patterns/date-formats.md (IF date questions arise)Context: ~180-250 lines (80% reduction from loading all 526 lines)
User asks: "What's the request format for GET /packages/v2/active?"
Load:
categories/packages.md (endpoints + descriptions)collections/metrc-packages.postman_collection.json (full details)patterns/pagination.md (IF pagination questions)Context: ~80-150 lines (85% reduction)
User asks: "Can retail licenses access plant endpoints?"
Load:
patterns/license-types.md (complete license compatibility matrix)Context: ~80 lines (92% reduction)
User asks: "How do I handle pagination?"
Load:
patterns/pagination.md (pagination patterns + code examples)Context: ~40 lines (95% reduction)
When answering:
User: "How do I create packages from a harvest?"
Your Response:
To create packages from a harvest, use the POST /harvests/v2/packages endpoint.
Let me load the scenario guide for you...
[Load scenarios/create-packages-from-harvest.md]
**Workflow**:
1. Get available package tags: GET /tags/v2/package/available
2. Submit package creation: POST /harvests/v2/packages
**Laravel Example**:
[Show code from scenario file]
**License Compatibility**: All license types
**Pattern Reference**: scenarios/create-packages-from-harvest.md
Would you like me to show the exact request body format?
User: "Can my processing license access /plants/v2/vegetative?"
Your Response:
NO. Processing licenses (AU-P-######) CANNOT access plant endpoints.
[Load patterns/license-types.md for complete details]
**Processing licenses CAN access**:
- /packages/v2/*
- /items/v2/*
- /processingjobs/v2/*
- /labtests/v2/*
**Processing licenses CANNOT access**:
- ❌ /plants/v2/* (any plant endpoint)
- ❌ /plantbatches/v2/* (any plant batch endpoint)
Attempting to call /plants/v2/vegetative with a processing license will result in:
- HTTP 401 Unauthorized or 403 Forbidden
- Error: "No valid endpoint found" or "Insufficient permissions"
**Pattern Reference**: patterns/license-types.md
Would you like to see package endpoints available to processing licenses instead?
User: "Show me the request format for POST /packages/v2/adjust"
Your Response:
The POST /packages/v2/adjust endpoint adjusts package quantities or weights.
[Load categories/packages.md for endpoint list]
[Read collections/metrc-packages.postman_collection.json for exact format]
**Endpoint**: POST /packages/v2/adjust
**License Compatibility**: All license types
**Required Query Param**: licenseNumber
**Request Body** (array of objects):
[Show exact JSON structure from collection file]
**Laravel Example**:
[Show code implementation]
**Pattern References**:
- categories/packages.md
- patterns/batch-operations.md (for array-based requests)
Would you like to see common adjustment scenarios?
User: "How should I handle Metrc pagination?"
Your Response:
Metrc uses pageNumber and pageSize query parameters for pagination.
[Load patterns/pagination.md]
**Standard Pattern**:
- pageNumber: 1-indexed (starts at 1, not 0)
- pageSize: Typically 50, 100, or 200 (varies by endpoint)
- Iterate until results.length < pageSize
**Laravel Example**:
[Show iteration code from pattern file]
**Pattern Reference**: patterns/pagination.md
Would you like to see this applied to a specific endpoint?
✅ Cultivation (AU-C-######): Plants, Plant Batches, Harvests, Packages
✅ Processing (AU-P-######): Packages, Items, Lab Tests (NO plants)
✅ Retail (AU-R-######): Sales, Packages, Transfers (NO plants)
✅ Testing Lab (AU-L-######): Lab Tests only
❌ Plant endpoints will return 401/403 for non-cultivation licenses
✅ ALL endpoints require licenseNumber query parameter
✅ Date format: ISO 8601 (2025-01-15 or 2025-01-15T13:30:00Z)
✅ Batch operations: Most POST/PUT accept arrays of objects
✅ Pagination: Use pageNumber and pageSize query params
✅ Content-Type: application/json for POST/PUT requests
❌ Recommending plant endpoints for non-cultivation licenses
❌ Forgetting licenseNumber query parameter
❌ Using wrong date format (must be ISO 8601)
❌ Not handling pagination for large datasets
❌ Missing Content-Type header on POST/PUT
❌ Inventing MetrcApi method names — use the real ones below
IMPORTANT: App\Services\Api\MetrcApi has 147+ public methods. The get()/post()/put() methods are PROTECTED — they enforce caching, rate limiting, and metrics internally. Always use public methods.
// Packages
$api->one_day_of_packages($facility, $carbonDate); // Active packages for one day
$api->one_day_of_inactive_packages($facility, $carbonDate); // Inactive packages for one day
$api->package($label); // Single package by label
$api->intransit_packages($facility); // In-transit packages
$api->package_adjustments($facility); // Adjustment history
$api->adjustment_reasons($facility); // Adjustment reason options
$api->lab_results($packageId, $facility); // Lab results for a package
// Plants (CULTIVATION ONLY)
$api->plants($facility); // All flowering plants
$api->plants_vegetative($facility); // Vegetative plants
$api->plant($facility, $tag); // Single plant by tag
$api->plant_batches($facility); // Plant batches
// Transfers
$api->fetch_transfers_bulk($facility, $type, $start, $end, $totalPages); // Bulk transfer fetch
$api->one_day_of_transfers($facility, $type, $carbonDate); // Transfers for one day
$api->deliveries($transferId, $license); // Deliveries for a transfer
$api->delivery_packages($deliveryId, $license); // Packages in a delivery
$api->delivery_packages_wholesale($deliveryId, $license); // Wholesale package details
// Reference Data
$api->strains($facility); // All strains
$api->strain($facility, $id); // Single strain
$api->locations($facility); // All locations
$api->categories($facility); // Item categories
$api->active_items($facility); // Active items
$api->facilities(); // All facilities
$api->waste_reasons($facility); // Waste reasons
$api->waste_methods(); // Waste methods
$api->employees($facility); // Employees
$api->sales_deliveries($facility); // Sales deliveries (RETAIL ONLY)
// Package Operations
$api->packages_adjust($license, $adjustments); // Adjust package quantities
$api->create_packages($license, $packages); // Create new packages
$api->create_packages_from_harvest($license, $packages); // Packages from harvest
$api->create_testing_packages($license, $packages); // Testing packages
// Plant Operations (CULTIVATION ONLY)
$api->move_plants($license, $plants); // Move plants to location
$api->change_plant_growth_phase($license, $plants); // Vegetative → Flowering
$api->harvest_plant($license, $plants); // Harvest plants
$api->destroy_plants($license, $plants); // Destroy plants
$api->waste_plants($license, $wasteData); // Record plant waste
// Item Operations
$api->create_items($license, $items); // Create items
$api->delete_item($license, $itemId); // Delete item
// Harvest Operations
$api->record_waste($license, $harvests); // Record harvest waste
// Memory-safe paginated access (for large datasets)
$api->get_cached_packages_page($facility, $page, $perPage);
$api->get_cached_plants_page($facility, $page, $perPage, $growthPhase);
$api->get_cached_harvests($facility);
$api->get_cached_packages_count($facility);
Help users successfully integrate with Metrc API by:
You have complete knowledge of all 290+ Metrc API v2 endpoints via modular, focused files. Use progressive disclosure to provide fast, relevant answers!
development
Use this skill when generating ZPL code, working with ZPL commands, creating Zebra printer labels, or troubleshooting ZPL syntax and formatting issues.
development
Use this skill to verify that code aligns with BudTags coding standards, architectural patterns, and conventions before or after implementation.
development
Use this skill when working with Unleashed Software inventory/order management API integration, syncing inventory, importing orders, managing stock adjustments, or handling customer/product data from Unleashed.
data-ai
TanStack Virtual patterns for virtualized lists, tables, and grids with high-performance rendering of large datasets