- Computed URL
- Examples
- Authentication (2.0)
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Request Body
- Response
- Success Response
- Error Responses
- Notes / Edge Cases
- Example Request
- Search: Datafile
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Query Parameters
- Response
- Success Response
- Error Responses
- Create: Merge Run
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Query Parameters
- Path Parameters
- Request Body Examples
- Top Level
- ConvertsToMerge
- MergeDetails
- Segments
- Take
- Tag
- Response
- Success Response
- Error Responses
- Notes / Edge Cases
- Create/Update BD Select Order
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Query Parameters
- Path Parameters
- Request Body Examples
- BDSOrder
- DeduplicationField
- SuppressionRule
- SuppressionRule.suppkey
- SuppressionRule.DateRangeRule
- audienceSegment
- BDSField
- "number-input" value
- "number-slider" value
- "range-slider" value
- “selection-unique” value
- “selection-multi” value
- “selection-multi” value
- “data-relation” value
- “multi-text” value
- “date-range-selector” value
- “contains” value
- “client-cid” value
- Enumerations
- SuppressionRuleScopes
- EDateRangeOperators
- EDynamicRangeOptions
- Response
- Success Response
- Error Responses
- Run BDS Count
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Query Parameters
- Request Body
- Success Response
- Error Responses
- Listen BDS Count Status
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Response
- Headers
- Query Parameters
- Request Body
- Success Responses
- Error Responses
- Cancel BDS Count Execution
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Query Parameters
- Request Body
- Error Response
- Get Count Query Historical Results
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Query Parameters
- Request Body
- Error Response
- Get Count Result
- Endpoint
- Description
- HTTP Method
- Authentication
- Request
- Headers
- Query Parameters
- Request Body
- Example Response
- Error Response
- Additional References
Computed URL
Computed URL
https://<org>.bettrdata.io:1337
Examples
Authentication (2.0)
Endpoint
/auth/token
Description
Get bearer token
HTTP Method
POST
Authentication
- Required:
Yes - Type: See Request Body
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
X-Amz-Target | Yes | String | AWSCognitoIdentityProviderService.InitiateAuth |
Content-Type | Yes | String | application/x-amz-json-1.1 |
Request Body
{
"AuthFlow": "USER_PASSWORD_AUTH",
"ClientId": "<client_id>",
"AuthParameters": {
"USERNAME": "<username>",
"PASSWORD": "<password>"
}
}Response
Success Response
Status Code: 200 OK
{
"token":"jwt_token_here",
"expires_in":3600
}
Field | Type | Description |
token | String | JWT access token |
expires_in | Number | Expiry time in seconds |
Error Responses
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
Notes / Edge Cases
- Tokens expire after 1 hour
- Rate limited to 100 requests/minute
- This endpoint is idempotent
Example Request
Search: Datafile
Endpoint
/datafile
Description
Find a datafile
HTTP Method
GET
Authentication
Required: Yes
- Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Query Parameters
Name | Required | Type | Description |
where | No | Object | Generally follows mongodb query structure, see query documents |
sort | No | Object | |
limit | No | Number | Number of records to limit in the response |
Response
Success Response
Status Code: 200 OK
[
{DatafileModel}
]Error Responses
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
Create: Merge Run
Endpoint
/mergerun
Description
Create a Merge job to union, omit, select, or join multiple feeds together.
HTTP Method
POST
Authentication
- Required:
Yes - Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Query Parameters
Name | Required | Type | Description |
Path Parameters
Name | Required | Type | Description |
Request Body Examples
Example 1 — Sequential UNION (priority “waterfall” across 3 sources)
Example 2 — Base UNION + JOIN match flags (exists-style tagging)
Example 3 — Suppression OMIT + equitable split across 2 UNION sources (same priority)
Top Level
Field | Type | Description |
convertsToMerge | ConvertsToMerge [] | Merge Item Entry |
convertType | String | Output Schema / Process to apply |
description | String | Freeform text description |
ready | Boolean | Run now if set to true |
ConvertsToMerge
Field | Type | Description |
fileId | String | Unique ID |
path | String | Full path to convert output / merge input |
fileName | String | Filename as initially received |
mergeInputType | Enumeration | UNION | OMIT | SELECT | JOIN |
mergeDetails | MergeDetails {} | Complex object describing intra and inter file behavior / relationships |
Additional Notes:
- Union - core set of records to be “acted on”
- Omit - records to be removed based on common key to Union
- Select - records to be selected based on common key to Union
- Join - file use to append specific values based on common key to Union
MergeDetails
Field | Type | Description |
priority | Integer | File level priority (lower value, higher priority); |
suppressPriorSelections | Boolean | Determines if prior selected records should be suppressed; Defaulted to true |
segments | Segement Item [] | Ordered list defining the segments within a single file |
tag | Tag {} | Complex object defining field and default values for JOIN mergeInputType |
Segments
Field | Type | Description |
name | String | Segment name / identifier |
window | Integer | Isolated quantity |
take | Take {} | Complex object describing how to select records within the window |
Take
Field | Type | Description |
strategy | Enumeration | ALL | TOP | EVEN_NTH |
count | Integer | Number of records selected from within the segment window based on strategy. |
Tag
Field | Type | Description |
outputField | String | Field to populate |
trueValue | String | Default value for a match |
falseValue | String | Default value for no match |
Response
Success Response
Status Code: 200 OK
{
<updated object w/ ID here>
}
Error Responses
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
Notes / Edge Cases
Dedupe
- Ability to group by primary key (usually ids dupes) - CONVERT
- Ability to sort within group (usually by score/file) - REDUCE (add)
- Ability to select top record - REDUCE
Nth
- Ability to nth (post sort, ie score) by priority (file) - Deterministic:
- Distributed nth (by sort order)
- Top (by sort order)
- Distribute even across dupes, then distributed nth across remainder
Select
- Ability to JOIN flag multiple files (flags) to a single
Suppress
- Ability to OMIT multiple files (flags) to a single
Flag
Create/Update BD Select Order
Endpoint
Post /audience/create
Put /audience/update/:orderId
Description
Create a BD Select Order to filter data
HTTP Method
POST
Authentication
- Required:
Yes - Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Query Parameters
Name | Required | Type | Description |
Path Parameters
Name | Required | Type | Description |
Request Body Examples
Example 1 — BDS Order with Segments (without deduplication and suppression)
Example 2 — BDS Order with suppression and deduplication
BDSOrder
Field | Type | Description |
name | String | Order’s Name |
description | String | Order’s description |
belongsTo | String | Data Owner ID |
createdBy | String | User email |
dataSource | String | BDS Source ID |
audienceSegments | AudiencesSegment[] | Field Segments |
suppressionRules | SuppressionRule[] | Supp Rules (If empty, suppression is disabled) |
autoUpdateAiDescription(Optional) | Boolean | null | Update desc automatically |
deduplicateSegments | Boolean | enable/disable deduplication |
deduplicationKeyFields | DeduplicationField[] | Fields for deduplication |
DeduplicationField
Field | Type | Description |
fieldId | String | Existing BDS Source Field ID |
fieldName | String | Existing BDS Source Field Name ID |
SuppressionRule
Field | Type | Description |
suppkey | Object | Target Suppression Field |
type | SuppressionRuleScopes(Enum) | type of scope (”all-exports”, “specific-export”, “daterange”) |
exports (Optional, base on supp type) | String[] | null | (If “specific-export” scope selected) IDs list of previous exportation results |
dateRule (Optional, base on supp type) | DateRangeRule | null | (If “daterange” scope selected) Suppresion by Date Range Filters |
SuppressionRule.suppkey
Field | Type | Description |
_id | String | Existing BDS Source Field ID |
name | String | Existing BDS Source Field Name ID |
SuppressionRule.DateRangeRule
Field | Type | Description |
operator | EDateRangeOperators(Enum) | Type of date search across previous exports ("date-range" | "single-date" | "after-date" | "before-date" | "before-equal-date" | "after-equal-date" | "dynamic-range-days-weeks-months”) |
startDate (Optional, base on operator) | String | Begining date value |
endDate (Optional, base on operator) | String | (If “date-range” operator selected) Ending Date Value |
dynamicRangeNumber (Optional, base on operator) | Number | (If “date-range” operator selected) Number of units to search previous exports |
dynamicRangeType (Optional, base on operator) | EDynamicRangeOptions(Enum) | (If “date-range” operator selected) Unit to Select previous export from lasts: ("weeks" | "months" | "days" | "quarters" | "years”) |
audienceSegment
Field | Type | Description |
name | String | Name of the segment, can’t be duplicated |
aiDescription(Optional) | String | null | Written AI prompt by the user to generate the segment content base in the existing BDS source fields |
limit | Number | Limit of records per segment |
includedFields | BDSField[] | Filters to match data Conjunctively (AND) |
excludedFields | BDSField[] | Filters to omit data Conjunctively (AND) |
BDSField
Field | Type | Description |
_id | String | Existing BDS Source Field ID |
name | String | Existing BDS Source Field Name |
groupTags | String[] | Tags to group fields across segments disjunctively (OR) ,fields can be added simultaneously into different groups |
displayType | String | Type of Widget and DataType ⇒ ("number-slider" | "number-input" | "range-slider" | "selection-unique" | "selection-multi" | "boolean" | "data-relation" | "multi-text" | "date-picker" | "date-range-selector" | "contains" | "zip-code-radius" | "address-radius" | "client-cid" | "sql-variable" | "case-statement") [This have to match with existing BDS Field] |
showAsRange (Optional) | Boolean | if display type equals "number-slider" Toggle to range slider widget in front end |
showAsSingleSlider(Optional) | Boolean | if display type equals "range-slider" Toggle to single slider widget in front end |
value | Any | This Atributte change depending of the selected displayType (Check below data types) |
"number-input" value
Field | Type | Description |
numberValue | Number | |
logicalOperator | String |
"number-slider" value
Field | Type | Description |
min(Required if showAsRange is true) | Number | Starting Range Match Value |
max(Required if showAsRange is true) | Number | Ending Range Match Value |
numberValue(Required if showAsRange is not true) | Number | Single Match Value |
logicalOperator(Required if showAsRange is not true) | String | filter operator (”equals”, “less-than”, “less-than-or-equals”, “greater-than”, “greater-than-or-equals”) |
"range-slider" value
Field | Type | Description |
min(Required if showAsSingleSlider is not true) | Number | Starting Range Match Value |
max(Required if showAsSingleSlider is not true) | Number | Ending Range Match Value |
numberValue(Required if showAsSingleSlider is true) | Number | Single Match Value |
logicalOperator(Required if showAsSingleSlider is true) | String | filter operator (”equals”, “less-than”, “less-than-or-equals”, “greater-than”, “greater-than-or-equals”) |
“selection-unique” value
(Value must exist in existing BDS Field)
Field | Type | Description |
label | String | Option Selected label |
value | String | Option Selected Value |
“selection-multi” value
A List of values (Values must exist in existing BDS Field)
Field | Type | Description |
label | String | Option Selected label |
value | String | Option Selected Value |
“selection-multi” value
Can be empty
“data-relation” value
An object or a list of objects that must contains FileID
“multi-text” value
A list of string values
“date-range-selector” value
Is the same DateRangeRule object
“contains” value
A list of string values
On each value you can use “%” char for LIKE statement operator
“%son” → Match with any value that ends in “son”
“Jeff%” → Match with any value that starts with “Jeff”
“%fer%” → Match with any value that contains “fer”
If you don’t add operator it will added at both sides
“Jefferson” → “%Jefferson%”
Example Field Value: [”Jeff%”, “%son”, “%fer%” , … , … , …]
“client-cid” value
A list of DataOwners’ IDs
Enumerations
SuppressionRuleScopes
Value | Type | Description |
all-exports | String | Suppress all previous exports |
specific-export | String | Suppress an specific list of exports |
daterange | String | Suppress an specific list of exports created within an specific date |
EDateRangeOperators
Value | Type | Description |
date-range | String | Suppress exports between 2 dates |
single-date | String | Suppress exports created on a specific date |
after-date | String | Suppress exports created after an specific date |
before-date | String | Suppress exports created before an specific date |
before-equal-date | String | Suppress exports created before or in an specific date |
after-equal-date | String | Suppress exports created after or in an specific date |
dynamic-range-days-weeks-months | String | Suppress exports created the last (days, weeks, months, quarters, years) |
EDynamicRangeOptions
Value | Type | Description |
days | String | |
weeks | String | |
months | String | |
quarters | String | |
years | String |
Response
Success Response
Status Code: 200 OK
{
<updated object w/ ID here>
}
Error Responses
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
Run BDS Count
Endpoint
/audience/count/:orderId/:queryName
Description
Execute an existing BDS order
HTTP Method
POST
Authentication
Required: Yes
- Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Query Parameters
Name | Required | Type | Description |
orderId | YES | String | Existing BDS Order ID |
queryName | YES | String | Existing BDS Order’s Source query |
Request Body
{
"currentUser": "user@email.com",
}Success Response
Status Code: 200 OK
{
"dbOrigin": "SNOWFLAKE",
"executionHash": "qr4heq8e8w7hdaiefubiaubf"
}Error Responses
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
400 | Data Source Is Disabled | The BDS Source referenced in the BDS Order was disabled |
400 | Origin database not valid | BDS Source DB does not exists or not supported |
400 | Some interpolated variables not sent | BDS Source query contains unexisting interpolated variables |
400 | No Audience Found | |
400 | No DataSource Found | |
400 | No Query Found in DataSource | |
400 | No DataSource Connection Found |
Listen BDS Count Status
Endpoint
/audience/streamresult/:executionHash/:dbOrigin
Description
Check count execution status
It returns an streaming response that emits status every 3 seconds
HTTP Method
GET
Authentication
Required: Yes
- Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Value |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Response
Headers
Name | Value |
Transfer-Encoding | chunked |
Query Parameters
Name | Required | Type | Description |
executionHash | YES | String | Execution ID |
dbOrigin | YES | String | Execution database |
Request Body
N/A
Success Responses
//When count is started
{"status": "started" }
//Count in progress
{"status": "in progress" }
//Count failed
{"status": "error", "error": "error message" }
//Count end
{"status": "end" }Error Responses
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
500 | Database Origin Not Supported | Invalid Database Origin |
“status”: “error” | “message”: “Count Failed” | |
“status”: “error” | “message”: “<COUNT_ERROR_MESSAGE>” | |
“status”: “error” | “message”: “Count Canceled” | |
"status”: “error” | “message”: “Execution not found” | |
Cancel BDS Count Execution
Endpoint
/audience/statement/count/:executionHash/:dbOrigin
Description
Cancel an execution in progress
HTTP Method
DELETE
Authentication
Required: Yes
- Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Query Parameters
Name | Required | Type | Description |
executionHash | YES | String | Execution ID |
dbOrigin | YES | String | Execution database |
Request Body
N/A
Status Code: 200 OK
{
"message": "SQL statement canceled"
}Error Response
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
400 | Database Origin Not Supported | Invalid Database origin |
400 | SQL Statement not found | Unexisting Execution |
Get Count Query Historical Results
Endpoint
/audience/count/:audienceId/:queryName
Description
Get historical count results from a specific Query
HTTP Method
GET
Authentication
Required: Yes
- Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Query Parameters
Name | Required | Type | Description |
executionHash | YES | String | Execution ID |
dbOrigin | YES | String | Execution database |
Request Body
N/A
Status Code: 200 OK
Error Response
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |
Get Count Result
Endpoint
/audience/count-result/:countResultId?page=1&limit=1000
Description
Get count result rows
HTTP Method
GET
Authentication
Required: Yes
- Type: Bearer Token
- Scope / Permissions (if applicable):
Request
Headers
Name | Required | Type | Description |
Authorization | Yes | String | Bearer <token> |
Content-Type | Yes | String | application/json |
Query Parameters
Name | Required | Type | Description |
countResultId | YES | String | Count Result Object ID |
page | NO | Number | Page Number |
limit | NO | Number | Page Size |
Request Body
N/A
Example Response
Status Code: 200 OK
Error Response
Status Code | Message | When it Happens |
400 | Bad Request | Invalid input |
401 | Unauthorized | Invalid credentials |
403 | Forbidden | Insufficient permissions |
500 | Server Error | Unexpected failure |