Green/Red/Flagger
API DOCUMENTATION

Public API.

Read-only REST API. JSON response, CORS open, 60 requests per minute (per key). To create a key, go to Settings → API keys.

Authentication

All requests require an Authorization header.

Authorization: Bearer grf_xxxxxxxxxxxxxxxxxxxxxx

Rate limit + CORS

Endpoints

GEThttps://greenredflagger.com/api/public/flags

List approved flags, filter and sort.

Query parameters
sort - 'net' (default), 'total', 'controversial', 'newest'
category - CHARACTER, BEHAVIORAL, CULTURAL, RELATIONSHIP, ...
region - 'world' (region NULL), or ISO code (TR, US, DE, ...)
dominant - 'red', 'green', 'yellow' (warning: post-filter)
limit - default 20, max 100
offset - pagination, default 0
Example
curl -H "Authorization: Bearer grf_xxx..." \
  "https://greenredflagger.com/api/public/flags?sort=net&category=CHARACTER&limit=10"

{
  "count": 10,
  "sort": "net",
  "limit": 10,
  "offset": 0,
  "data": [
    {
      "id": "cln...",
      "slug": "yaslilara-saygi-gosteriyor",
      "category": "CHARACTER",
      "region": null,
      "text": {
        "tr": "Yaslilara saygi gosteriyor",
        "en": "Respects the elderly",
        "de": "Respektiert altere Menschen",
        "es": "Respeta a los mayores"
      },
      "votes": {
        "red": 4200,
        "green": 198400,
        "total": 202600,
        "net": -194200
      },
      "dominant": "green",
      "createdAt": "2026-05-25T..."
    }
  ]
}
GEThttps://greenredflagger.com/api/public/flag/[slug]

A single flag, including description + contexts.

Example
curl -H "Authorization: Bearer grf_xxx..." \
  "https://greenredflagger.com/api/public/flag/yaslilara-saygi-gosteriyor"

{
  "id": "cln...",
  "slug": "yaslilara-saygi-gosteriyor",
  "category": "CHARACTER",
  "region": null,
  "contexts": ["ROMANTIC", "FRIEND", "FAMILY"],
  "text": { "tr": "...", "en": "...", "de": "...", "es": "..." },
  "description": { "tr": null, "en": null, "de": null, "es": null },
  "votes": { "red": 4200, "green": 198400, "total": 202600, "net": -194200 },
  "dominant": "green",
  "createdAt": "2026-05-25T..."
}
GEThttps://greenredflagger.com/api/public/flag/[slug]/trend

The flag's daily vote snapshot time series (red/green/net over time). For drawing a trend chart.

Query parameters
days - number of days back, default 30, max 90
Example
curl -H "Authorization: Bearer grf_xxx..." \
  "https://greenredflagger.com/api/public/flag/sigara-iciyor/trend?days=14"

{
  "slug": "sigara-iciyor",
  "days": 14,
  "count": 14,
  "current": { "red": 18000, "green": 2000, "total": 20000, "net": 16000 },
  "snapshots": [
    {
      "at": "2026-05-15T00:00:00.000Z",
      "red": 17200,
      "green": 1850,
      "total": 19050,
      "net": 15350
    },
    ...
  ]
}
GEThttps://greenredflagger.com/api/public/categories

All categories + approved flag counts.

Example
curl -H "Authorization: Bearer grf_xxx..." \
  "https://greenredflagger.com/api/public/categories"

{
  "count": 8,
  "data": [
    { "slug": "character", "enum": "CHARACTER", "count": 73 },
    { "slug": "behavioral", "enum": "BEHAVIORAL", "count": 45 },
    ...
  ]
}
GEThttps://greenredflagger.com/api/public/regions

All regions + approved flag counts. region NULL = 'world'.

Example
curl -H "Authorization: Bearer grf_xxx..." \
  "https://greenredflagger.com/api/public/regions"

{
  "count": 12,
  "data": [
    { "code": null, "label": "world", "count": 240 },
    { "code": "TR", "label": "TR", "count": 32 },
    { "code": "DE", "label": "DE", "count": 12 },
    ...
  ]
}
GEThttps://greenredflagger.com/api/public/stats

Global statistics: flag/user/vote counts, 24h/7d/30d activity, top 5 categories.

Example
curl -H "Authorization: Bearer grf_xxx..." \
  "https://greenredflagger.com/api/public/stats"

{
  "flags": {
    "total": 294,
    "redDominant": 115,
    "greenDominant": 179,
    "mixed": 0,
    "addedLast24h": 5
  },
  "users": { "total": 142 },
  "votes": {
    "total": 12450,
    "last24h": 240,
    "last7d": 1820,
    "last30d": 8200
  },
  "topCategories": [
    { "slug": "character", "enum": "CHARACTER", "count": 73 },
    ...
  ],
  "generatedAt": "2026-05-28T..."
}
GEThttps://greenredflagger.com/api/public/search

Full-text search (Postgres tsvector, 4 languages supported). 2+ characters, prefix-match.

Query parameters
qrequired - Search query, at least 2 characters
limit - default 20, max 50
Example
curl -H "Authorization: Bearer grf_xxx..." \
  "https://greenredflagger.com/api/public/search?q=sigara&limit=5"

{
  "count": 3,
  "q": "sigara",
  "data": [
    {
      "id": "cln...",
      "slug": "sigara-iciyor",
      "category": "BEHAVIORAL",
      "region": null,
      "text": { "tr": "Sigara iciyor", "en": "Smokes", ... },
      "votes": { "red": 18000, "green": 2000, "total": 20000, "net": 16000 },
      "dominant": "red",
      "rank": 0.0759
    }
  ]
}

Error codes

This API serves user-voted community data. The returned content is for entertainment, not scientific data. Using it with attribution is encouraged; keys may be revoked in case of abuse.