Appearance
AI Context File
Copy the block below and paste it into your AI assistant. It gives the assistant what the reference pages don't say in one place: authentication, the base URL, the error format, rate limits, and the rules an integration has to follow. It works with any AI tool -- ChatGPT, Claude, Cursor, GitHub Copilot, or any other LLM-based assistant.
The block doesn't repeat every endpoint's fields. For those, it points the assistant to two files that are rebuilt from these docs on every release, so they never go stale:
/llms-full.txt-- every page of these docs as one plain-text file, including each endpoint's parameters, response fields and examples. This page is in it too./openapi.json-- the machine-readable spec, with exact request and response types. See OpenAPI Spec.
How to use it:
- ChatGPT / Claude -- Start a new conversation, paste the block, then ask your question in the same message or in a follow-up. If the assistant can't fetch URLs, paste the contents of
/llms-full.txtas well, or the reference page of the endpoint you're working on (each page has a Copy page for AI button). - Cursor -- Paste the block into a
.cursorrulesfile in your project root for persistent context, or paste it into the chat for a one-off session. - Claude Code -- Paste the block into a
CLAUDE.mdfile in your project root, or include it directly in your prompt. Claude Code can fetch/llms-full.txtand/openapi.jsonitself.
markdown
# Determ API -- Context for AI Assistants
## Overview
Determ is a media monitoring platform. The public API lets you programmatically access mentions, create and delete keywords, and retrieve metadata.
- **Base URL:** `https://api.mediatoolkit.com`
- **Authentication:** Bearer token in the `Authorization` header (`Authorization: Bearer YOUR_API_TOKEN`)
- **Response format:** JSON
- **Content-Type for POST requests:** `application/json`
## Full Reference
This block holds conventions, not the per-endpoint detail. For an endpoint's parameters, request body, response fields, enum values and examples, read:
- `https://developers.determ.com/llms-full.txt` -- the complete documentation as plain text (every endpoint page, the glossary, errors and rate limits).
- `https://developers.determ.com/openapi.json` -- the OpenAPI 3 spec, with exact types.
- `https://developers.determ.com/llms.txt` -- an index of every page, one line each.
If you can't fetch these URLs, ask the user to paste the relevant page. Don't guess field names, enum values or paths: use only what these sources or this block state.
---
## Filter Clause Pattern
All mention filters use the same structure:
```json
{
"any": ["VALUE_1", "VALUE_2"],
"all": ["VALUE_3"],
"must": ["VALUE_4"],
"not": ["VALUE_5"]
}
```
- `any` -- Match any of the listed values (OR logic)
- `all` -- Match all of the listed values (AND logic)
- `must` -- Must match these values
- `not` -- Exclude these values
Most common usage is `any` for inclusive filtering and `not` for exclusions. The mention count and scroll endpoints support only the `mentionType` and `sentiment` filters in `query.mentionFilter`.
---
## Error Handling
**Error response format:** RFC 7807 Problem Details, sent with `Content-Type: application/problem+json`.
```json
{
"type": "about:blank",
"title": "Bad Request",
"status": 400,
"detail": "Invalid parameter: from",
"instance": "/v2/organizations/100/keywords",
"code": "INVALID_PARAM"
}
```
**Fields:** `type` (string, always `"about:blank"` -- no custom problem type URIs), `title` (string, the HTTP reason phrase), `status` (int, the HTTP status code), `detail` (string, human-readable message), `instance` (string, the request path), `code` (string, **optional**).
`code` is only present on handled domain errors, and is always upper case -- e.g. `INVALID_PARAM`, `MISSING_PARAM`, `INVALID_ROLE`, `INVALID_KEYWORD` (400), `ILLEGAL_PERMISSION` (403), `NOT_EXISTS` (404), `ILLEGAL_PARAM`, `INCONSISTENT_STATE` (409). It is absent on framework errors such as 401, 429, 500 and validation failures, so always treat it as optional.
**Do not assume the body is JSON.** Known exceptions:
- The `/v2/organizations/{orgId}/mentions/**` endpoints (count and scroll) return a plain `text/plain` body containing just the message for 400 and 404.
- 503 is typically produced by the edge proxy as `text/html`.
Parse defensively: check the status code first, then attempt to parse the body only if `Content-Type` says JSON, and fall back to the raw text.
**HTTP status codes:**
| Status | Meaning | Retry? |
|--------|---------|--------|
| 400 | Bad Request -- malformed request, bad enum, malformed date | No, fix the request |
| 401 | Unauthorized -- missing/invalid token | No, check token |
| 403 | Forbidden -- valid token, no permission | No, check access |
| 404 | Not Found -- resource does not exist | No, check IDs |
| 409 | Conflict -- conflicts with current state (e.g. already exists) | No, fix the request |
| 417 | Expectation Failed -- body invalid or unparseable | No, fix the body |
| 429 | Too Many Requests -- rate limit exceeded | Yes, see below |
| 500 | Internal Server Error | Yes, with backoff |
| 502 | Bad Gateway -- upstream service error | Yes, with backoff |
| 503 | Service Unavailable | Yes, with backoff |
**Endpoint-specific behaviour:**
- `GET /v2/organizations/{id}` returns `404` both when the organization doesn't exist and when you have no access to it.
- `POST /v2/organizations/{orgId}/keywords` (Create Keyword): an invalid `historySearch` (`from` not before `to`, `to` in the future, or `enabled: false` combined with `from`/`to`) returns `400` `INVALID_PARAM`. When the organization already has as many keywords as its plan allows, it returns `403` `ILLEGAL_PERMISSION` (the `detail` names the limit) and creates nothing; retrying won't help -- delete a keyword first. The limit counts every keyword, active or not. A `groupId` (or organization) that doesn't exist returns `404` `NOT_EXISTS`.
- `POST .../mentions/count` and `POST .../mentions/scroll`: the `query` must set `feedTime`, `publishedTime` or both; with neither, the response is `400` with the plain-text body `Must provide either 'feedTime' or 'publishedTime' in query`.
- `DELETE /v2/organizations/{orgId}/keywords/{keywordId}` (Delete Keyword) returns `200 OK` with an empty body -- do not parse it as JSON. It permanently deletes the keyword and every mention collected under it. Deleting the same keyword twice returns `404` on the second call, so treat `404` as "already gone" in retry logic. A keyword ID from another organization, or in a group you have no access to, returns `403`, not `404`; this may change to `404`, so treat both as "not deletable here". Deleting frees the keyword's place in the plan's keyword limit immediately: after the `200`, an organization at its limit can create a replacement on the next call. The limit counts every keyword, active or not.
**Rate limit headers:**
- `X-Rate-Limit-Remaining` -- on allowed requests, tokens left in the bucket. Use it to throttle proactively.
- `X-Rate-Limit-Retry-After-Seconds` -- on 429 responses, how many seconds to wait.
There is no `X-RateLimit-Limit` header; total bucket capacity is not discoverable from the response.
**Retry logic:** Up to 3 attempts, for the statuses marked retryable above. On 429, wait the number of seconds in `X-Rate-Limit-Retry-After-Seconds`; if that header is missing, fall back to exponential backoff starting at 1 second and doubling each attempt.
**Unexpected 429s:** limits are per user, per endpoint, but both mention *count* endpoints (keyword-level and group-level) share one bucket, and both *scroll* endpoints share another. Calling the keyword and group variants of the same operation draws from the same pool.
---
## Rules & Conventions
1. **Always include the Authorization header** with `Bearer YOUR_API_TOKEN` on every request.
2. **Use `scrollToken` for pagination** -- do not increment page numbers manually. Pass the token from the previous response. A single page returns at most 1000 mentions (`paged.count` <= 1000); page through results instead of trying to fetch everything at once. The last page has a `null` or absent `scrollToken`.
3. **Date formats:** Use ISO 8601 (`2024-01-15T00:00:00Z`) for specific times, or the relative enum (`LAST_7_DAYS`) for preset ranges.
4. **ID types:** All IDs are int64, `keywordId` included.
5. **Keep query params stable during pagination** -- only update `scrollToken` between scroll requests.
6. **Rate limiting:** Limits are per user, per endpoint (per IP for the unauthenticated languages/locations endpoints), and they differ widely -- there is no single safe rate. `GET /v2/me`: 200 req/s. `GET /v2/organizations/{orgId}` and `GET .../tags`: 100 req/s. `GET /v2/languages` and `GET /v2/locations`: 100 req/60s per IP. `POST .../mentions/count` and `POST .../mentions/scroll`: 100 req/60s each, and the keyword-level and group-level variants share one bucket (both count endpoints draw from one pool, both scroll endpoints from another). `POST /v2/organizations/{orgId}/keywords` (Create Keyword): **2 req/10s** -- never create keywords in a fast loop. `DELETE /v2/organizations/{orgId}/keywords/{keywordId}` (Delete Keyword): 100 req/60s. On 429, wait `X-Rate-Limit-Retry-After-Seconds` (see Error Handling above).
7. **Content-Type:** Always send `Content-Type: application/json` for POST requests.
8. **Discover IDs, don't guess them:** `GET /v2/me` lists your `organizationIds`; `GET /v2/organizations/{id}` lists that organization's groups and keywords (the `groupId` and `keywordId` the mention endpoints need); `GET /v2/organizations/{orgId}/tags` without `ids` lists every tag.