StrainAPI V1 • Developer Documentation

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.

Versionv1
StatusLive
AuthenticationNone
FormatJSON
ProtocolHTTPS
AccessRead-only
30-second quick start

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"]
}
Live data: Example values illustrate the API structure. Records may change as the database is updated. Applications should treat live API responses as the current data source.

Base URL

https://www.strainapi.com/wp-json/strainapi/v1

All documented V1 routes use this namespace.

Endpoints

V1 exposes three public GET endpoints.

GET/strains

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
ParameterTypeDefaultDescription
pageinteger1Results page; minimum 1.
per_pageinteger20Records per page; maximum 100.
GET https://www.strainapi.com/wp-json/strainapi/v1/strains?per_page=20&page=1
GET/strains/{slug}

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
GET/search?q={query}

Search strains

Searches published strain records and returns compact results.

ParameterTypeDescription
qstringSearch 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.

FieldTypeDescription
idintegerPublic record identifier.
namestringCanonical API strain name.
display_titlestringFull WordPress display title on detailed records.
slugstringURL-safe identifier used by the detail endpoint.
urlstringPublic strain webpage.
excerptstring/nullShort summary when available.
imageobject/nullFeatured image URL, dimensions, and alt text.
breederstring/nullDocumented breeder information.
geneticsstring/nullKnown or reported lineage.
typestring/nullCultivar type classification.
indica_percentnumber/nullReported indica percentage.
sativa_percentnumber/nullReported sativa percentage.
seed_typestring/nullSeed type when documented.
thcobjectTHC value/range and percent unit.
cbdobjectCBD value/range and percent unit.
terpenesarrayDocumented terpene names.
floweringobjectMinimum/maximum flowering days.
aromamixedDocumented aroma information.
flavormixedDocumented flavor information.
outdoor_harveststring/nullDetailed-record harvest information.
plant_structurestring/nullDetailed-record plant structure.
yieldstring/nullDetailed-record yield information.
effectsobjectMental/body effects when documented.
evidenceobject/arrayEvidence states exposed by the detailed record.
published_atstring/nullPublication timestamp.
updated_atstring/nullLast update timestamp where exposed.
descriptionstring/nullDetailed plain-text/content description.
content_htmlstring/nullDetailed HTML content.
Evidence states: where evidence states are exposed, V1 restricts them to 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.

BehaviorV1
CORSPublic origin access for GET/OPTIONS; credentials are not required.
Cache-Controlpublic, max-age=60, s-maxage=300
Version headerX-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.

Developer note: Exact public usage limits and access policies may evolve as the service grows. Do not design an application around an assumed unlimited request rate.

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.

Start building

Explore the StrainAPI database.

Use the public V1 endpoints or browse the human-readable strain library.

Open APIBrowse Cannabis Strains