Skip to content

Add terms

POST/v1/wordlists/{id}/termsKey scope write

Adds up to 5,000 terms to a wordlist in one request. Terms are compared in their normalised form: a term that normalises to one already in the list updates that entry, and a repeat inside the same request is skipped.

Needs a key with the write scope. Authentication

curl https://api.useinfrared.com/v1/wordlists/wl_5KcJIqikl2tXcuKJHvpzgO/terms \
  -H "Authorization: Bearer $INFRARED_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "terms": [
      "gift card",
      {
        "term": "e-ticket",
        "canonical": "event ticket"
      },
      "event ticket"
    ]
  }'
201 CreatedResponse
{
  "object": "wordlist_terms_result",
  "created": 3,
  "updated": 0,
  "skipped": 0,
  "entries_count": 3
}

Path parameters

idstringRequired

Id of the wordlist: wl_ plus 22 base62 characters.

Request body

termsarray of string or objectsRequired

The terms to add, 1 to 5,000 items. Each item is a string of 1 to 200 characters, or an object with term and optionally canonical and notes. A term with a space is matched as an exact phrase. Any other term is compared word by word, where a word is a run of letters and digits, so a hyphenated term without a space does not match.

Returns

An object with the counts created, updated and skipped, entries_count (the number of terms now in the list) and object set to wordlist_terms_result, with status 201. Results are cached for 6 hours per identical text, so new terms can take that long to reach text that was moderated before them.

  • 201 CreatedAn object

Errors

404
not_found

The key's project has no wordlist with this id.

422
validation_error

terms is empty or has more than 5,000 items, or a term is empty or longer than 200 characters.

Every endpoint can also answer the errors any request can meet: a missing key, a rate limit, a malformed body. Errors

Something missing or unclear on this page? Write to support@useinfrared.com.