Keywords

Tracked phrases scoped to joined groups (or word-based on X).

This is not the live API. This page documents an earlier, in-browser mock API (routes like /accounts, /messaging and /brand), kept for reference. The real, read-only API that runs today is described in The API.

Keywords — tracked phrases scoped to groups

Keywords are the tracked phrases that drive listening. platform + groupId scoping is enforced: facebook/reddit keywords must be scoped to a joined community (checked via joinedGroupsFor), X keywords are word-based and must carry no group. Duplicates within the same scope (phrase case-insensitive) are rejected with 409.

Five routes: list (filters by ?platform, ?groupId, ?noGroup), reset to seeds, create, patch (phrase/group/status), and delete. Code: apps/web/src/lib/keywords/server.ts.

GET /keywords — List keywords

Optional ?platform ?groupId ?noGroup. Code: apps/web/src/lib/keywords/server.ts:40

POST /keywords — Create keyword

Validates platform↔group relation, rejects dupes. Code: apps/web/src/lib/keywords/server.ts:57

POST /keywords/reset — Reset keywords to seeds

Code: apps/web/src/lib/keywords/server.ts:50

PATCH /keywords/{id} — Update keyword

Patch phrase/group/status. Code: apps/web/src/lib/keywords/server.ts:99

DELETE /keywords/{id} — Delete keyword

Code: apps/web/src/lib/keywords/server.ts:139

List keywords

Optional ?platform ?groupId ?noGroup. Code: apps/web/src/lib/keywords/server.ts:40

GET/keywords

Query Parameters

platformstring
Value in: "facebook" | "x" | "reddit"
groupIdstring
noGroupstring

Response Body

Keywords.

TypeScript Definitions

Use the response body type in TypeScript.

