Treendly API Reference

A REST API to retrieve trend data, powered by Treendly.com

Rate limit: 60 requests per minute.
For any tech issues, just reach out to: [email protected]

Enterprise only. The API is available exclusively to Enterprise customers. Each client receives a unique UID and password generated by Treendly.

Base URL

The base URL for all API requests is:

https://treendly.com/api

Authorization

All POST requests must be authorized by passing the following parameters to the request:

ParameterTypeDescription
uid int Required Your API user ID
password string Required Your API password
php — authentication example
<?php

$url = 'https://treendly.com/api/[METHOD]/[ENDPOINT]';

$data = [
    'uid'      => 'your_uid',
    'password' => 'your_password',
    'term'     => 'matcha',
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Via: api']);
curl_setopt($ch, CURLOPT_USERAGENT, 'Treendly');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$result = curl_exec($ch);
$response = json_decode($result, true);

if ($response['status'] !== 200) {
    // Handle error
}

print_r($response);
?>

Response format

Every response includes code, status, and data fields:

json
{
  "code": 1,
  "status": 200,
  "data": "Success"
}

Quick Get

Returns a quick analysis of a term.

POST /quick-get

Parameters

Parameter Type Description
term int Required The keyword or trend term to look up
geo string Optional Two-letter code of a country. The default is US.
view int Optional 1 or 5. Returns a 1-year or 5-year time series of the trend data. The default value is 5.

Response

Returns a JSON object with the following properties:

FieldTypeDescription
attributes object Trend attributes
attributes.trend object Core trend metrics
attributes.trend.average number Average interest value
attributes.trend.pace string Growth pace classification
attributes.trend.pace_type string Type of pace (e.g. Rapid, Steady)
trend array A time series of the trend data

Example

Request:

request
POST /quick-get?term=coronavirus&geo=US

Response:

json — response
{
  "code": 1,
  "status": 200,
  "data": "Success",
  "attributes": {
    "trend": {
      "average": 68,
      "pace": "Growing",
      "pace_type": "Rapid"
    }
  },
  "trend": [
    { "time": "1555200000", "value": 42 },
    { "time": "1555804800", "value": 38 },
    { "time": "1556409600", "value": 41 },
    ...
  ]
}

Response Fields

Detailed field reference for the trends array returned by the API.

Trend object

FieldTypeDescription
idintInternal trend ID
termstringTrend keyword
regionstringTwo-letter region code
descriptionstringBrief description of the trend

Source & Type

FieldTypeDescription
source.idintInternal source ID
type.companyboolean1 if trend refers to a company
type.conceptboolean1 if trend refers to a concept
type.personboolean1 if trend refers to a person
type.productboolean1 if trend refers to a product

Pace & Opportunity

FieldTypeDescription
pace.valueintYearly pace (0–3)
pace.formattedstringPace in words (e.g. "Growing")
pace.type.valueintCurrent pace type (0–3)
pace.type.formattedstringPace type in words (e.g. "Rapid")
peakingboolean1 if the trend is peaking now
opportunity.valueintOpportunity level (0–3)
opportunity.formattedstringOpportunity level in words

Data & Chart

FieldTypeDescription
data.valuesarrayTime series of interest level (timestamp + value 0–100)
data.peaksintNumber of peaks identified this year
data.stats.minValueintMin interest value (0–100)
data.stats.maxValueintMax interest value (0–100)
data.stats.avgValueintAverage interest value (0–100)
data.forecastarrayForecasted interest for the next 6 months

Last Peak

FieldTypeDescription
data.lastPeak.currentboolean1 if currently peaking
data.lastPeak.time.unixintUnix timestamp of last peak
data.lastPeak.time.formattedstringDate of last peak (YYYY-MM-DD)
data.lastPeak.valueintPeak value (0–100)
data.lastPeak.growth.percentageintGrowth percentage of last peak
data.lastPeak.growth.start.timeobjectWhen the growth started (unix + formatted)
data.lastPeak.growth.start.valueintInterest value at growth start
data.lastPeak.span.daysintTotal days to reach peak
data.lastPeak.insightsobjectBoolean flags: today, thisWeek, thisMonth, lastWeek, lastMonth, lastThreeMonths, thisYear

Microdata & Related

FieldTypeDescription
microdata.searches.averageintAverage monthly Google searches
microdata.threads.totalintForum threads discussing this trend (last 3 months)
related.google.risingarrayRelated rising terms from Google
related.google.toparrayTop related terms from Google
related.amazonarrayRelated terms from Amazon
related.youtubearrayRelated terms from YouTube

Timestamps

FieldTypeDescription
spottedintUnix timestamp when the trend was first spotted
updatedintUnix timestamp when the trend was last updated

Status Codes

The API uses internal codes alongside HTTP status codes. A successful request returns internal code 1 with status 200.

Error response example

json — error
{
  "code": 7,
  "status": 404,
  "data": "API Issue: Env Error (ref. ge-1494421417-559982920)",
  "ref": "ge-1494421417-559982920"
}

All codes

CodeHTTPMessageDescription
1 200 Success Request completed successfully
0 404 Unknown Error An unexpected error occurred
2 403 HTTPS Required Requests must be made over HTTPS
3 401 Authentication Required Missing credentials
4 403 Authentication Failed Invalid UID or password
5 400 Invalid Request Invalid method or parameters
7 424 API Issue Server-side error — try again later
8 424 Remote Connection Problem Third-party resource unavailable