Skip to main content

Overview

The High IQ API is a RESTful JSON API built on Hono and deployed to Vercel Edge Functions. It provides access to cannabis strain data, AI-powered report generation, label scanning, and research intelligence. All endpoints are prefixed with /api/v1/ and return consistent JSON response envelopes.

Base URL

https://tiwih-api.vercel.app/api/v1/

Versioning

The API uses URL-based versioning. The current and only version is v1. All endpoints are served under the /api/v1/ prefix.
https://tiwih-api.vercel.app/api/v1/strains
https://tiwih-api.vercel.app/api/v1/strains/search?q=blue+dream
https://tiwih-api.vercel.app/api/v1/reports/stream/batch
When breaking changes are introduced, a new version prefix (e.g., /api/v2/) will be added while maintaining backward compatibility on existing versions.

Response Format

Every API response follows a consistent envelope format, making it predictable to parse on the client side.

Success Response

All successful responses return success: true with a data field containing the response payload and an optional meta field for pagination and request metadata.
{
  "success": true,
  "data": {
    "strain": {
      "id": 42,
      "name": "Blue Dream",
      "type": "hybrid"
    }
  },
  "meta": {
    "timestamp": "2026-02-16T12:00:00.000Z",
    "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Success Response with Pagination

List endpoints include pagination metadata when applicable.
{
  "success": true,
  "data": [
    { "id": 1, "name": "Blue Dream" },
    { "id": 2, "name": "OG Kush" }
  ],
  "meta": {
    "pagination": {
      "limit": 20,
      "offset": 0,
      "total": 1247,
      "hasMore": true
    },
    "timestamp": "2026-02-16T12:00:00.000Z",
    "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
}

Error Response

All error responses return success: false with a structured error object containing a machine-readable code and a human-readable message.
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Strain not found: purple-unicorn",
    "details": {
      "resource": "Strain",
      "id": "purple-unicorn"
    }
  },
  "meta": {
    "timestamp": "2026-02-16T12:00:00.000Z",
    "requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "path": "/api/v1/strains/slug/purple-unicorn",
    "method": "GET"
  }
}

TypeScript Interfaces

The API response types are defined in TypeScript for type-safe client consumption.
// Success response
interface ApiSuccessResponse<T = unknown> {
  success: true;
  data: T;
  meta?: {
    pagination?: {
      limit: number;
      offset: number;
      total: number;
      hasMore?: boolean;
    };
    timestamp?: string;
    requestId?: string;
    [key: string]: unknown;
  };
}

// Error response
interface ApiErrorResponse {
  success: false;
  error: {
    code: string;
    message: string;
    details?: unknown;
    stack?: string; // Only in non-production environments
  };
  meta?: {
    timestamp?: string;
    requestId?: string;
    path?: string;
    method?: string;
  };
}

Quick Start

Fetch a strain by slug with a simple curl command:
curl -s "https://tiwih-api.vercel.app/api/v1/strains/slug/blue-dream/complete" | jq
Search for strains:
curl -s "https://tiwih-api.vercel.app/api/v1/strains/search?q=gorilla+glue&limit=5" | jq

Request IDs

Every response includes a unique requestId in the meta object. Include this ID when reporting issues or debugging unexpected behavior. The request ID is generated server-side and is consistent across the entire request lifecycle.
Stack traces in error responses are only included in non-production environments. Production errors return structured codes and messages without exposing internal details.

Content Type

The API accepts and returns application/json for all standard endpoints. Streaming endpoints (SSE) return text/event-stream. Set your request headers accordingly:
curl -X POST "https://tiwih-api.vercel.app/api/v1/reports/stream/batch" \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{"sectionKeys": ["overview"]}'

HTTP Methods

MethodUsage
GETRead resources (strains, search, cache stats)
POSTCreate resources, trigger operations (reports, scans, submissions)
PUTFull resource replacement (rare)
PATCHPartial resource updates
DELETERemove resources
Most public-facing endpoints are GET requests. POST is used for operations that require a request body, such as report streaming and label scanning.