keywordsRequiredarray<object>
curl -X GET "http://localhost:5174/keywords?platform=facebook&groupId=string&noGroup=string"
fetch("http://localhost:5174/keywords?platform=facebook&groupId=string&noGroup=string")
package mainimport (  "fmt"  "net/http"  "io/ioutil")func main() {  url := "http://localhost:5174/keywords?platform=facebook&groupId=string&noGroup=string"  req, _ := http.NewRequest("GET", url, nil)    res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
import requestsurl = "http://localhost:5174/keywords?platform=facebook&groupId=string&noGroup=string"response = requests.request("GET", url)print(response.text)
{
  "keywords": [
    {
      "property1": null,
      "property2": null
    }
  ]
}

Create keyword

Validates platform↔group relation, rejects dupes. Code: apps/web/src/lib/keywords/server.ts:57

POST/keywords

Request Body

application/jsonRequired
phraseRequiredstring
platformRequiredstring
Value in: "facebook" | "x" | "reddit"
groupIdstring | null | null

Response Body

Created.

TypeScript Definitions

Use the response body type in TypeScript.

keywordRequiredobject

Keyword — tracked phrase + scope.

keywordsRequiredarray<object>

Failure envelope returned with 4xx statuses.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredstring

Human-readable failure reason, e.g. "A key needs a name".

Failure envelope returned with 4xx statuses.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredstring

Human-readable failure reason, e.g. "A key needs a name".

curl -X POST "http://localhost:5174/keywords" \  -H "Content-Type: application/json" \  -d '{    "phrase": "string",    "platform": "facebook",    "groupId": "string"  }'
const body = JSON.stringify({  "phrase": "string",  "platform": "facebook",  "groupId": "string"})fetch("http://localhost:5174/keywords", {  body})
package mainimport (  "fmt"  "net/http"  "io/ioutil"  "strings")func main() {  url := "http://localhost:5174/keywords"  body := strings.NewReader(`{    "phrase": "string",    "platform": "facebook",    "groupId": "string"  }`)  req, _ := http.NewRequest("POST", url, body)  req.Header.Add("Content-Type", "application/json")  res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
import requestsurl = "http://localhost:5174/keywords"body = {  "phrase": "string",  "platform": "facebook",  "groupId": "string"}response = requests.request("POST", url, json = body, headers = {  "Content-Type": "application/json"})print(response.text)
{
  "keyword": {
    "property1": null,
    "property2": null
  },
  "keywords": [
    {
      "property1": null,
      "property2": null
    }
  ]
}
{
  "error": "string"
}
{
  "error": "string"
}

Reset keywords to seeds

Code: apps/web/src/lib/keywords/server.ts:50

POST/keywords/reset

Response Body

Reset keywords.

TypeScript Definitions

Use the response body type in TypeScript.

keywordsRequiredarray<object>
curl -X POST "http://localhost:5174/keywords/reset"
fetch("http://localhost:5174/keywords/reset")
package mainimport (  "fmt"  "net/http"  "io/ioutil")func main() {  url := "http://localhost:5174/keywords/reset"  req, _ := http.NewRequest("POST", url, nil)    res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
import requestsurl = "http://localhost:5174/keywords/reset"response = requests.request("POST", url)print(response.text)
{
  "keywords": [
    {
      "property1": null,
      "property2": null
    }
  ]
}

Update keyword

Patch phrase/group/status. Code: apps/web/src/lib/keywords/server.ts:99

PATCH/keywords/{id}

Request Body

application/jsonRequired
phrasestring
groupIdstring | null | null
statusstring
Value in: "listening" | "paused"

Path Parameters

idRequiredstring

Response Body

Updated.

TypeScript Definitions

Use the response body type in TypeScript.

keywordRequiredobject

Keyword — tracked phrase + scope.

keywordsRequiredarray<object>

Failure envelope returned with 4xx statuses.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredstring

Human-readable failure reason, e.g. "A key needs a name".

Failure envelope returned with 4xx statuses.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredstring

Human-readable failure reason, e.g. "A key needs a name".

Failure envelope returned with 4xx statuses.

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredstring

Human-readable failure reason, e.g. "A key needs a name".

curl -X PATCH "http://localhost:5174/keywords/string" \  -H "Content-Type: application/json" \  -d '{    "phrase": "string",    "groupId": "string",    "status": "listening"  }'
const body = JSON.stringify({  "phrase": "string",  "groupId": "string",  "status": "listening"})fetch("http://localhost:5174/keywords/string", {  body})
package mainimport (  "fmt"  "net/http"  "io/ioutil"  "strings")func main() {  url := "http://localhost:5174/keywords/string"  body := strings.NewReader(`{    "phrase": "string",    "groupId": "string",    "status": "listening"  }`)  req, _ := http.NewRequest("PATCH", url, body)  req.Header.Add("Content-Type", "application/json")  res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
import requestsurl = "http://localhost:5174/keywords/string"body = {  "phrase": "string",  "groupId": "string",  "status": "listening"}response = requests.request("PATCH", url, json = body, headers = {  "Content-Type": "application/json"})print(response.text)
{
  "keyword": {
    "property1": null,
    "property2": null
  },
  "keywords": [
    {
      "property1": null,
      "property2": null
    }
  ]
}
{
  "error": "string"
}
{
  "error": "string"
}
{
  "error": "string"
}

Delete keyword

Code: apps/web/src/lib/keywords/server.ts:139

DELETE/keywords/{id}

Path Parameters

idRequiredstring

Response Body

Remaining keywords.

TypeScript Definitions

Use the response body type in TypeScript.

keywordsRequiredarray<object>
curl -X DELETE "http://localhost:5174/keywords/string"
fetch("http://localhost:5174/keywords/string")
package mainimport (  "fmt"  "net/http"  "io/ioutil")func main() {  url := "http://localhost:5174/keywords/string"  req, _ := http.NewRequest("DELETE", url, nil)    res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
import requestsurl = "http://localhost:5174/keywords/string"response = requests.request("DELETE", url)print(response.text)
{
  "keywords": [
    {
      "property1": null,
      "property2": null
    }
  ]
}