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:
| Parameter | Type | Description | |
|---|---|---|---|
uid |
int | Required | Your API user ID |
password |
string | Required | Your API password |
<?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:
{
"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:
| Field | Type | Description |
|---|---|---|
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:
POST /quick-get?term=coronavirus&geo=US
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
| Field | Type | Description |
|---|---|---|
id | int | Internal trend ID |
term | string | Trend keyword |
region | string | Two-letter region code |
description | string | Brief description of the trend |
Source & Type
| Field | Type | Description |
|---|---|---|
source.id | int | Internal source ID |
type.company | boolean | 1 if trend refers to a company |
type.concept | boolean | 1 if trend refers to a concept |
type.person | boolean | 1 if trend refers to a person |
type.product | boolean | 1 if trend refers to a product |
Pace & Opportunity
| Field | Type | Description |
|---|---|---|
pace.value | int | Yearly pace (0–3) |
pace.formatted | string | Pace in words (e.g. "Growing") |
pace.type.value | int | Current pace type (0–3) |
pace.type.formatted | string | Pace type in words (e.g. "Rapid") |
peaking | boolean | 1 if the trend is peaking now |
opportunity.value | int | Opportunity level (0–3) |
opportunity.formatted | string | Opportunity level in words |
Data & Chart
| Field | Type | Description |
|---|---|---|
data.values | array | Time series of interest level (timestamp + value 0–100) |
data.peaks | int | Number of peaks identified this year |
data.stats.minValue | int | Min interest value (0–100) |
data.stats.maxValue | int | Max interest value (0–100) |
data.stats.avgValue | int | Average interest value (0–100) |
data.forecast | array | Forecasted interest for the next 6 months |
Last Peak
| Field | Type | Description |
|---|---|---|
data.lastPeak.current | boolean | 1 if currently peaking |
data.lastPeak.time.unix | int | Unix timestamp of last peak |
data.lastPeak.time.formatted | string | Date of last peak (YYYY-MM-DD) |
data.lastPeak.value | int | Peak value (0–100) |
data.lastPeak.growth.percentage | int | Growth percentage of last peak |
data.lastPeak.growth.start.time | object | When the growth started (unix + formatted) |
data.lastPeak.growth.start.value | int | Interest value at growth start |
data.lastPeak.span.days | int | Total days to reach peak |
data.lastPeak.insights | object | Boolean flags: today, thisWeek, thisMonth, lastWeek, lastMonth, lastThreeMonths, thisYear |
Microdata & Related
| Field | Type | Description |
|---|---|---|
microdata.searches.average | int | Average monthly Google searches |
microdata.threads.total | int | Forum threads discussing this trend (last 3 months) |
related.google.rising | array | Related rising terms from Google |
related.google.top | array | Top related terms from Google |
related.amazon | array | Related terms from Amazon |
related.youtube | array | Related terms from YouTube |
Timestamps
| Field | Type | Description |
|---|---|---|
spotted | int | Unix timestamp when the trend was first spotted |
updated | int | Unix 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
{
"code": 7,
"status": 404,
"data": "API Issue: Env Error (ref. ge-1494421417-559982920)",
"ref": "ge-1494421417-559982920"
}
All codes
| Code | HTTP | Message | Description |
|---|---|---|---|
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 |