StrainAPI Developer Documentation
Build with structured cannabis strain data using the public, read-only StrainAPI REST API. Start with one GET request, search the database, browse published strains, or retrieve a detailed individual record.
Make your first request.
No API key is currently required. Send a GET request and receive JSON.
curl "https://www.strainapi.com/wp-json/strainapi/v1/strains?per_page=5"
Example record shape:
{
"id": 3209,
"name": "Swoon",
"slug": "swoon",
"breeder": "Cresco Labs x Purple City Genetics",
"genetics": "F1 Durb x Gushers x Street Guru",
"type": "Hybrid",
"thc": {
"value": null,
"min": 19.85,
"max": 27.99,
"unit": "%"
},
"terpenes": ["Limonene", "Beta-Caryophyllene", "Myrcene"]
}Base URL
https://www.strainapi.com/wp-json/strainapi/v1
All documented V1 routes use this namespace.
Endpoints
V1 exposes three public GET endpoints.
List cannabis strains
Returns published strains in the compact response format. Use it for browsing, listings, synchronization, and paginated datasets.
GET https://www.strainapi.com/wp-json/strainapi/v1/strains
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Results page; minimum 1. |
per_page | integer | 20 | Records per page; maximum 100. |
GET https://www.strainapi.com/wp-json/strainapi/v1/strains?per_page=20&page=1
Retrieve one strain
Returns the detailed record for one published strain. Detailed records include additional fields such as description/content, effects, evidence, publication data, and cultivation information when available.
GET https://www.strainapi.com/wp-json/strainapi/v1/strains/swoon
Search strains
Searches published strain records and returns compact results.
| Parameter | Type | Description |
|---|---|---|
q | string | Search query, such as a strain name. |
GET https://www.strainapi.com/wp-json/strainapi/v1/search?q=swoon
Pagination
Use page and per_page with the collection endpoint. The default is 20 records per page and the maximum is 100.
GET https://www.strainapi.com/wp-json/strainapi/v1/strains?per_page=100&page=1
Collection responses expose X-WP-Total and X-WP-TotalPages headers for total records and total pages.
Response structure
Compact records
Collection and search endpoints return efficient records for discovery and listings. Full description/content is intentionally omitted.
Full records
The individual endpoint returns additional available fields including content, effects, evidence, publication data, and cultivation details.
Missing data
StrainAPI does not invent missing information. Missing scalar/object values can be null; missing lists can be []. Clients should handle both.
Field reference
Field availability depends on the source strain record.
| Field | Type | Description |
|---|---|---|
id | integer | Public record identifier. |
name | string | Canonical API strain name. |
display_title | string | Full WordPress display title on detailed records. |
slug | string | URL-safe identifier used by the detail endpoint. |
url | string | Public strain webpage. |
excerpt | string/null | Short summary when available. |
image | object/null | Featured image URL, dimensions, and alt text. |
breeder | string/null | Documented breeder information. |
genetics | string/null | Known or reported lineage. |
type | string/null | Cultivar type classification. |
indica_percent | number/null | Reported indica percentage. |
sativa_percent | number/null | Reported sativa percentage. |
seed_type | string/null | Seed type when documented. |
thc | object | THC value/range and percent unit. |
cbd | object | CBD value/range and percent unit. |
terpenes | array | Documented terpene names. |
flowering | object | Minimum/maximum flowering days. |
aroma | mixed | Documented aroma information. |
flavor | mixed | Documented flavor information. |
outdoor_harvest | string/null | Detailed-record harvest information. |
plant_structure | string/null | Detailed-record plant structure. |
yield | string/null | Detailed-record yield information. |
effects | object | Mental/body effects when documented. |
evidence | object/array | Evidence states exposed by the detailed record. |
published_at | string/null | Publication timestamp. |
updated_at | string/null | Last update timestamp where exposed. |
description | string/null | Detailed plain-text/content description. |
content_html | string/null | Detailed HTML content. |
supported, reported, disputed, and insufficient_data.Code examples
The same public endpoint can be called from common development environments.
curl "https://www.strainapi.com/wp-json/strainapi/v1/strains/swoon"
const response = await fetch(
"https://www.strainapi.com/wp-json/strainapi/v1/strains/swoon"
);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const strain = await response.json();
console.log(strain);import requests url = "https://www.strainapi.com/wp-json/strainapi/v1/strains/swoon" response = requests.get(url, timeout=10) response.raise_for_status() strain = response.json() print(strain)
$url = 'https://www.strainapi.com/wp-json/strainapi/v1/strains/swoon';
$response = wp_remote_get($url);
if (!is_wp_error($response)) {
$strain = json_decode(
wp_remote_retrieve_body($response),
true
);
}Errors
Clients should check the HTTP status before processing a response. Invalid parameters, missing required search input, or a strain slug that does not resolve may produce a WordPress REST error response.
{
"code": "error_code",
"message": "Human-readable error message",
"data": {
"status": 404
}
}Do not build against the example error-code string above. Use the returned HTTP status and live error response.
CORS & caching
V1 is designed for public GET access and includes CORS support for GET/OPTIONS requests. Responses may be cached to improve performance.
| Behavior | V1 |
|---|---|
| CORS | Public origin access for GET/OPTIONS; credentials are not required. |
| Cache-Control | public, max-age=60, s-maxage=300 |
| Version header | X-StrainAPI-Version: v1 |
Request limits
StrainAPI applies reasonable request limits to help maintain service availability. Applications should cache responses where appropriate, avoid unnecessary repeated requests, and use pagination responsibly.
Versioning
The current public namespace is /v1/. V1 is intended to remain backward-compatible. If a future change requires a breaking API contract, it should be introduced under a new version rather than silently changing V1 behavior.
/wp-json/strainapi/v1/...
Usage & disclaimer
StrainAPI provides cannabis cultivar information for informational, educational, scientific, botanical, research, and development purposes. Data availability and confidence can vary by cultivar and source record. Applications should preserve uncertainty rather than converting missing, reported, or disputed information into factual claims.
API availability, documentation, limits, and policies may be updated as the service develops. Developers should periodically review this documentation before relying on operational assumptions.
Explore the StrainAPI database.
Use the public V1 endpoints or browse the human-readable strain library.
Open APIBrowse Cannabis Strains