API Documentation

Integrate coanalysis into your cannabis compliance workflow with our powerful REST API.

99.9% Uptime
Complete Documentation
Real-time Updates

Getting Started

Authentication

All API requests require authentication using API keys. Generate your API key in the dashboard settings.

Authorization: Bearer YOUR_API_KEY

Base URL

All API endpoints are relative to the base URL:

https://api.coanalysis.io/v1

Certificates API

Get Certificates

GET

Retrieve a list of all certificates for your account.

GET /certificates

Query Parameters

ParameterTypeDescription
limitintegerNumber of results to return (default: 50, max: 100)
offsetintegerNumber of results to skip (default: 0)
statusstringFilter by status: active, expired, pending

Response Example

{
  "data": [
    {
      "id": "cert_123",
      "name": "Blue Dream COA - Batch #BD2024001",
      "product_id": "prod-001",
      "lab_name": "Pacific Lab Services",
      "test_date": "2024-01-15",
      "expiry_date": "2025-01-15",
      "status": "active",
      "file_url": "https://files.coanalysis.io/cert_123.pdf",
      "created_at": "2024-01-16T10:30:00Z"
    }
  ],
  "pagination": {
    "total": 25,
    "limit": 50,
    "offset": 0
  }
}

Upload Certificate

POST

Upload a new Certificate of Analysis.

POST /certificates

Request Body (multipart/form-data)

FieldTypeRequiredDescription
namestringYesCertificate name
product_idstringYesAssociated product ID
lab_namestringYesTesting laboratory name
filefileYesPDF file (max 10MB)

Products API

Get Products

GET

Retrieve your product catalog with linked certificates.

GET /products

Response Example

{
  "data": [
    {
      "id": "prod-001",
      "name": "Blue Dream",
      "sku": "BD-001",
      "category": "flower",
      "status": "active",
      "shopify_id": "shopify-123",
      "certificates": [
        {
          "id": "cert_123",
          "name": "Blue Dream COA - Batch #BD2024001",
          "status": "active",
          "expiry_date": "2025-01-15"
        }
      ],
      "created_at": "2024-01-10T08:00:00Z"
    }
  ]
}

Widget API

Generate Widget

POST

Generate embeddable widget code for a product.

POST /widgets/generate

Request Body

{
  "product_id": "prod-001",
  "style": "minimal", // or "detailed"
  "show_expiry": true,
  "theme": "light" // or "dark"
}

Response

{
  "widget_id": "widget_abc123",
  "embed_code": "<iframe src='https://widgets.coanalysis.io/widget_abc123' width='300' height='200'></iframe>",
  "preview_url": "https://widgets.coanalysis.io/preview/widget_abc123"
}

Error Codes

CodeStatusDescription
400Bad RequestInvalid request parameters
401UnauthorizedInvalid or missing API key
403ForbiddenInsufficient permissions
404Not FoundResource not found
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error occurred

Rate Limits & Token Usage

API Rate Limits

  • Free Trial: 100 requests per hour
  • Monthly Plan: 5,000 requests per hour

Rate limit headers are included in all responses: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

Token Usage

  • Monthly Plan: 50 tokens included
  • Certificate Upload: 1 token per upload
  • Additional Tokens: Available for purchase

Token balance is returned in API responses: X-Token-Balance, X-Token-Used

Need Help?

Our developer support team is here to help you integrate with the coanalysis API.