{"openapi":"3.0.3","info":{"title":"CannaGuard Compliance API","version":"1.1.0","contact":{"name":"CannaGuard Support","email":"CannaGuardsystems@outlook.com"},"description":"New Jersey cannabis compliance infrastructure (N.J.A.C. § 17:30). Every request takes `state: \"NJ\"`; any other value returns `422 unsupported_state`. Authenticate with an `x-api-key` header.\n\n**Environments.** Keys prefixed `sk_live_` evaluate live statutory rules and count towards metered billing. Keys prefixed `sk_test_` never consume metered billing, and sandbox behaviour differs by path: the current endpoints under `/api/public/v1/compliance/*` evaluate sandbox traffic against the same live rule set (so responses are realistic), while the legacy aliases `/api/public/v1/verify-ad` and `/api/public/v1/check-equivalency` return deterministic mock payloads. Build against `/compliance/*`.\n\n**Sandbox tier limits.** The free Developer tier requires a verified corporate developer email (disposable domains are blocked) and allows **1,000 sandbox calls per month**, a hard burst cap of **5 requests per minute**, and up to **2 active sandbox keys** per organization.\n\n**Active production key limits.** Dispensary Shield 2, Premium Platform & POS 5, Predictive Platform 10. Every sandbox JSON response carries `sandbox: true` and a `_warning` field set to `[SANDBOX TEST PAYLOAD - NOT FOR LIVE PRODUCTION CHECKOUT]`. Never use a sandbox response to authorise a live checkout.\n\n**Rate limits.** Enforced per key, per calendar minute (Developer sandbox 5, Dispensary Shield 120, Premium Platform & POS 3,000, Predictive Platform 3,000 requests per minute, or an account-specific override set from the client dashboard). Exceeding the limit returns `429` with `retry-after` and `x-ratelimit-limit` headers. Accounts with Automatic Overage Billing enabled continue to be served beyond their monthly allowance at tiered metered rates (Dispensary Shield $0.020, Premium Platform & POS $0.012, Predictive Platform: includes 3M API calls/mo; usage beyond 3M is automatically billed at $0.020/call) instead of being hard-capped.\n\n**Webhook retries.** Failed `rule.updated` deliveries are retried automatically with exponential backoff and jitter at roughly 1m, 5m, 30m, 2h and 6h; an endpoint is paused after sustained failures."},"servers":[{"url":"https://cannaguardsystems.com"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"},"BearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Violation":{"type":"object","properties":{"code":{"type":"string","example":"violates_njac_17_30_17_2"},"clause":{"type":"string","example":"Prohibits non-property billboard ads"},"reason":{"type":"string","example":"Contains claims of medical efficacy without approval"},"suggested_fix":{"type":"string","example":"Cannabis products have not been analyzed or approved by the FDA."}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}},"example":{"error":{"code":"unsupported_state","message":"State 'TX' is currently in sandbox preview. Active live validation supported for NJ."}}}}},"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"paths":{"/v1/nj/purchase-limit/validate":{"post":{"summary":"Validate a single NJ transaction against the per-transaction purchase limit","description":"Per-transaction validation only: each cart is checked on its own. No customer identifiers are accepted, stored, or pooled across stores, and no cumulative history lookups are made. Visual auditing and regulatory oversight are handled through the dispensary's 24/7 surveillance and camera feeds. 1 oz flower = 5 g concentrate = 1000 mg THC edibles. Optional header `X-CannaGuard-Env: SANDBOX | LIVE` must match the key type.","operationId":"validatePurchaseLimit","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["dispensary_id","cart_items"],"properties":{"dispensary_id":{"type":"string"},"cart_items":{"type":"array","items":{"type":"object","required":["category","weight_grams"],"properties":{"category":{"type":"string","example":"flower"},"weight_grams":{"type":"number","example":14},"thc_mg":{"type":"number","description":"Edibles only; preferred over weight_grams."}}}}}}}}},"responses":{"200":{"description":"approved true/false with total_ounce_equivalency, remaining_allowance_ounces, statute_reference; rejections include reason and violation_code LIMIT_EXCEEDED."},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/compliance/ad-check":{"post":{"summary":"Check ad copy against NJ advertising rules","operationId":"adCheck","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ad_copy","target_channel"],"properties":{"ad_copy":{"type":"string"},"target_channel":{"type":"string","example":"instagram"}}}}}},"responses":{"200":{"description":"compliant boolean and flagged_rules array with severity (high | medium)."},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/public/v1/verify-ad":{"post":{"summary":"Verify advertising or promotional copy","operationId":"verifyAd","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["state"],"properties":{"text":{"type":"string","example":"50% off gummies this weekend!"},"media_url":{"type":"string","format":"uri"},"state":{"type":"string","example":"NJ"},"channel":{"type":"string","enum":["sms","social","print"]}}}}}},"responses":{"200":{"description":"Compliance decision","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["APPROVED","REJECTED"]},"violations":{"type":"array","items":{"$ref":"#/components/schemas/Violation"}}}}}}},"401":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unprocessable payload","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/public/v1/check-equivalency":{"post":{"summary":"Check a cart against the daily purchase limit","operationId":"checkEquivalency","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["state","items"],"properties":{"state":{"type":"string","example":"NJ"},"items":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["flower","concentrate","edible"]},"weight_grams":{"type":"number","example":14},"thc_mg":{"type":"number","example":100}}}}}}}}},"responses":{"200":{"description":"Equivalency result","content":{"application/json":{"schema":{"type":"object","properties":{"is_compliant":{"type":"boolean"},"current_oz_equivalent":{"type":"number","example":0.62},"max_allowed_oz":{"type":"number","example":1},"remaining_allowance_oz":{"type":"number","example":0.38}}}}}},"401":{"description":"Missing or invalid API key"},"422":{"description":"Unprocessable payload"},"429":{"description":"Rate limit exceeded"}}}},"/api/public/v1/compliance/rules":{"get":{"summary":"Current active regulatory rules by state","operationId":"getRules","parameters":[{"name":"state_code","in":"query","schema":{"type":"string","default":"NJ"}}],"responses":{"200":{"description":"Active limits, prohibited terms and label verbiage"}}}}},"x-webhooks":{"rule.updated":{"description":"Sent when a state regulatory rule is created or updated. Payload is signed with HMAC-SHA256 over the raw body in the `x-cannaguard-signature` header as `sha256=<hex>`."}}}