Endpoint how-to
This page takes you from a base URL to a parsed response. Every payload below is synthetic and labelled as sample data — the shared constants they all reuse are documented once in the example gallery.
Base URL
All paths are relative to:
https://engines.api.telmar.com/omg/prd/v1
The following endpoints are available under the Discover API:
| Method | Path | Description |
|---|---|---|
GET | /docs | Returns the OpenAPI specification for this service in JSON format |
POST | /crosstab | Ranks codebook items by affinity with one audience |
OPTIONS | /crosstab | CORS preflight check for the /crosstab endpoint |
Authenticated requests need a Telmar-Engine-Authorizer API key. See
Authentication if you do not have one yet.
POST /crosstab
Ranks codebook items by affinity with a single audience. The API only exposes and accepts datasets from the TelmarHelixa provider, and the result comes back in one payload.
| Field | Required | Description |
|---|---|---|
surveyCode | Yes | A dataset from the TelmarHelixa provider, such as HXUS |
authorizationGroup | Yes | Authorization group provisioned for the caller |
audience | Yes | Exactly one coding statement |
table | Yes | Table identifier (e.g. "#1") |
weightIndex | Yes | Survey weight to apply |
limit | No | Maximum ranked items returned. Default 10, maximum 50 |
items | No | Optional candidate items, ranked in the same items list |
Understanding the audience
audience is the single concept worth getting right first:
- Exactly one statement — the audience every item is ranked against.
- Empty, or more than one statement — rejected with
400. - A mnemonic you cannot access — rejected with
401.
surveyCode must be a dataset from the TelmarHelixa provider. The API does not
expose datasets from any other provider.
A first request
Sample data- curl
- Python
- TypeScript
curl -X POST 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Telmar-Engine-Authorizer: SAMPLE.ENGINE.AUTHORIZER' \
-H 'Content-Type: application/json' \
-d '{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"table": "#1",
"weightIndex": 1,
"limit": 5
}'
import os
import requests
BASE_URL = "https://engines.api.telmar.com/omg/prd/v1"
def discover(survey: str, audience: str, limit: int = 10) -> dict:
body = {
"surveyCode": survey,
"authorizationGroup": "CLIENTA",
"audience": audience,
"table": "#1",
"weightIndex": 1,
"limit": limit,
}
response = requests.post(
f"{BASE_URL}/crosstab",
json=body,
headers={"Telmar-Engine-Authorizer": os.environ["SAMPLE_ENGINE_AUTHORIZER"]},
timeout=30,
)
payload = response.json()
if response.status_code != 200 or not payload.get("success"):
raise RuntimeError(payload.get("error") or payload.get("message"))
return payload
result = discover("HXUS", "(GMEN=#1) AND (AGE18_34=#1)", limit=5)
print(result["discover"]["items"])
const BASE_URL = 'https://engines.api.telmar.com/omg/prd/v1';
async function discover(survey: string, audience: string, limit = 10) {
const response = await fetch(`${BASE_URL}/crosstab`, {
method: 'POST',
headers: {
'Telmar-Engine-Authorizer': process.env.SAMPLE_ENGINE_AUTHORIZER!,
'Content-Type': 'application/json',
},
body: JSON.stringify({
surveyCode: survey,
authorizationGroup: 'CLIENTA',
audience,
table: '#1',
weightIndex: 1,
limit,
}),
});
const payload = await response.json();
if (!response.ok || !payload.success) {
throw new Error(payload.error ?? payload.message);
}
return payload;
}
const result = await discover('HXUS', '(GMEN=#1) AND (AGE18_34=#1)', 5);
console.log(result.discover.items);
How to read the response
A successful response is an envelope around discover.items.
{
"success": true,
"message": "ok",
"discover": {
"audienceSize": { "proj": 24180.2 },
"items": [
{
"rank": 1,
"mnemonic": "HX_BRAND_0412",
"label": "Brand A",
"affinity": 3.42,
"proj": 2210.4,
"audiencePercent": 9.14,
"itemPercent": 41.8,
"stability": 0
}
]
}
}
Read it in this order:
success—truemeans the ranking finished.messageisok.discover.audienceSize.proj— projected size of the audience.discover.items— ranked items, capped atlimitand sorted byaffinity, thenproj, thenmnemonic.- Each item —
affinityis the ranking value.proj,audiencePercent, anditemPercentare the audience measures.stabilityof0is stable.
GET /docs
Returns the full OpenAPI specification for this service as a JSON object. Useful for programmatic discovery of the API schema. No authentication is required.
curl 'https://engines.api.telmar.com/omg/prd/v1/docs' \
-H 'Accept: application/json'
The full (abridged) response is in the gallery below.
OPTIONS /crosstab
CORS preflight for the /crosstab path. Browsers issue this automatically before
cross-origin POST requests. Returns 200 — everything useful is in the headers.
curl -X OPTIONS 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Origin: https://app.example.com' \
-H 'Access-Control-Request-Method: POST' -i
Access-Control-Allow-Methods and Access-Control-Allow-Headers tell the
browser what it may send. This call is not billed.
Errors
Failures set success to false and put the reason in error:
{
"success": false,
"error": "audience must be a single coding statement."
}
| HTTP | Meaning | What to do |
|---|---|---|
200 | Ranking succeeded | Read discover.items |
400 | Bad request — audience, limit, or an audience that is too small | Fix the payload |
401 | Unauthorized — API key, or a mnemonic in the audience or in items | See Authentication |
403 | Forbidden — the Discover API is not enabled for the account | Confirm permissioning with TelmarHelixa |
500 | Internal server error | Contact TelmarHelixa support |
504 | Processing exceeded the gateway timeout | Lower limit and retry |
Treat error as human-facing text that may change. Branch on the HTTP status,
then read error to explain the failure.
Two rules worth building in from the start:
400,401and403are not retryable. The same request will fail the same way. Fix it or surface it.5xxare retryable with exponential backoff. A504means the ranking was too large for the gateway timeout — lowerlimit.
Example gallery
Distinct request and response shapes for this endpoint, including the errors you are most likely to hit first. Pick a scenario to see the payloads and when to use it.
Sample data used in these examplesSample data
Every example on this page reuses the same synthetic constants. They are not real credentials or real identifiers, and they will not authenticate against any environment. Substitute your own values once you are provisioned.
| Name | Value | What it means |
|---|---|---|
| Base URL | https://engines.api.telmar.com/omg/prd/v1 | The documented base URL for the Discover API. All paths below are relative to it. |
| API key | SAMPLE.ENGINE.AUTHORIZER | A non-functional stand-in for the value you send as the 'Telmar-Engine-Authorizer' header. Use the key issued when your access is provisioned. |
| Dataset | HXUS | Synthetic dataset code. The API only exposes and accepts datasets from the TelmarHelixa provider. |
| Authorization group | CLIENTA | Authorization group provisioned for the caller. |
| Audience | (GMEN=#1) AND (AGE18_34=#1) | The single audience coding statement. Items are ranked by affinity with this audience. |
| Items | HX_BRAND_0412, HX_BRAND_0088 | Optional candidate items. They are ranked in the same items list, best affinity first. |
Successful responses
Client errors
Auth and access errors
Discovery
Ranked items for one audience
POST/crosstab200 OK
When to use this shape
The default Discover call. One audience, and the top items by affinity. Use it when a planner needs the items that over-index against an audience.
Request
{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"table": "#1",
"weightIndex": 1,
"limit": 5
}
curl
curl -X POST 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Telmar-Engine-Authorizer: SAMPLE.ENGINE.AUTHORIZER' \
-H 'Content-Type: application/json' \
-d '{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"table": "#1",
"weightIndex": 1,
"limit": 5
}'
Response
{
"success": true,
"message": "ok",
"discover": {
"audienceSize": {
"proj": 24180.2
},
"items": [
{
"rank": 1,
"mnemonic": "HX_BRAND_0412",
"label": "Brand A",
"affinity": 3.42,
"proj": 2210.4,
"audiencePercent": 9.14,
"itemPercent": 41.8,
"stability": 0
},
{
"rank": 2,
"mnemonic": "HX_BRAND_0088",
"label": "Brand B",
"affinity": 2.97,
"proj": 1504,
"audiencePercent": 6.22,
"itemPercent": 36.3,
"stability": 0
}
]
}
}
Response headers
Content-Type: application/json
Access-Control-Allow-Origin: *
Items are ordered by affinity (highest first), then proj, then mnemonic. The items array is capped at limit and may be shorter.
Optional items included in the ranking
POST/crosstab200 OK
When to use this shape
You already have item mnemonics to consider. Send them in items and they are ranked with the audience in the same list.
Request
{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"items": [
"HX_BRAND_0412",
"HX_BRAND_0088"
],
"table": "#1",
"weightIndex": 1,
"limit": 5
}
curl
curl -X POST 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Telmar-Engine-Authorizer: SAMPLE.ENGINE.AUTHORIZER' \
-H 'Content-Type: application/json' \
-d '{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"items": [
"HX_BRAND_0412",
"HX_BRAND_0088"
],
"table": "#1",
"weightIndex": 1,
"limit": 5
}'
Response
{
"success": true,
"message": "ok",
"discover": {
"audienceSize": {
"proj": 24180.2
},
"items": [
{
"rank": 1,
"mnemonic": "HX_BRAND_0412",
"label": "Brand A",
"affinity": 3.42,
"proj": 2210.4,
"audiencePercent": 9.14,
"itemPercent": 41.8,
"stability": 0
},
{
"rank": 2,
"mnemonic": "HX_BRAND_0088",
"label": "Brand B",
"affinity": 2.97,
"proj": 1504,
"audiencePercent": 6.22,
"itemPercent": 36.3,
"stability": 0
}
]
}
}
Response headers
Content-Type: application/json
Access-Control-Allow-Origin: *
items is optional. Supplied items appear in the same ranked items array, ordered by affinity.
Audience is not a single coding statement
POST/crosstab400 Bad Request
When to use this shape
The call was sent with two audience statements. audience must be a single coding statement — the audience every item is ranked against.
Request
{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": [
"(GMEN=#1)",
"(GWOMEN=#1)"
],
"table": "#1",
"weightIndex": 1,
"limit": 5
}
curl
curl -X POST 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Telmar-Engine-Authorizer: SAMPLE.ENGINE.AUTHORIZER' \
-H 'Content-Type: application/json' \
-d '{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": [
"(GMEN=#1)",
"(GWOMEN=#1)"
],
"table": "#1",
"weightIndex": 1,
"limit": 5
}'
Response
{
"success": false,
"error": "audience must be a single coding statement."
}
Response headers
Content-Type: application/json
To compare two audiences, make two Discover calls.
Account is not enabled for the Discover API
POST/crosstab403 Forbidden
When to use this shape
The API key is valid, but this account is not enabled for the Discover API.
Request
{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"table": "#1",
"weightIndex": 1,
"limit": 5
}
curl
curl -X POST 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Telmar-Engine-Authorizer: SAMPLE.ENGINE.AUTHORIZER' \
-H 'Content-Type: application/json' \
-d '{
"surveyCode": "HXUS",
"authorizationGroup": "CLIENTA",
"audience": "(GMEN=#1) AND (AGE18_34=#1)",
"table": "#1",
"weightIndex": 1,
"limit": 5
}'
Response
{
"success": false,
"error": "The Discover API is not enabled for this account."
}
Response headers
Content-Type: application/json
This is a commercial boundary. Contact Sales to enable the Discover API — no payload change will resolve it.
CORS pre-flight for crosstab
OPTIONS/crosstab200 OK
When to use this shape
Call this from a browser-based integration to confirm the CORS policy before your first real request, or as a cheap liveness probe. It is not billed.
Request
No request body — this operation is driven entirely by the method, path and headers.
curl
curl -X OPTIONS 'https://engines.api.telmar.com/omg/prd/v1/crosstab' \
-H 'Origin: https://app.example.com' \
-H 'Access-Control-Request-Method: POST'
Response
{}
Response headers
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Telmar-Engine-Authorizer
Everything useful is in the response headers — `Access-Control-Allow-Methods` and `Access-Control-Allow-Headers` tell the browser what it may send.
OpenAPI specification as JSON
GET/docs200 OK
When to use this shape
Call this when you need the machine-readable OpenAPI document for this service — for example to feed a client generator or to confirm the live contract matches what you integrated against.
Request
No request body — this operation is driven entirely by the method, path and headers.
curl
curl -X GET 'https://engines.api.telmar.com/omg/prd/v1/docs' \
-H 'Accept: application/json'
Response
{
"openapi": "3.0.1",
"info": {
"title": "Discover API",
"description": "TelmarHelixa Discover API.",
"version": "1.0.0"
},
"paths": {
"/docs": {
"get": {
"operationId": "docs"
}
},
"/crosstab": {
"post": {
"operationId": "crosstab"
},
"options": {
"operationId": "crosstabOptions"
}
}
}
}
Response headers
Content-Type: application/json
The response body is this service's OpenAPI document in JSON. No authorizer header is required. The payload below is abridged for readability.