@elmohq/sdk 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +326 -2
- package/dist/calls/index.d.mts +288 -0
- package/dist/calls/index.d.mts.map +1 -0
- package/dist/calls/index.mjs +390 -0
- package/dist/calls/index.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1031 -0
- package/dist/index.mjs.map +1 -0
- package/dist/request-options-B9S9d24M.d.mts +1549 -0
- package/dist/request-options-B9S9d24M.d.mts.map +1 -0
- package/dist/tools-7Hs5J2xb.d.mts +1945 -0
- package/dist/tools-7Hs5J2xb.d.mts.map +1 -0
- package/dist/tools-B1lVtYAr.mjs +2459 -0
- package/dist/tools-B1lVtYAr.mjs.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +68 -4
- package/src/calls/brands-analytics-get.ts +33 -0
- package/src/calls/brands-citations-domains-list.ts +36 -0
- package/src/calls/brands-citations-urls-list.ts +32 -0
- package/src/calls/brands-create.ts +19 -0
- package/src/calls/brands-get.ts +19 -0
- package/src/calls/brands-list.ts +18 -0
- package/src/calls/brands-opportunities-get.ts +42 -0
- package/src/calls/brands-prompt-performance-list.ts +39 -0
- package/src/calls/brands-query-fanout-get.ts +30 -0
- package/src/calls/brands-tags-list.ts +28 -0
- package/src/calls/brands-update.ts +20 -0
- package/src/calls/competitors-create.ts +23 -0
- package/src/calls/competitors-delete.ts +19 -0
- package/src/calls/competitors-get.ts +19 -0
- package/src/calls/competitors-list.ts +23 -0
- package/src/calls/competitors-update.ts +24 -0
- package/src/calls/index.ts +33 -0
- package/src/calls/me-get.ts +18 -0
- package/src/calls/models-list.ts +20 -0
- package/src/calls/organizations-billing-get.ts +37 -0
- package/src/calls/organizations-get.ts +24 -0
- package/src/calls/organizations-list.ts +27 -0
- package/src/calls/prompts-create.ts +27 -0
- package/src/calls/prompts-delete.ts +28 -0
- package/src/calls/prompts-get.ts +23 -0
- package/src/calls/prompts-list.ts +28 -0
- package/src/calls/prompts-runs-get.ts +27 -0
- package/src/calls/prompts-runs-list.ts +30 -0
- package/src/calls/prompts-snapshot-get.ts +28 -0
- package/src/calls/prompts-update.ts +29 -0
- package/src/calls/reports-create.ts +31 -0
- package/src/calls/reports-get.ts +27 -0
- package/src/calls/reports-list.ts +28 -0
- package/src/calls/tools-analyze.ts +26 -0
- package/src/client.ts +649 -0
- package/src/index.ts +21 -0
- package/src/internal/binding/rest/binding.ts +127 -0
- package/src/internal/binding/rest/errors.ts +107 -0
- package/src/internal/binding/rest/path.ts +9 -0
- package/src/internal/binding/rest/url.ts +97 -0
- package/src/internal/codec/json.ts +66 -0
- package/src/internal/codec/registry.ts +55 -0
- package/src/internal/core/backoff.ts +170 -0
- package/src/internal/core/body.ts +54 -0
- package/src/internal/core/browser.ts +11 -0
- package/src/internal/core/call-promise.ts +145 -0
- package/src/internal/core/callable.ts +11 -0
- package/src/internal/core/client.ts +89 -0
- package/src/internal/core/config.ts +84 -0
- package/src/internal/core/credentials.ts +40 -0
- package/src/internal/core/dispatch.ts +225 -0
- package/src/internal/core/env.ts +68 -0
- package/src/internal/core/errors.ts +431 -0
- package/src/internal/core/features.ts +60 -0
- package/src/internal/core/lazy-promise.ts +39 -0
- package/src/internal/core/metadata.ts +79 -0
- package/src/internal/core/page.ts +402 -0
- package/src/internal/core/params.ts +98 -0
- package/src/internal/core/protocol.ts +17 -0
- package/src/internal/core/read-reply.ts +7 -0
- package/src/internal/core/text.ts +7 -0
- package/src/internal/core/types.ts +554 -0
- package/src/internal/feature/auth.ts +201 -0
- package/src/internal/feature/interceptors.ts +36 -0
- package/src/internal/feature/logger.ts +222 -0
- package/src/internal/feature/retry.ts +168 -0
- package/src/internal/feature/rules.ts +54 -0
- package/src/internal/feature/timeout.ts +146 -0
- package/src/internal/feature/validate.ts +82 -0
- package/src/internal/transport/fetch.ts +82 -0
- package/src/resources/analytics.ts +364 -0
- package/src/resources/brands.ts +288 -0
- package/src/resources/competitors.ts +213 -0
- package/src/resources/identity.ts +49 -0
- package/src/resources/models.ts +32 -0
- package/src/resources/opportunities.ts +81 -0
- package/src/resources/organizations.ts +182 -0
- package/src/resources/prompts.ts +293 -0
- package/src/resources/reports.ts +212 -0
- package/src/resources/runs.ts +124 -0
- package/src/resources/shared/auth.ts +13 -0
- package/src/resources/shared/request-options.ts +26 -0
- package/src/resources/shared/resource.ts +23 -0
- package/src/resources/shared/rule.ts +25 -0
- package/src/resources/snapshots.ts +54 -0
- package/src/resources/tags.ts +46 -0
- package/src/resources/tools.ts +69 -0
- package/src/types/analytics.ts +497 -0
- package/src/types/brands.ts +228 -0
- package/src/types/competitors.ts +196 -0
- package/src/types/identity.ts +55 -0
- package/src/types/index.ts +163 -0
- package/src/types/models.ts +40 -0
- package/src/types/opportunities.ts +84 -0
- package/src/types/organizations.ts +157 -0
- package/src/types/prompts.ts +231 -0
- package/src/types/reports.ts +266 -0
- package/src/types/runs.ts +131 -0
- package/src/types/shared/brand-id-path.ts +2 -0
- package/src/types/shared/conflict-error.ts +7 -0
- package/src/types/shared/error.ts +29 -0
- package/src/types/shared/limit.ts +8 -0
- package/src/types/shared/mention-entry.ts +21 -0
- package/src/types/shared/model-filter.ts +15 -0
- package/src/types/shared/not-found-error.ts +4 -0
- package/src/types/shared/page.ts +7 -0
- package/src/types/shared/pagination.ts +7 -0
- package/src/types/shared/validation-error.ts +4 -0
- package/src/types/snapshots.ts +88 -0
- package/src/types/tags.ts +47 -0
- package/src/types/tools.ts +78 -0
|
@@ -0,0 +1,1945 @@
|
|
|
1
|
+
//#region src/types/shared/error.d.ts
|
|
2
|
+
type Error = {
|
|
3
|
+
/**
|
|
4
|
+
* Stable machine-readable code. Deliberately not an enum: new values are added without a version
|
|
5
|
+
* bump, so treat an unrecognized one as its HTTP status implies. Currently: `unauthorized`,
|
|
6
|
+
* `insufficient_scope`, `forbidden`, `not_found`, `validation_error`, `conflict`, `rate_limited`,
|
|
7
|
+
* `method_not_allowed`, `read_only`, `no_active_plan`, `brand_limit`, `prompt_limit`,
|
|
8
|
+
* `model_not_in_plan`, `model_picks_exceeded`, `premium_not_in_plan`, `premium_pool_exhausted`,
|
|
9
|
+
* `cadence_faster_than_plan`, `internal_error`.
|
|
10
|
+
*/
|
|
11
|
+
code?: string;
|
|
12
|
+
/** Error type */
|
|
13
|
+
error: string;
|
|
14
|
+
/** Detailed error message */
|
|
15
|
+
message?: string;
|
|
16
|
+
};
|
|
17
|
+
/** Authentication required */
|
|
18
|
+
type UnauthorizedError = Error;
|
|
19
|
+
type InternalServerError = Error;
|
|
20
|
+
/**
|
|
21
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
22
|
+
* read-only (demo) mode.
|
|
23
|
+
*/
|
|
24
|
+
type ForbiddenError = Error;
|
|
25
|
+
/** Per-key rate limit exceeded. */
|
|
26
|
+
type RateLimitError = Error;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/types/shared/model-filter.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A bare
|
|
31
|
+
* `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a local
|
|
32
|
+
* calendar day there.
|
|
33
|
+
*/
|
|
34
|
+
type WindowStart = Date;
|
|
35
|
+
/**
|
|
36
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
37
|
+
* exactly `end` is outside it.
|
|
38
|
+
*/
|
|
39
|
+
type WindowEnd = Date;
|
|
40
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
41
|
+
type ModelFilter = string;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/types/shared/not-found-error.d.ts
|
|
44
|
+
/** Resource not found */
|
|
45
|
+
type NotFoundError = Error;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/types/shared/validation-error.d.ts
|
|
48
|
+
/** Invalid request data */
|
|
49
|
+
type ValidationError = Error;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/types/analytics.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* The window the response was computed over, echoed back as the half-open instants it resolved to.
|
|
54
|
+
*/
|
|
55
|
+
type DateRange = {
|
|
56
|
+
/** Exclusive upper bound, in UTC. */
|
|
57
|
+
end: Date;
|
|
58
|
+
/** Inclusive lower bound, in UTC. */
|
|
59
|
+
start: Date;
|
|
60
|
+
};
|
|
61
|
+
type VisibilityPoint = {
|
|
62
|
+
date: string;
|
|
63
|
+
/**
|
|
64
|
+
* Null on days with no runs to plot; the series is not gap-filled with zeros. Ratio 0–1; multiply
|
|
65
|
+
* by 100 for a percentage.
|
|
66
|
+
*
|
|
67
|
+
* @minimum 0
|
|
68
|
+
* @maximum 1
|
|
69
|
+
*/
|
|
70
|
+
visibility: number | null;
|
|
71
|
+
};
|
|
72
|
+
type ShareOfVoiceEntry = {
|
|
73
|
+
/** True for the tracked brand's own row. */
|
|
74
|
+
isBrand: boolean;
|
|
75
|
+
mentions: number;
|
|
76
|
+
/** Brand or competitor name. */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Distinct prompts this entity appeared in. */
|
|
79
|
+
prompts: number;
|
|
80
|
+
/**
|
|
81
|
+
* This entity's share of all brand and competitor mentions. Ratio 0–1; multiply by 100 for a
|
|
82
|
+
* percentage.
|
|
83
|
+
*
|
|
84
|
+
* @minimum 0
|
|
85
|
+
* @maximum 1
|
|
86
|
+
*/
|
|
87
|
+
share: number;
|
|
88
|
+
};
|
|
89
|
+
type ShareOfVoicePoint = {
|
|
90
|
+
date: string;
|
|
91
|
+
/**
|
|
92
|
+
* The brand's share on this day. Null on days with no runs. Ratio 0–1; multiply by 100 for a
|
|
93
|
+
* percentage.
|
|
94
|
+
*
|
|
95
|
+
* @minimum 0
|
|
96
|
+
* @maximum 1
|
|
97
|
+
*/
|
|
98
|
+
share: number | null;
|
|
99
|
+
};
|
|
100
|
+
type CitationDomain = {
|
|
101
|
+
/** Which side of the citation landscape the domain sits on. */
|
|
102
|
+
category: 'brand' | 'competitor' | 'editorial' | 'reviews' | 'ecommerce' | 'social' | 'developer' | 'pr' | 'reference' | 'institutional' | 'other';
|
|
103
|
+
/**
|
|
104
|
+
* How this window compares with the equal-length window before it, as a multiplier of the
|
|
105
|
+
* previous count: 2 means twice as many citations, 0.5 means half, 1 means unchanged. Not a
|
|
106
|
+
* percentage change — 1.5 is "1.5x", which is a 50% increase. Null when the domain had no
|
|
107
|
+
* citations in the previous window, so there is nothing to divide by.
|
|
108
|
+
*
|
|
109
|
+
* @minimum 0
|
|
110
|
+
*/
|
|
111
|
+
changeFactor: number | null;
|
|
112
|
+
/** Citations to this domain in the window. */
|
|
113
|
+
count: number;
|
|
114
|
+
domain: string;
|
|
115
|
+
/** Citations in the equal-length window immediately before this one. */
|
|
116
|
+
previousCount: number;
|
|
117
|
+
/** Distinct prompts whose answers cited this domain. */
|
|
118
|
+
promptCount: number;
|
|
119
|
+
/**
|
|
120
|
+
* Share of all citations in the window. Ratio 0–1; multiply by 100 for a percentage.
|
|
121
|
+
*
|
|
122
|
+
* @minimum 0
|
|
123
|
+
* @maximum 1
|
|
124
|
+
*/
|
|
125
|
+
share: number;
|
|
126
|
+
};
|
|
127
|
+
type CitationDomainList = {
|
|
128
|
+
brandId: string;
|
|
129
|
+
/** Every domain cited over the window, ordered by citation count. */
|
|
130
|
+
data: Array<CitationDomain>;
|
|
131
|
+
range: DateRange;
|
|
132
|
+
totals: {
|
|
133
|
+
citations: number;
|
|
134
|
+
uniqueDomains: number;
|
|
135
|
+
uniqueUrls: number;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
type CitationURL = {
|
|
139
|
+
/** Which side of the citation landscape the domain sits on. */
|
|
140
|
+
category: 'brand' | 'competitor' | 'editorial' | 'reviews' | 'ecommerce' | 'social' | 'developer' | 'pr' | 'reference' | 'institutional' | 'other';
|
|
141
|
+
count: number;
|
|
142
|
+
domain: string;
|
|
143
|
+
/** Not cited in the equal-length window immediately before this one. */
|
|
144
|
+
isNew: boolean;
|
|
145
|
+
/** What kind of page was cited. */
|
|
146
|
+
pageType: 'homepage' | 'article' | 'listicle' | 'howto' | 'comparison' | 'review' | 'forum' | 'video' | 'doc' | 'product' | 'info' | 'search' | 'shopping' | 'other';
|
|
147
|
+
promptCount: number;
|
|
148
|
+
title: string | null;
|
|
149
|
+
url: string;
|
|
150
|
+
};
|
|
151
|
+
type CitationURLList = {
|
|
152
|
+
brandId: string;
|
|
153
|
+
/** Every URL cited over the window, ordered by citation count. */
|
|
154
|
+
data: Array<CitationURL>;
|
|
155
|
+
range: DateRange;
|
|
156
|
+
totals: {
|
|
157
|
+
citations: number;
|
|
158
|
+
uniqueDomains: number;
|
|
159
|
+
uniqueUrls: number;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
type FanoutQuery = {
|
|
163
|
+
promptCount: number;
|
|
164
|
+
/** A search the engine ran while answering. */
|
|
165
|
+
query: string;
|
|
166
|
+
runs: number;
|
|
167
|
+
};
|
|
168
|
+
type BrandQueryFanout = {
|
|
169
|
+
avgQueriesPerRun: number;
|
|
170
|
+
brandId: string;
|
|
171
|
+
/**
|
|
172
|
+
* Share of fan-out query instances whose answer mentioned the brand. Ratio 0–1; multiply by 100
|
|
173
|
+
* for a percentage.
|
|
174
|
+
*
|
|
175
|
+
* @minimum 0
|
|
176
|
+
* @maximum 1
|
|
177
|
+
*/
|
|
178
|
+
coverageRate: number;
|
|
179
|
+
/** Every distinct sub-query over the window, ordered by the runs that ran it. */
|
|
180
|
+
data: Array<FanoutQuery>;
|
|
181
|
+
/**
|
|
182
|
+
* Runs that searched at all. Engines that don't expose their searches contribute runs but no
|
|
183
|
+
* queries.
|
|
184
|
+
*/
|
|
185
|
+
fanoutRuns: number;
|
|
186
|
+
range: DateRange;
|
|
187
|
+
totalQueries: number;
|
|
188
|
+
totalRuns: number;
|
|
189
|
+
uniqueQueries: number;
|
|
190
|
+
};
|
|
191
|
+
type PromptPerformance = {
|
|
192
|
+
/**
|
|
193
|
+
* Share of this prompt's runs mentioning the brand. Ratio 0–1; multiply by 100 for a percentage.
|
|
194
|
+
*
|
|
195
|
+
* @minimum 0
|
|
196
|
+
* @maximum 1
|
|
197
|
+
*/
|
|
198
|
+
brandMentionRate: number;
|
|
199
|
+
/**
|
|
200
|
+
* Share of this prompt's runs mentioning any tracked competitor. Ratio 0–1; multiply by 100 for a
|
|
201
|
+
* percentage.
|
|
202
|
+
*
|
|
203
|
+
* @minimum 0
|
|
204
|
+
* @maximum 1
|
|
205
|
+
*/
|
|
206
|
+
competitorMentionRate: number;
|
|
207
|
+
firstEvaluatedAt: Date | null;
|
|
208
|
+
lastRunAt: Date | null;
|
|
209
|
+
promptId: string;
|
|
210
|
+
tags: Array<string>;
|
|
211
|
+
totalRuns: number;
|
|
212
|
+
value: string;
|
|
213
|
+
};
|
|
214
|
+
type PromptPerformanceList = {
|
|
215
|
+
brandId: string;
|
|
216
|
+
/** Every prompt sampled over the window, with its results. */
|
|
217
|
+
data: Array<PromptPerformance>;
|
|
218
|
+
range: DateRange;
|
|
219
|
+
};
|
|
220
|
+
type ModelVisibility = {
|
|
221
|
+
brandMentions: number;
|
|
222
|
+
citations: number;
|
|
223
|
+
label: string;
|
|
224
|
+
model: string;
|
|
225
|
+
runs: number;
|
|
226
|
+
/**
|
|
227
|
+
* Share of this model's runs that mentioned the brand. Ratio 0–1; multiply by 100 for a
|
|
228
|
+
* percentage.
|
|
229
|
+
*
|
|
230
|
+
* @minimum 0
|
|
231
|
+
* @maximum 1
|
|
232
|
+
*/
|
|
233
|
+
visibility: number | null;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Every non-paginated figure for a brand over one window. There is no parameter for selecting a
|
|
237
|
+
* subset: the four computations behind this share one scope resolution and run concurrently, so a
|
|
238
|
+
* subset would save a caller a fraction of one request and cost everyone a parameter to reason
|
|
239
|
+
* about.
|
|
240
|
+
*/
|
|
241
|
+
type BrandAnalytics = {
|
|
242
|
+
brandId: string;
|
|
243
|
+
brandName: string;
|
|
244
|
+
/** Per-model visibility and run counts. Only models that produced a run in the window appear. */
|
|
245
|
+
models: Array<ModelVisibility>;
|
|
246
|
+
range: DateRange;
|
|
247
|
+
/** The brand against its tracked competitors. */
|
|
248
|
+
shareOfVoice: {
|
|
249
|
+
/**
|
|
250
|
+
* The brand's own share at the end of the window. Ratio 0–1; multiply by 100 for a percentage.
|
|
251
|
+
*
|
|
252
|
+
* @minimum 0
|
|
253
|
+
* @maximum 1
|
|
254
|
+
*/
|
|
255
|
+
brand: number | null;
|
|
256
|
+
/** Leaderboard, highest share first. */
|
|
257
|
+
entries: Array<ShareOfVoiceEntry>;
|
|
258
|
+
/** The brand's share over time. */
|
|
259
|
+
series: Array<ShareOfVoicePoint>;
|
|
260
|
+
};
|
|
261
|
+
totals: {
|
|
262
|
+
citations: number;
|
|
263
|
+
/** Enabled prompts counted in the window. */
|
|
264
|
+
prompts: number;
|
|
265
|
+
runs: number;
|
|
266
|
+
uniqueDomains: number;
|
|
267
|
+
uniqueUrls: number;
|
|
268
|
+
};
|
|
269
|
+
/** How often the brand is mentioned at all. */
|
|
270
|
+
visibility: {
|
|
271
|
+
/**
|
|
272
|
+
* The last plotted point — the number the dashboard hero shows. Ratio 0–1; multiply by 100 for
|
|
273
|
+
* a percentage.
|
|
274
|
+
*
|
|
275
|
+
* @minimum 0
|
|
276
|
+
* @maximum 1
|
|
277
|
+
*/
|
|
278
|
+
current: number | null;
|
|
279
|
+
series: Array<VisibilityPoint>;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
/** Comma-separated prompt tags. Only prompts carrying at least one of them are counted. */
|
|
283
|
+
type TagsFilter = string;
|
|
284
|
+
type GetBrandAnalyticsErrors = {
|
|
285
|
+
/** Invalid request data */
|
|
286
|
+
400: ValidationError;
|
|
287
|
+
/** Authentication required */
|
|
288
|
+
401: UnauthorizedError;
|
|
289
|
+
/**
|
|
290
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
291
|
+
* read-only (demo) mode.
|
|
292
|
+
*/
|
|
293
|
+
403: ForbiddenError;
|
|
294
|
+
/** Resource not found */
|
|
295
|
+
404: NotFoundError;
|
|
296
|
+
/** Per-key rate limit exceeded. */
|
|
297
|
+
429: RateLimitError;
|
|
298
|
+
/** Internal server error */
|
|
299
|
+
500: InternalServerError;
|
|
300
|
+
};
|
|
301
|
+
type GetBrandAnalyticsResponses = {
|
|
302
|
+
/** Get a brand's analytics */
|
|
303
|
+
200: BrandAnalytics;
|
|
304
|
+
};
|
|
305
|
+
type ListBrandCitationDomainsErrors = {
|
|
306
|
+
/** Invalid request data */
|
|
307
|
+
400: ValidationError;
|
|
308
|
+
/** Authentication required */
|
|
309
|
+
401: UnauthorizedError;
|
|
310
|
+
/**
|
|
311
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
312
|
+
* read-only (demo) mode.
|
|
313
|
+
*/
|
|
314
|
+
403: ForbiddenError;
|
|
315
|
+
/** Resource not found */
|
|
316
|
+
404: NotFoundError;
|
|
317
|
+
/** Per-key rate limit exceeded. */
|
|
318
|
+
429: RateLimitError;
|
|
319
|
+
/** Internal server error */
|
|
320
|
+
500: InternalServerError;
|
|
321
|
+
};
|
|
322
|
+
type ListBrandCitationDomainsResponses = {
|
|
323
|
+
/** List cited domains */
|
|
324
|
+
200: CitationDomainList;
|
|
325
|
+
};
|
|
326
|
+
type ListBrandCitationURLsErrors = {
|
|
327
|
+
/** Invalid request data */
|
|
328
|
+
400: ValidationError;
|
|
329
|
+
/** Authentication required */
|
|
330
|
+
401: UnauthorizedError;
|
|
331
|
+
/**
|
|
332
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
333
|
+
* read-only (demo) mode.
|
|
334
|
+
*/
|
|
335
|
+
403: ForbiddenError;
|
|
336
|
+
/** Resource not found */
|
|
337
|
+
404: NotFoundError;
|
|
338
|
+
/** Per-key rate limit exceeded. */
|
|
339
|
+
429: RateLimitError;
|
|
340
|
+
/** Internal server error */
|
|
341
|
+
500: InternalServerError;
|
|
342
|
+
};
|
|
343
|
+
type ListBrandCitationURLsResponses = {
|
|
344
|
+
/** List cited URLs */
|
|
345
|
+
200: CitationURLList;
|
|
346
|
+
};
|
|
347
|
+
type ListBrandPromptPerformanceErrors = {
|
|
348
|
+
/** Invalid request data */
|
|
349
|
+
400: ValidationError;
|
|
350
|
+
/** Authentication required */
|
|
351
|
+
401: UnauthorizedError;
|
|
352
|
+
/**
|
|
353
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
354
|
+
* read-only (demo) mode.
|
|
355
|
+
*/
|
|
356
|
+
403: ForbiddenError;
|
|
357
|
+
/** Resource not found */
|
|
358
|
+
404: NotFoundError;
|
|
359
|
+
/** Per-key rate limit exceeded. */
|
|
360
|
+
429: RateLimitError;
|
|
361
|
+
/** Internal server error */
|
|
362
|
+
500: InternalServerError;
|
|
363
|
+
};
|
|
364
|
+
type ListBrandPromptPerformanceResponses = {
|
|
365
|
+
/** List prompt performance */
|
|
366
|
+
200: PromptPerformanceList;
|
|
367
|
+
};
|
|
368
|
+
type GetBrandQueryFanoutErrors = {
|
|
369
|
+
/** Invalid request data */
|
|
370
|
+
400: ValidationError;
|
|
371
|
+
/** Authentication required */
|
|
372
|
+
401: UnauthorizedError;
|
|
373
|
+
/**
|
|
374
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
375
|
+
* read-only (demo) mode.
|
|
376
|
+
*/
|
|
377
|
+
403: ForbiddenError;
|
|
378
|
+
/** Resource not found */
|
|
379
|
+
404: NotFoundError;
|
|
380
|
+
/** Per-key rate limit exceeded. */
|
|
381
|
+
429: RateLimitError;
|
|
382
|
+
/** Internal server error */
|
|
383
|
+
500: InternalServerError;
|
|
384
|
+
};
|
|
385
|
+
type GetBrandQueryFanoutResponses = {
|
|
386
|
+
/** Get query fan-out */
|
|
387
|
+
200: BrandQueryFanout;
|
|
388
|
+
};
|
|
389
|
+
type GetBrandAnalyticsParams = {
|
|
390
|
+
/**
|
|
391
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A
|
|
392
|
+
* bare `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a
|
|
393
|
+
* local calendar day there.
|
|
394
|
+
*/
|
|
395
|
+
start: WindowStart;
|
|
396
|
+
/**
|
|
397
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
398
|
+
* exactly `end` is outside it.
|
|
399
|
+
*/
|
|
400
|
+
end: WindowEnd;
|
|
401
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
402
|
+
model?: ModelFilter;
|
|
403
|
+
/** Comma-separated prompt tags. Only prompts carrying at least one of them are counted. */
|
|
404
|
+
tags?: TagsFilter;
|
|
405
|
+
};
|
|
406
|
+
type ListBrandCitationDomainsParams = {
|
|
407
|
+
/**
|
|
408
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A
|
|
409
|
+
* bare `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a
|
|
410
|
+
* local calendar day there.
|
|
411
|
+
*/
|
|
412
|
+
start: WindowStart;
|
|
413
|
+
/**
|
|
414
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
415
|
+
* exactly `end` is outside it.
|
|
416
|
+
*/
|
|
417
|
+
end: WindowEnd;
|
|
418
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
419
|
+
model?: ModelFilter;
|
|
420
|
+
/** Comma-separated prompt tags. Only prompts carrying at least one of them are counted. */
|
|
421
|
+
tags?: TagsFilter;
|
|
422
|
+
};
|
|
423
|
+
type ListBrandCitationURLsParams = {
|
|
424
|
+
/**
|
|
425
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A
|
|
426
|
+
* bare `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a
|
|
427
|
+
* local calendar day there.
|
|
428
|
+
*/
|
|
429
|
+
start: WindowStart;
|
|
430
|
+
/**
|
|
431
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
432
|
+
* exactly `end` is outside it.
|
|
433
|
+
*/
|
|
434
|
+
end: WindowEnd;
|
|
435
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
436
|
+
model?: ModelFilter;
|
|
437
|
+
/** Comma-separated prompt tags. Only prompts carrying at least one of them are counted. */
|
|
438
|
+
tags?: TagsFilter;
|
|
439
|
+
};
|
|
440
|
+
type ListBrandPromptPerformanceParams = {
|
|
441
|
+
/**
|
|
442
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A
|
|
443
|
+
* bare `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a
|
|
444
|
+
* local calendar day there.
|
|
445
|
+
*/
|
|
446
|
+
start: WindowStart;
|
|
447
|
+
/**
|
|
448
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
449
|
+
* exactly `end` is outside it.
|
|
450
|
+
*/
|
|
451
|
+
end: WindowEnd;
|
|
452
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
453
|
+
model?: ModelFilter;
|
|
454
|
+
/** Comma-separated prompt tags. Only prompts carrying at least one of them are counted. */
|
|
455
|
+
tags?: TagsFilter;
|
|
456
|
+
};
|
|
457
|
+
type GetBrandQueryFanoutParams = {
|
|
458
|
+
/**
|
|
459
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A
|
|
460
|
+
* bare `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a
|
|
461
|
+
* local calendar day there.
|
|
462
|
+
*/
|
|
463
|
+
start: WindowStart;
|
|
464
|
+
/**
|
|
465
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
466
|
+
* exactly `end` is outside it.
|
|
467
|
+
*/
|
|
468
|
+
end: WindowEnd;
|
|
469
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
470
|
+
model?: ModelFilter;
|
|
471
|
+
/** Comma-separated prompt tags. Only prompts carrying at least one of them are counted. */
|
|
472
|
+
tags?: TagsFilter;
|
|
473
|
+
};
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region src/types/shared/brand-id-path.d.ts
|
|
476
|
+
/** Brand identifier. */
|
|
477
|
+
type BrandIdPath = string;
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/types/opportunities.d.ts
|
|
480
|
+
type OpportunityPrompt = {
|
|
481
|
+
/** The tracked prompt it resolved to, or null when it didn't match one. */
|
|
482
|
+
promptId: string | null;
|
|
483
|
+
/** The prompt as the report names it. */
|
|
484
|
+
text: string;
|
|
485
|
+
};
|
|
486
|
+
type CitedPage = {
|
|
487
|
+
domain: string;
|
|
488
|
+
title: string | null;
|
|
489
|
+
url: string;
|
|
490
|
+
};
|
|
491
|
+
type Opportunity = {
|
|
492
|
+
/**
|
|
493
|
+
* Which workstream this belongs to: `creation` is net-new content, `existing-content` is a page
|
|
494
|
+
* that could win the mention with a refresh, `outreach` is earning a placement on a third-party
|
|
495
|
+
* site assistants cite, `social` is the community conversations they pull from.
|
|
496
|
+
*/
|
|
497
|
+
category: 'creation' | 'existing-content' | 'outreach' | 'social';
|
|
498
|
+
/** Pages on competitor domains cited for those prompts. */
|
|
499
|
+
competitorCitations: Array<CitedPage>;
|
|
500
|
+
/** Tracked prompts this would help. May be empty. */
|
|
501
|
+
relatedPrompts: Array<OpportunityPrompt>;
|
|
502
|
+
/** Short and action-oriented — the concrete surface or angle. */
|
|
503
|
+
title: string;
|
|
504
|
+
/** Why it is worth doing, in plain language. */
|
|
505
|
+
why: string;
|
|
506
|
+
/** Pages on the brand's own domains already cited for those prompts. */
|
|
507
|
+
yourCitations: Array<CitedPage>;
|
|
508
|
+
};
|
|
509
|
+
/**
|
|
510
|
+
* The brand's latest Opportunities report — the same LLM-generated analysis the dashboard shows,
|
|
511
|
+
* read from the append-only history rather than regenerated. Elmo decides when to produce a new
|
|
512
|
+
* one; there is no way to trigger generation over the API, because it spends provider budget with
|
|
513
|
+
* no per-call metering behind it.
|
|
514
|
+
*/
|
|
515
|
+
type BrandOpportunities = {
|
|
516
|
+
brandId: string;
|
|
517
|
+
generatedAt: Date | null;
|
|
518
|
+
/** The model that produced the report, when recorded. */
|
|
519
|
+
model: string | null;
|
|
520
|
+
/** Prioritized, highest impact first. */
|
|
521
|
+
opportunities: Array<Opportunity>;
|
|
522
|
+
/** Caveats: hard-to-win areas, or tactics to avoid. */
|
|
523
|
+
risks: Array<string>;
|
|
524
|
+
/**
|
|
525
|
+
* `ready` when a report is present. `insufficient-data` when the brand hasn't accumulated enough
|
|
526
|
+
* tracked answers to say anything useful yet, in which case the lists are empty.
|
|
527
|
+
*/
|
|
528
|
+
status: 'ready' | 'insufficient-data';
|
|
529
|
+
/** A few bullets on where the brand stands and the through-line of the plan. */
|
|
530
|
+
summary: Array<string>;
|
|
531
|
+
};
|
|
532
|
+
type GetBrandOpportunitiesErrors = {
|
|
533
|
+
/** Authentication required */
|
|
534
|
+
401: UnauthorizedError;
|
|
535
|
+
/**
|
|
536
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
537
|
+
* read-only (demo) mode.
|
|
538
|
+
*/
|
|
539
|
+
403: ForbiddenError;
|
|
540
|
+
/** Resource not found */
|
|
541
|
+
404: NotFoundError;
|
|
542
|
+
/** Per-key rate limit exceeded. */
|
|
543
|
+
429: RateLimitError;
|
|
544
|
+
/** Internal server error */
|
|
545
|
+
500: InternalServerError;
|
|
546
|
+
};
|
|
547
|
+
type GetBrandOpportunitiesResponses = {
|
|
548
|
+
/** Get the latest opportunities report */
|
|
549
|
+
200: BrandOpportunities;
|
|
550
|
+
};
|
|
551
|
+
//#endregion
|
|
552
|
+
//#region src/types/tags.d.ts
|
|
553
|
+
type Tag = {
|
|
554
|
+
/** The tag, normalized to lower case. */
|
|
555
|
+
name: string;
|
|
556
|
+
/** Prompts in this brand carrying the tag. */
|
|
557
|
+
promptCount: number;
|
|
558
|
+
/**
|
|
559
|
+
* True for `branded` and `unbranded`, which Elmo computes from the prompt text. A system tag
|
|
560
|
+
* always appears here; applying it to a prompt as a user tag overrides the computed
|
|
561
|
+
* classification rather than creating a new tag.
|
|
562
|
+
*/
|
|
563
|
+
system: boolean;
|
|
564
|
+
};
|
|
565
|
+
type TagList = {
|
|
566
|
+
brandId: string;
|
|
567
|
+
/** System tags first, then user tags alphabetically — the order the dashboard's filter shows. */
|
|
568
|
+
data: Array<Tag>;
|
|
569
|
+
};
|
|
570
|
+
type ListBrandTagsErrors = {
|
|
571
|
+
/** Authentication required */
|
|
572
|
+
401: UnauthorizedError;
|
|
573
|
+
/**
|
|
574
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
575
|
+
* read-only (demo) mode.
|
|
576
|
+
*/
|
|
577
|
+
403: ForbiddenError;
|
|
578
|
+
/** Resource not found */
|
|
579
|
+
404: NotFoundError;
|
|
580
|
+
/** Per-key rate limit exceeded. */
|
|
581
|
+
429: RateLimitError;
|
|
582
|
+
/** Internal server error */
|
|
583
|
+
500: InternalServerError;
|
|
584
|
+
};
|
|
585
|
+
type ListBrandTagsResponses = {
|
|
586
|
+
/** List a brand's tags */
|
|
587
|
+
200: TagList;
|
|
588
|
+
};
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region src/types/shared/conflict-error.d.ts
|
|
591
|
+
/** Resource already exists */
|
|
592
|
+
type ConflictError = Error;
|
|
593
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
594
|
+
type PaymentRequiredError = Error;
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region src/types/shared/limit.d.ts
|
|
597
|
+
/**
|
|
598
|
+
* Items per page. Values above the maximum are clamped, not rejected.
|
|
599
|
+
*
|
|
600
|
+
* @default 20
|
|
601
|
+
* @minimum 1
|
|
602
|
+
* @maximum 100
|
|
603
|
+
*/
|
|
604
|
+
type Limit = number;
|
|
605
|
+
//#endregion
|
|
606
|
+
//#region src/types/shared/page.d.ts
|
|
607
|
+
/**
|
|
608
|
+
* Page number, 1-based.
|
|
609
|
+
*
|
|
610
|
+
* @default 1
|
|
611
|
+
* @minimum 1
|
|
612
|
+
*/
|
|
613
|
+
type Page = number;
|
|
614
|
+
//#endregion
|
|
615
|
+
//#region src/types/shared/pagination.d.ts
|
|
616
|
+
type Pagination = {
|
|
617
|
+
limit: number;
|
|
618
|
+
page: number;
|
|
619
|
+
/** Total items matching the request. */
|
|
620
|
+
total: number;
|
|
621
|
+
totalPages: number;
|
|
622
|
+
};
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/types/brands.d.ts
|
|
625
|
+
type Brand = {
|
|
626
|
+
aliases: Array<string>;
|
|
627
|
+
createdAt: Date;
|
|
628
|
+
/** Sampling cadence override in hours. Null means the plan cadence. */
|
|
629
|
+
delayOverrideHours: number | null;
|
|
630
|
+
/**
|
|
631
|
+
* Brand domains. The first entry is the primary website; remaining entries are additional
|
|
632
|
+
* domains.
|
|
633
|
+
*/
|
|
634
|
+
domains: Array<string>;
|
|
635
|
+
enabled: boolean;
|
|
636
|
+
/** Models this brand is tracked on. Null means the deployment default. */
|
|
637
|
+
enabledModels: Array<string> | null;
|
|
638
|
+
/** User-supplied brand identifier (e.g. "acme") */
|
|
639
|
+
id: string;
|
|
640
|
+
name: string;
|
|
641
|
+
onboarded: boolean;
|
|
642
|
+
/** The organization that owns this brand and is billed for it. */
|
|
643
|
+
organizationId: string;
|
|
644
|
+
updatedAt: Date;
|
|
645
|
+
};
|
|
646
|
+
type BrandsList = {
|
|
647
|
+
/**
|
|
648
|
+
* Deprecated: read `data` instead. Kept while the one known consumer migrates, and removed in a
|
|
649
|
+
* future release.
|
|
650
|
+
*
|
|
651
|
+
* @deprecated
|
|
652
|
+
*/
|
|
653
|
+
brands: Array<Brand>;
|
|
654
|
+
/** The items on this page. Read this rather than the named key below. */
|
|
655
|
+
data: Array<Brand>;
|
|
656
|
+
pagination: Pagination;
|
|
657
|
+
};
|
|
658
|
+
type ListBrandsErrors = {
|
|
659
|
+
/** Authentication required */
|
|
660
|
+
401: UnauthorizedError;
|
|
661
|
+
/**
|
|
662
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
663
|
+
* read-only (demo) mode.
|
|
664
|
+
*/
|
|
665
|
+
403: ForbiddenError;
|
|
666
|
+
/** Per-key rate limit exceeded. */
|
|
667
|
+
429: RateLimitError;
|
|
668
|
+
/** Internal server error */
|
|
669
|
+
500: InternalServerError;
|
|
670
|
+
};
|
|
671
|
+
type ListBrandsResponses = {
|
|
672
|
+
/** Paginated list of brands */
|
|
673
|
+
200: BrandsList;
|
|
674
|
+
};
|
|
675
|
+
type CreateBrandErrors = {
|
|
676
|
+
/** Invalid request data */
|
|
677
|
+
400: ValidationError;
|
|
678
|
+
/** Authentication required */
|
|
679
|
+
401: UnauthorizedError;
|
|
680
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
681
|
+
402: PaymentRequiredError;
|
|
682
|
+
/**
|
|
683
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
684
|
+
* read-only (demo) mode.
|
|
685
|
+
*/
|
|
686
|
+
403: ForbiddenError;
|
|
687
|
+
/** Resource not found */
|
|
688
|
+
404: NotFoundError;
|
|
689
|
+
/** Resource already exists */
|
|
690
|
+
409: ConflictError;
|
|
691
|
+
/** Per-key rate limit exceeded. */
|
|
692
|
+
429: RateLimitError;
|
|
693
|
+
/** Internal server error */
|
|
694
|
+
500: InternalServerError;
|
|
695
|
+
};
|
|
696
|
+
type CreateBrandResponses = {
|
|
697
|
+
/** Brand created */
|
|
698
|
+
201: Brand;
|
|
699
|
+
};
|
|
700
|
+
type GetBrandErrors = {
|
|
701
|
+
/** Authentication required */
|
|
702
|
+
401: UnauthorizedError;
|
|
703
|
+
/**
|
|
704
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
705
|
+
* read-only (demo) mode.
|
|
706
|
+
*/
|
|
707
|
+
403: ForbiddenError;
|
|
708
|
+
/** Resource not found */
|
|
709
|
+
404: NotFoundError;
|
|
710
|
+
/** Per-key rate limit exceeded. */
|
|
711
|
+
429: RateLimitError;
|
|
712
|
+
/** Internal server error */
|
|
713
|
+
500: InternalServerError;
|
|
714
|
+
};
|
|
715
|
+
type GetBrandResponses = {
|
|
716
|
+
/** Brand */
|
|
717
|
+
200: Brand;
|
|
718
|
+
};
|
|
719
|
+
type UpdateBrandErrors = {
|
|
720
|
+
/** Invalid request data */
|
|
721
|
+
400: ValidationError;
|
|
722
|
+
/** Authentication required */
|
|
723
|
+
401: UnauthorizedError;
|
|
724
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
725
|
+
402: PaymentRequiredError;
|
|
726
|
+
/**
|
|
727
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
728
|
+
* read-only (demo) mode.
|
|
729
|
+
*/
|
|
730
|
+
403: ForbiddenError;
|
|
731
|
+
/** Resource not found */
|
|
732
|
+
404: NotFoundError;
|
|
733
|
+
/** Resource already exists */
|
|
734
|
+
409: ConflictError;
|
|
735
|
+
/** Per-key rate limit exceeded. */
|
|
736
|
+
429: RateLimitError;
|
|
737
|
+
/** Internal server error */
|
|
738
|
+
500: InternalServerError;
|
|
739
|
+
};
|
|
740
|
+
type UpdateBrandResponses = {
|
|
741
|
+
/** Brand updated */
|
|
742
|
+
200: Brand;
|
|
743
|
+
};
|
|
744
|
+
type ListBrandsParams = {
|
|
745
|
+
/**
|
|
746
|
+
* Page number, 1-based.
|
|
747
|
+
*
|
|
748
|
+
* @default 1
|
|
749
|
+
* @minimum 1
|
|
750
|
+
*/
|
|
751
|
+
page?: Page;
|
|
752
|
+
/**
|
|
753
|
+
* Items per page. Values above the maximum are clamped, not rejected.
|
|
754
|
+
*
|
|
755
|
+
* @default 20
|
|
756
|
+
* @minimum 1
|
|
757
|
+
* @maximum 100
|
|
758
|
+
*/
|
|
759
|
+
limit?: Limit;
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Create a brand. Skips onboarding. The first entry in `domains` is treated as the brand's primary
|
|
763
|
+
* website; the rest are stored as additional domains.
|
|
764
|
+
*/
|
|
765
|
+
type CreateBrandParams = {
|
|
766
|
+
/** @minLength 1 */
|
|
767
|
+
id: string;
|
|
768
|
+
/** @minLength 1 */
|
|
769
|
+
name: string;
|
|
770
|
+
/**
|
|
771
|
+
* Brand domains. The first entry is the primary website; remaining entries are additional
|
|
772
|
+
* domains.
|
|
773
|
+
*
|
|
774
|
+
* @minItems 1
|
|
775
|
+
*/
|
|
776
|
+
domains: Array<string>;
|
|
777
|
+
aliases?: Array<string>;
|
|
778
|
+
competitors?: Array<{
|
|
779
|
+
aliases?: Array<string>;
|
|
780
|
+
domains?: Array<string>;
|
|
781
|
+
/** @minLength 1 */
|
|
782
|
+
name: string;
|
|
783
|
+
}>;
|
|
784
|
+
prompts?: Array<{
|
|
785
|
+
/** @default true */
|
|
786
|
+
enabled?: boolean;
|
|
787
|
+
tags?: Array<string>;
|
|
788
|
+
/** @minLength 1 */
|
|
789
|
+
value: string;
|
|
790
|
+
}>;
|
|
791
|
+
/**
|
|
792
|
+
* Organization to create the brand in.
|
|
793
|
+
*
|
|
794
|
+
* | | Omitted | Present |
|
|
795
|
+
* | --- | --- | --- |
|
|
796
|
+
* | **Organization key** | creates in the key's own organization | must name the key's own organization; any other value is a `400` |
|
|
797
|
+
* | **Admin key** | provisions a new organization named after the brand id | creates in the named organization, which must already exist — `404` if it does not |
|
|
798
|
+
*
|
|
799
|
+
* An admin key omitting this field is currently the only way to create an organization over the
|
|
800
|
+
* API.
|
|
801
|
+
*/
|
|
802
|
+
organizationId?: string;
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* Update brand-level fields. At least one field must be provided. Provided arrays replace the
|
|
806
|
+
* stored values verbatim. When `domains` is provided, the first entry becomes the primary website
|
|
807
|
+
* and the rest become additional domains. Prompts and competitors are managed via /prompts and
|
|
808
|
+
* /competitors.
|
|
809
|
+
*/
|
|
810
|
+
type UpdateBrandParams = {
|
|
811
|
+
/** @minLength 1 */
|
|
812
|
+
brandName?: string;
|
|
813
|
+
/**
|
|
814
|
+
* Brand domains. The first entry is the primary website; remaining entries are additional
|
|
815
|
+
* domains.
|
|
816
|
+
*
|
|
817
|
+
* @minItems 1
|
|
818
|
+
*/
|
|
819
|
+
domains?: Array<string>;
|
|
820
|
+
aliases?: Array<string>;
|
|
821
|
+
/**
|
|
822
|
+
* Whether the brand is sampled at all. **Modifiable only with an instance admin key**: setting it
|
|
823
|
+
* with an organization key is a `403`, because disabling ends tracking silently while the plan
|
|
824
|
+
* keeps being billed and no dashboard control does it at any role.
|
|
825
|
+
*/
|
|
826
|
+
enabled?: boolean;
|
|
827
|
+
};
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region src/types/competitors.d.ts
|
|
830
|
+
type Competitor = {
|
|
831
|
+
aliases: Array<string>;
|
|
832
|
+
brandId: string;
|
|
833
|
+
createdAt: Date;
|
|
834
|
+
domains: Array<string>;
|
|
835
|
+
id: string;
|
|
836
|
+
name: string;
|
|
837
|
+
updatedAt: Date;
|
|
838
|
+
};
|
|
839
|
+
type CompetitorsList = {
|
|
840
|
+
/**
|
|
841
|
+
* Deprecated: read `data` instead. Kept while the one known consumer migrates, and removed in a
|
|
842
|
+
* future release.
|
|
843
|
+
*
|
|
844
|
+
* @deprecated
|
|
845
|
+
*/
|
|
846
|
+
competitors: Array<Competitor>;
|
|
847
|
+
/** The items on this page. Read this rather than the named key below. */
|
|
848
|
+
data: Array<Competitor>;
|
|
849
|
+
pagination: Pagination;
|
|
850
|
+
};
|
|
851
|
+
type ListCompetitorsErrors = {
|
|
852
|
+
/** Authentication required */
|
|
853
|
+
401: UnauthorizedError;
|
|
854
|
+
/**
|
|
855
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
856
|
+
* read-only (demo) mode.
|
|
857
|
+
*/
|
|
858
|
+
403: ForbiddenError;
|
|
859
|
+
/** Per-key rate limit exceeded. */
|
|
860
|
+
429: RateLimitError;
|
|
861
|
+
/** Internal server error */
|
|
862
|
+
500: InternalServerError;
|
|
863
|
+
};
|
|
864
|
+
type ListCompetitorsResponses = {
|
|
865
|
+
/** Paginated list of competitors */
|
|
866
|
+
200: CompetitorsList;
|
|
867
|
+
};
|
|
868
|
+
type CreateCompetitorErrors = {
|
|
869
|
+
/** Invalid request data */
|
|
870
|
+
400: ValidationError;
|
|
871
|
+
/** Authentication required */
|
|
872
|
+
401: UnauthorizedError;
|
|
873
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
874
|
+
402: PaymentRequiredError;
|
|
875
|
+
/**
|
|
876
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
877
|
+
* read-only (demo) mode.
|
|
878
|
+
*/
|
|
879
|
+
403: ForbiddenError;
|
|
880
|
+
/** Resource already exists */
|
|
881
|
+
409: ConflictError;
|
|
882
|
+
/** Per-key rate limit exceeded. */
|
|
883
|
+
429: RateLimitError;
|
|
884
|
+
/** Internal server error */
|
|
885
|
+
500: InternalServerError;
|
|
886
|
+
};
|
|
887
|
+
type CreateCompetitorResponses = {
|
|
888
|
+
/** Competitor created */
|
|
889
|
+
201: Competitor;
|
|
890
|
+
};
|
|
891
|
+
type DeleteCompetitorErrors = {
|
|
892
|
+
/** Invalid request data */
|
|
893
|
+
400: ValidationError;
|
|
894
|
+
/** Authentication required */
|
|
895
|
+
401: UnauthorizedError;
|
|
896
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
897
|
+
402: PaymentRequiredError;
|
|
898
|
+
/**
|
|
899
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
900
|
+
* read-only (demo) mode.
|
|
901
|
+
*/
|
|
902
|
+
403: ForbiddenError;
|
|
903
|
+
/** Resource not found */
|
|
904
|
+
404: NotFoundError;
|
|
905
|
+
/** Resource already exists */
|
|
906
|
+
409: ConflictError;
|
|
907
|
+
/** Per-key rate limit exceeded. */
|
|
908
|
+
429: RateLimitError;
|
|
909
|
+
/** Internal server error */
|
|
910
|
+
500: InternalServerError;
|
|
911
|
+
};
|
|
912
|
+
type DeleteCompetitorResponses = {
|
|
913
|
+
/** Competitor deleted (returns the deleted competitor) */
|
|
914
|
+
200: Competitor;
|
|
915
|
+
};
|
|
916
|
+
type GetCompetitorErrors = {
|
|
917
|
+
/** Invalid request data */
|
|
918
|
+
400: ValidationError;
|
|
919
|
+
/** Authentication required */
|
|
920
|
+
401: UnauthorizedError;
|
|
921
|
+
/**
|
|
922
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
923
|
+
* read-only (demo) mode.
|
|
924
|
+
*/
|
|
925
|
+
403: ForbiddenError;
|
|
926
|
+
/** Resource not found */
|
|
927
|
+
404: NotFoundError;
|
|
928
|
+
/** Per-key rate limit exceeded. */
|
|
929
|
+
429: RateLimitError;
|
|
930
|
+
/** Internal server error */
|
|
931
|
+
500: InternalServerError;
|
|
932
|
+
};
|
|
933
|
+
type GetCompetitorResponses = {
|
|
934
|
+
/** Competitor */
|
|
935
|
+
200: Competitor;
|
|
936
|
+
};
|
|
937
|
+
type UpdateCompetitorErrors = {
|
|
938
|
+
/** Invalid request data */
|
|
939
|
+
400: ValidationError;
|
|
940
|
+
/** Authentication required */
|
|
941
|
+
401: UnauthorizedError;
|
|
942
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
943
|
+
402: PaymentRequiredError;
|
|
944
|
+
/**
|
|
945
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
946
|
+
* read-only (demo) mode.
|
|
947
|
+
*/
|
|
948
|
+
403: ForbiddenError;
|
|
949
|
+
/** Resource not found */
|
|
950
|
+
404: NotFoundError;
|
|
951
|
+
/** Resource already exists */
|
|
952
|
+
409: ConflictError;
|
|
953
|
+
/** Per-key rate limit exceeded. */
|
|
954
|
+
429: RateLimitError;
|
|
955
|
+
/** Internal server error */
|
|
956
|
+
500: InternalServerError;
|
|
957
|
+
};
|
|
958
|
+
type UpdateCompetitorResponses = {
|
|
959
|
+
/** Competitor updated */
|
|
960
|
+
200: Competitor;
|
|
961
|
+
};
|
|
962
|
+
type ListCompetitorsParams = {
|
|
963
|
+
brandId?: string;
|
|
964
|
+
/**
|
|
965
|
+
* Page number, 1-based.
|
|
966
|
+
*
|
|
967
|
+
* @default 1
|
|
968
|
+
* @minimum 1
|
|
969
|
+
*/
|
|
970
|
+
page?: Page;
|
|
971
|
+
/**
|
|
972
|
+
* Items per page. Values above the maximum are clamped, not rejected.
|
|
973
|
+
*
|
|
974
|
+
* @default 20
|
|
975
|
+
* @minimum 1
|
|
976
|
+
* @maximum 100
|
|
977
|
+
*/
|
|
978
|
+
limit?: Limit;
|
|
979
|
+
};
|
|
980
|
+
/** Add a competitor to a brand. */
|
|
981
|
+
type CreateCompetitorParams = {
|
|
982
|
+
/** @minLength 1 */
|
|
983
|
+
brandId: string;
|
|
984
|
+
/** @minLength 1 */
|
|
985
|
+
name: string;
|
|
986
|
+
domains?: Array<string>;
|
|
987
|
+
aliases?: Array<string>;
|
|
988
|
+
};
|
|
989
|
+
/**
|
|
990
|
+
* Update a competitor. At least one field must be provided. Provided arrays replace the stored
|
|
991
|
+
* values verbatim.
|
|
992
|
+
*/
|
|
993
|
+
type UpdateCompetitorParams = {
|
|
994
|
+
/** @minLength 1 */
|
|
995
|
+
name?: string;
|
|
996
|
+
domains?: Array<string>;
|
|
997
|
+
aliases?: Array<string>;
|
|
998
|
+
};
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/types/identity.d.ts
|
|
1001
|
+
type APIKeyIdentity = {
|
|
1002
|
+
/**
|
|
1003
|
+
* Brands the key is narrowed to, or null when it reaches every brand in its organization. Never
|
|
1004
|
+
* an empty array — a restriction to no brands is rejected at creation rather than treated as no
|
|
1005
|
+
* restriction.
|
|
1006
|
+
*/
|
|
1007
|
+
brandIds: Array<string> | null;
|
|
1008
|
+
createdAt: Date | null;
|
|
1009
|
+
/** The key's label, as given when it was issued. Null for admin keys. */
|
|
1010
|
+
createdBy: string | null;
|
|
1011
|
+
/** When the key stops working, if it has an expiry. */
|
|
1012
|
+
expiresAt: Date | null;
|
|
1013
|
+
/** `admin` for an instance key, `organization` for a dashboard-issued key. */
|
|
1014
|
+
keyType: 'admin' | 'organization';
|
|
1015
|
+
lastUsedAt: Date | null;
|
|
1016
|
+
/** The organization this key acts inside. Null for admin keys. */
|
|
1017
|
+
organizationId: string | null;
|
|
1018
|
+
organizationName: string | null;
|
|
1019
|
+
/**
|
|
1020
|
+
* The key's configured limit — generous by design: it exists to stop a runaway loop, not to meter
|
|
1021
|
+
* normal use. Enforcement is a fixed window and approximate under concurrency.
|
|
1022
|
+
*/
|
|
1023
|
+
rateLimit: {
|
|
1024
|
+
limit: number;
|
|
1025
|
+
window: 'minute' | 'hour';
|
|
1026
|
+
} | null;
|
|
1027
|
+
/** Scopes this key holds. A read-write key lists both; an admin key always does. */
|
|
1028
|
+
scopes: Array<'read' | 'write'>;
|
|
1029
|
+
};
|
|
1030
|
+
type GetMeErrors = {
|
|
1031
|
+
/** Authentication required */
|
|
1032
|
+
401: UnauthorizedError;
|
|
1033
|
+
/**
|
|
1034
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1035
|
+
* read-only (demo) mode.
|
|
1036
|
+
*/
|
|
1037
|
+
403: ForbiddenError;
|
|
1038
|
+
/** Per-key rate limit exceeded. */
|
|
1039
|
+
429: RateLimitError;
|
|
1040
|
+
/** Internal server error */
|
|
1041
|
+
500: InternalServerError;
|
|
1042
|
+
};
|
|
1043
|
+
type GetMeResponses = {
|
|
1044
|
+
/** Describe the calling key */
|
|
1045
|
+
200: APIKeyIdentity;
|
|
1046
|
+
};
|
|
1047
|
+
//#endregion
|
|
1048
|
+
//#region src/types/models.d.ts
|
|
1049
|
+
type ModelList = {
|
|
1050
|
+
data: Array<Model>;
|
|
1051
|
+
};
|
|
1052
|
+
type Model = {
|
|
1053
|
+
/** Whether this deployment is actually wired to reach it. */
|
|
1054
|
+
configured: boolean;
|
|
1055
|
+
/** Identifier used by the `model` filter, e.g. `chatgpt`. */
|
|
1056
|
+
id: string;
|
|
1057
|
+
/** Human-readable name. */
|
|
1058
|
+
label: string;
|
|
1059
|
+
/** Whether this model can be tracked grounded, spending a premium pairing. */
|
|
1060
|
+
premiumCapable: boolean;
|
|
1061
|
+
};
|
|
1062
|
+
type ListModelsErrors = {
|
|
1063
|
+
/** Authentication required */
|
|
1064
|
+
401: UnauthorizedError;
|
|
1065
|
+
/**
|
|
1066
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1067
|
+
* read-only (demo) mode.
|
|
1068
|
+
*/
|
|
1069
|
+
403: ForbiddenError;
|
|
1070
|
+
/** Per-key rate limit exceeded. */
|
|
1071
|
+
429: RateLimitError;
|
|
1072
|
+
/** Internal server error */
|
|
1073
|
+
500: InternalServerError;
|
|
1074
|
+
};
|
|
1075
|
+
type ListModelsResponses = {
|
|
1076
|
+
/** List trackable models */
|
|
1077
|
+
200: ModelList;
|
|
1078
|
+
};
|
|
1079
|
+
//#endregion
|
|
1080
|
+
//#region src/types/organizations.d.ts
|
|
1081
|
+
type Organization = {
|
|
1082
|
+
brandCount: number;
|
|
1083
|
+
createdAt: Date;
|
|
1084
|
+
id: string;
|
|
1085
|
+
name: string;
|
|
1086
|
+
slug: string;
|
|
1087
|
+
};
|
|
1088
|
+
/** The organization's plan limits. Every field is null on deployments without billing. */
|
|
1089
|
+
type PlanLimits = {
|
|
1090
|
+
/** Null means no limit. */
|
|
1091
|
+
maxBrands: number | null;
|
|
1092
|
+
/** Enabled prompts across the whole organization. Null means no limit. */
|
|
1093
|
+
maxPrompts: number | null;
|
|
1094
|
+
/** Models the plan may pick from. Null means any. */
|
|
1095
|
+
modelMenu: Array<string> | null;
|
|
1096
|
+
/** Models trackable per brand. */
|
|
1097
|
+
modelPicks: number | null;
|
|
1098
|
+
/** Prompt/model pairings trackable grounded. */
|
|
1099
|
+
premiumPool: number;
|
|
1100
|
+
premiumRunsPerDay: number;
|
|
1101
|
+
standardRunsPerDay: number | null;
|
|
1102
|
+
};
|
|
1103
|
+
/**
|
|
1104
|
+
* Read-only view of an organization's subscription, limits, and usage. The API has no way to change
|
|
1105
|
+
* any of it: there is no billing write endpoint and no billing write scope. Stripe identifiers,
|
|
1106
|
+
* payment methods, and invoices are deliberately not exposed — those live in the Stripe customer
|
|
1107
|
+
* portal.
|
|
1108
|
+
*/
|
|
1109
|
+
type OrganizationBilling = {
|
|
1110
|
+
/** False on self-hosted deployments, where nothing is metered. */
|
|
1111
|
+
billingEnabled: boolean;
|
|
1112
|
+
limits: PlanLimits | null;
|
|
1113
|
+
organizationId: string;
|
|
1114
|
+
/** Null when the organization has no subscription, or when billing is disabled. */
|
|
1115
|
+
plan: BillingPlan | null;
|
|
1116
|
+
usage: {
|
|
1117
|
+
brands: number;
|
|
1118
|
+
enabledPrompts: number;
|
|
1119
|
+
premiumPairingsAssigned: number;
|
|
1120
|
+
};
|
|
1121
|
+
};
|
|
1122
|
+
type BillingPlan = {
|
|
1123
|
+
cancelAtPeriodEnd: boolean;
|
|
1124
|
+
/** Null on a negotiated plan, which carries no billing interval. */
|
|
1125
|
+
interval?: 'monthly' | 'annual' | null;
|
|
1126
|
+
/** Plan identifier, or `custom` for a negotiated plan. */
|
|
1127
|
+
key: string | null;
|
|
1128
|
+
/** Display name. */
|
|
1129
|
+
name: string;
|
|
1130
|
+
periodEnd?: Date | null;
|
|
1131
|
+
/**
|
|
1132
|
+
* What the subscription means for service, and the only field a caller needs to act on: `active`
|
|
1133
|
+
* and `grace` keep tracking running, `paused` stops it, `none` is unsubscribed. The payment
|
|
1134
|
+
* provider's own status string is deliberately not passed through.
|
|
1135
|
+
*/
|
|
1136
|
+
standing: 'active' | 'grace' | 'paused' | 'none';
|
|
1137
|
+
/** Whether prompts are currently being sampled. */
|
|
1138
|
+
trackingActive: boolean;
|
|
1139
|
+
};
|
|
1140
|
+
type OrganizationList = {
|
|
1141
|
+
data: Array<Organization>;
|
|
1142
|
+
pagination: Pagination;
|
|
1143
|
+
};
|
|
1144
|
+
type ListOrganizationsErrors = {
|
|
1145
|
+
/** Authentication required */
|
|
1146
|
+
401: UnauthorizedError;
|
|
1147
|
+
/**
|
|
1148
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1149
|
+
* read-only (demo) mode.
|
|
1150
|
+
*/
|
|
1151
|
+
403: ForbiddenError;
|
|
1152
|
+
/** Per-key rate limit exceeded. */
|
|
1153
|
+
429: RateLimitError;
|
|
1154
|
+
/** Internal server error */
|
|
1155
|
+
500: InternalServerError;
|
|
1156
|
+
};
|
|
1157
|
+
type ListOrganizationsResponses = {
|
|
1158
|
+
/** List organizations */
|
|
1159
|
+
200: OrganizationList;
|
|
1160
|
+
};
|
|
1161
|
+
type GetOrganizationErrors = {
|
|
1162
|
+
/** Authentication required */
|
|
1163
|
+
401: UnauthorizedError;
|
|
1164
|
+
/**
|
|
1165
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1166
|
+
* read-only (demo) mode.
|
|
1167
|
+
*/
|
|
1168
|
+
403: ForbiddenError;
|
|
1169
|
+
/** Resource not found */
|
|
1170
|
+
404: NotFoundError;
|
|
1171
|
+
/** Per-key rate limit exceeded. */
|
|
1172
|
+
429: RateLimitError;
|
|
1173
|
+
/** Internal server error */
|
|
1174
|
+
500: InternalServerError;
|
|
1175
|
+
};
|
|
1176
|
+
type GetOrganizationResponses = {
|
|
1177
|
+
/** Get an organization */
|
|
1178
|
+
200: Organization;
|
|
1179
|
+
};
|
|
1180
|
+
type GetOrganizationBillingErrors = {
|
|
1181
|
+
/** Authentication required */
|
|
1182
|
+
401: UnauthorizedError;
|
|
1183
|
+
/**
|
|
1184
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1185
|
+
* read-only (demo) mode.
|
|
1186
|
+
*/
|
|
1187
|
+
403: ForbiddenError;
|
|
1188
|
+
/** Resource not found */
|
|
1189
|
+
404: NotFoundError;
|
|
1190
|
+
/** Per-key rate limit exceeded. */
|
|
1191
|
+
429: RateLimitError;
|
|
1192
|
+
/** Internal server error */
|
|
1193
|
+
500: InternalServerError;
|
|
1194
|
+
};
|
|
1195
|
+
type GetOrganizationBillingResponses = {
|
|
1196
|
+
/** Get billing state */
|
|
1197
|
+
200: OrganizationBilling;
|
|
1198
|
+
};
|
|
1199
|
+
type ListOrganizationsParams = {
|
|
1200
|
+
/**
|
|
1201
|
+
* Page number, 1-based.
|
|
1202
|
+
*
|
|
1203
|
+
* @default 1
|
|
1204
|
+
* @minimum 1
|
|
1205
|
+
*/
|
|
1206
|
+
page?: Page;
|
|
1207
|
+
/**
|
|
1208
|
+
* Items per page. Values above the maximum are clamped, not rejected.
|
|
1209
|
+
*
|
|
1210
|
+
* @default 20
|
|
1211
|
+
* @minimum 1
|
|
1212
|
+
* @maximum 100
|
|
1213
|
+
*/
|
|
1214
|
+
limit?: Limit;
|
|
1215
|
+
};
|
|
1216
|
+
//#endregion
|
|
1217
|
+
//#region src/types/runs.d.ts
|
|
1218
|
+
/** A single model answer, without its text. Fetch `prompts.runs.get()` for the answer itself. */
|
|
1219
|
+
type RunSummary = {
|
|
1220
|
+
brandId: string;
|
|
1221
|
+
brandMentioned: boolean;
|
|
1222
|
+
citationCount: number;
|
|
1223
|
+
competitorsMentioned: Array<string>;
|
|
1224
|
+
createdAt: Date;
|
|
1225
|
+
id: string;
|
|
1226
|
+
model: string;
|
|
1227
|
+
promptId: string;
|
|
1228
|
+
/** How the answer was obtained. Informational; not a stable enum. */
|
|
1229
|
+
provider: string | null;
|
|
1230
|
+
/** Searches the engine ran, where it exposes them. */
|
|
1231
|
+
webQueries: Array<string>;
|
|
1232
|
+
/** Whether the engine answered with its own web search on. */
|
|
1233
|
+
webSearchEnabled: boolean;
|
|
1234
|
+
};
|
|
1235
|
+
type RunCitation = {
|
|
1236
|
+
/** Position within the answer's citation list. */
|
|
1237
|
+
citationIndex: number;
|
|
1238
|
+
domain: string;
|
|
1239
|
+
title: string | null;
|
|
1240
|
+
url: string;
|
|
1241
|
+
};
|
|
1242
|
+
/** One model answer with its normalized text and citations. */
|
|
1243
|
+
type Run = RunSummary & {
|
|
1244
|
+
answer: {
|
|
1245
|
+
/**
|
|
1246
|
+
* The answer, normalized out of the provider's response. Null when nothing could be extracted.
|
|
1247
|
+
*/
|
|
1248
|
+
text: string | null;
|
|
1249
|
+
};
|
|
1250
|
+
citations: Array<RunCitation>;
|
|
1251
|
+
};
|
|
1252
|
+
type RunList = {
|
|
1253
|
+
data: Array<RunSummary>;
|
|
1254
|
+
pagination: Pagination;
|
|
1255
|
+
};
|
|
1256
|
+
type ListPromptRunsErrors = {
|
|
1257
|
+
/** Invalid request data */
|
|
1258
|
+
400: ValidationError;
|
|
1259
|
+
/** Authentication required */
|
|
1260
|
+
401: UnauthorizedError;
|
|
1261
|
+
/**
|
|
1262
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1263
|
+
* read-only (demo) mode.
|
|
1264
|
+
*/
|
|
1265
|
+
403: ForbiddenError;
|
|
1266
|
+
/** Resource not found */
|
|
1267
|
+
404: NotFoundError;
|
|
1268
|
+
/** Per-key rate limit exceeded. */
|
|
1269
|
+
429: RateLimitError;
|
|
1270
|
+
/** Internal server error */
|
|
1271
|
+
500: InternalServerError;
|
|
1272
|
+
};
|
|
1273
|
+
type ListPromptRunsResponses = {
|
|
1274
|
+
/** List runs for a prompt */
|
|
1275
|
+
200: RunList;
|
|
1276
|
+
};
|
|
1277
|
+
type GetRunErrors = {
|
|
1278
|
+
/** Invalid request data */
|
|
1279
|
+
400: ValidationError;
|
|
1280
|
+
/** Authentication required */
|
|
1281
|
+
401: UnauthorizedError;
|
|
1282
|
+
/**
|
|
1283
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1284
|
+
* read-only (demo) mode.
|
|
1285
|
+
*/
|
|
1286
|
+
403: ForbiddenError;
|
|
1287
|
+
/** Resource not found */
|
|
1288
|
+
404: NotFoundError;
|
|
1289
|
+
/** Per-key rate limit exceeded. */
|
|
1290
|
+
429: RateLimitError;
|
|
1291
|
+
/** Internal server error */
|
|
1292
|
+
500: InternalServerError;
|
|
1293
|
+
};
|
|
1294
|
+
type GetRunResponses = {
|
|
1295
|
+
/** Get a run */
|
|
1296
|
+
200: Run;
|
|
1297
|
+
};
|
|
1298
|
+
type ListPromptRunsParams = {
|
|
1299
|
+
/**
|
|
1300
|
+
* Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A
|
|
1301
|
+
* bare `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a
|
|
1302
|
+
* local calendar day there.
|
|
1303
|
+
*/
|
|
1304
|
+
start: WindowStart;
|
|
1305
|
+
/**
|
|
1306
|
+
* Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
|
|
1307
|
+
* exactly `end` is outside it.
|
|
1308
|
+
*/
|
|
1309
|
+
end: WindowEnd;
|
|
1310
|
+
/** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
|
|
1311
|
+
model?: ModelFilter;
|
|
1312
|
+
/**
|
|
1313
|
+
* Page number, 1-based.
|
|
1314
|
+
*
|
|
1315
|
+
* @default 1
|
|
1316
|
+
* @minimum 1
|
|
1317
|
+
*/
|
|
1318
|
+
page?: Page;
|
|
1319
|
+
/**
|
|
1320
|
+
* Items per page. Values above the maximum are clamped, not rejected.
|
|
1321
|
+
*
|
|
1322
|
+
* @default 20
|
|
1323
|
+
* @minimum 1
|
|
1324
|
+
* @maximum 100
|
|
1325
|
+
*/
|
|
1326
|
+
limit?: Limit;
|
|
1327
|
+
};
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region src/types/shared/mention-entry.d.ts
|
|
1330
|
+
/** Aggregated mention counts for a prompt across its evaluation runs. */
|
|
1331
|
+
type MentionsSummary = {
|
|
1332
|
+
/** Number of runs where the brand was mentioned */
|
|
1333
|
+
brandMentionsTotal: number;
|
|
1334
|
+
/**
|
|
1335
|
+
* Total count of individual competitor mentions across all runs (a single run mentioning 3
|
|
1336
|
+
* competitors counts as 3)
|
|
1337
|
+
*/
|
|
1338
|
+
competitorMentionsTotal: number;
|
|
1339
|
+
/** Top-K competitor entities ranked by mention count */
|
|
1340
|
+
mentionsTopK: Array<MentionEntry>;
|
|
1341
|
+
/** Total brand + competitor mentions across all runs */
|
|
1342
|
+
mentionsTotal: number;
|
|
1343
|
+
};
|
|
1344
|
+
type MentionEntry = {
|
|
1345
|
+
/** Number of runs where this entity was mentioned */
|
|
1346
|
+
count: number;
|
|
1347
|
+
/** Competitor entity name */
|
|
1348
|
+
entity: string;
|
|
1349
|
+
};
|
|
1350
|
+
//#endregion
|
|
1351
|
+
//#region src/types/snapshots.d.ts
|
|
1352
|
+
type CitedURLEntry = {
|
|
1353
|
+
/** Number of times this URL was cited */
|
|
1354
|
+
count: number;
|
|
1355
|
+
/** Page title if available */
|
|
1356
|
+
title: string | null;
|
|
1357
|
+
/** The cited URL */
|
|
1358
|
+
url: string;
|
|
1359
|
+
};
|
|
1360
|
+
type PromptSnapshot = {
|
|
1361
|
+
/** Brand identifier this prompt belongs to */
|
|
1362
|
+
brandId: string;
|
|
1363
|
+
citations: {
|
|
1364
|
+
/** Number of citations to brand-owned domains */
|
|
1365
|
+
brandCitationsTotal: number;
|
|
1366
|
+
/** Total number of citations across all runs */
|
|
1367
|
+
citationsTotal: number;
|
|
1368
|
+
/** Top-K cited URLs ranked by frequency */
|
|
1369
|
+
citedUrlsTopK: Array<CitedURLEntry>;
|
|
1370
|
+
/** Number of citations to competitor-owned domains */
|
|
1371
|
+
competitorCitationsTotal: number;
|
|
1372
|
+
};
|
|
1373
|
+
/** End of the queried date range (YYYY-MM-DD) */
|
|
1374
|
+
endDate: string;
|
|
1375
|
+
mentions: MentionsSummary;
|
|
1376
|
+
/** Unique identifier for the prompt */
|
|
1377
|
+
promptId: string;
|
|
1378
|
+
/** The prompt text */
|
|
1379
|
+
promptValue: string;
|
|
1380
|
+
/** Start of the queried date range (YYYY-MM-DD) */
|
|
1381
|
+
startDate: string;
|
|
1382
|
+
};
|
|
1383
|
+
type GetPromptSnapshotErrors = {
|
|
1384
|
+
/** Invalid request data */
|
|
1385
|
+
400: ValidationError;
|
|
1386
|
+
/** Authentication required */
|
|
1387
|
+
401: UnauthorizedError;
|
|
1388
|
+
/**
|
|
1389
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1390
|
+
* read-only (demo) mode.
|
|
1391
|
+
*/
|
|
1392
|
+
403: ForbiddenError;
|
|
1393
|
+
/** Resource not found */
|
|
1394
|
+
404: NotFoundError;
|
|
1395
|
+
/** Per-key rate limit exceeded. */
|
|
1396
|
+
429: RateLimitError;
|
|
1397
|
+
/** Internal server error */
|
|
1398
|
+
500: InternalServerError;
|
|
1399
|
+
};
|
|
1400
|
+
type GetPromptSnapshotResponses = {
|
|
1401
|
+
/** Prompt snapshot with mention and citation analytics */
|
|
1402
|
+
200: PromptSnapshot;
|
|
1403
|
+
};
|
|
1404
|
+
type GetPromptSnapshotParams = {
|
|
1405
|
+
/** Start of date range (YYYY-MM-DD) */
|
|
1406
|
+
startDate: string;
|
|
1407
|
+
/** End of date range (YYYY-MM-DD) */
|
|
1408
|
+
endDate: string;
|
|
1409
|
+
/**
|
|
1410
|
+
* Number of top competitor entities to return in mentionsTopK
|
|
1411
|
+
*
|
|
1412
|
+
* @default 5
|
|
1413
|
+
* @minimum 1
|
|
1414
|
+
* @maximum 50
|
|
1415
|
+
*/
|
|
1416
|
+
kMentions?: number;
|
|
1417
|
+
/**
|
|
1418
|
+
* Number of top cited URLs to return in citedUrlsTopK
|
|
1419
|
+
*
|
|
1420
|
+
* @default 10
|
|
1421
|
+
* @minimum 1
|
|
1422
|
+
* @maximum 50
|
|
1423
|
+
*/
|
|
1424
|
+
kCitations?: number;
|
|
1425
|
+
};
|
|
1426
|
+
//#endregion
|
|
1427
|
+
//#region src/types/prompts.d.ts
|
|
1428
|
+
type Prompt = {
|
|
1429
|
+
/** Brand identifier this prompt belongs to */
|
|
1430
|
+
brandId: string;
|
|
1431
|
+
/** Timestamp when the prompt was created */
|
|
1432
|
+
createdAt: Date;
|
|
1433
|
+
/** Whether the prompt is currently enabled */
|
|
1434
|
+
enabled: boolean;
|
|
1435
|
+
/** Unique identifier for the prompt */
|
|
1436
|
+
id: string;
|
|
1437
|
+
/** Models this prompt is tracked on grounded. Each entry spends one premium pairing. */
|
|
1438
|
+
premiumModels: Array<string>;
|
|
1439
|
+
/** Auto-computed system tags (e.g., 'branded', 'unbranded'). Read-only. */
|
|
1440
|
+
systemTags: Array<string>;
|
|
1441
|
+
/** User-defined tags for categorizing this prompt */
|
|
1442
|
+
tags: Array<string>;
|
|
1443
|
+
/** Timestamp when the prompt was last updated */
|
|
1444
|
+
updatedAt: Date;
|
|
1445
|
+
/** The actual prompt text */
|
|
1446
|
+
value: string;
|
|
1447
|
+
};
|
|
1448
|
+
type ListPromptsErrors = {
|
|
1449
|
+
/** Authentication required */
|
|
1450
|
+
401: UnauthorizedError;
|
|
1451
|
+
/**
|
|
1452
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1453
|
+
* read-only (demo) mode.
|
|
1454
|
+
*/
|
|
1455
|
+
403: ForbiddenError;
|
|
1456
|
+
/** Per-key rate limit exceeded. */
|
|
1457
|
+
429: RateLimitError;
|
|
1458
|
+
/** Internal server error */
|
|
1459
|
+
500: InternalServerError;
|
|
1460
|
+
};
|
|
1461
|
+
type ListPromptsResponses = {
|
|
1462
|
+
/** List of prompts */
|
|
1463
|
+
200: {
|
|
1464
|
+
/** The items on this page. Read this rather than the named key below. */
|
|
1465
|
+
data: Array<Prompt>;
|
|
1466
|
+
pagination: {
|
|
1467
|
+
limit: number;
|
|
1468
|
+
page: number;
|
|
1469
|
+
total: number;
|
|
1470
|
+
totalPages: number;
|
|
1471
|
+
};
|
|
1472
|
+
/**
|
|
1473
|
+
* Deprecated: read `data` instead. Kept while the one known consumer migrates, and removed in a
|
|
1474
|
+
* future release.
|
|
1475
|
+
*
|
|
1476
|
+
* @deprecated
|
|
1477
|
+
*/
|
|
1478
|
+
prompts: Array<Prompt>;
|
|
1479
|
+
};
|
|
1480
|
+
};
|
|
1481
|
+
type ListPromptsResponse = ListPromptsResponses[keyof ListPromptsResponses];
|
|
1482
|
+
type CreatePromptErrors = {
|
|
1483
|
+
/** Invalid request data */
|
|
1484
|
+
400: ValidationError;
|
|
1485
|
+
/** Authentication required */
|
|
1486
|
+
401: UnauthorizedError;
|
|
1487
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
1488
|
+
402: PaymentRequiredError;
|
|
1489
|
+
/**
|
|
1490
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1491
|
+
* read-only (demo) mode.
|
|
1492
|
+
*/
|
|
1493
|
+
403: ForbiddenError;
|
|
1494
|
+
/** Resource already exists */
|
|
1495
|
+
409: ConflictError;
|
|
1496
|
+
/** Per-key rate limit exceeded. */
|
|
1497
|
+
429: RateLimitError;
|
|
1498
|
+
/** Internal server error */
|
|
1499
|
+
500: InternalServerError;
|
|
1500
|
+
};
|
|
1501
|
+
type CreatePromptResponses = {
|
|
1502
|
+
/** Prompt created successfully */
|
|
1503
|
+
201: Prompt;
|
|
1504
|
+
};
|
|
1505
|
+
type DeletePromptErrors = {
|
|
1506
|
+
/** Invalid request data */
|
|
1507
|
+
400: ValidationError;
|
|
1508
|
+
/** Authentication required */
|
|
1509
|
+
401: UnauthorizedError;
|
|
1510
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
1511
|
+
402: PaymentRequiredError;
|
|
1512
|
+
/**
|
|
1513
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1514
|
+
* read-only (demo) mode.
|
|
1515
|
+
*/
|
|
1516
|
+
403: ForbiddenError;
|
|
1517
|
+
/** Resource not found */
|
|
1518
|
+
404: NotFoundError;
|
|
1519
|
+
/** Resource already exists */
|
|
1520
|
+
409: ConflictError;
|
|
1521
|
+
/** Per-key rate limit exceeded. */
|
|
1522
|
+
429: RateLimitError;
|
|
1523
|
+
/** Internal server error */
|
|
1524
|
+
500: InternalServerError;
|
|
1525
|
+
};
|
|
1526
|
+
type DeletePromptResponses = {
|
|
1527
|
+
/** Prompt deleted (returns the deleted prompt) */
|
|
1528
|
+
200: Prompt & {
|
|
1529
|
+
/** Number of related prompt_runs rows deleted by the cascade. */
|
|
1530
|
+
deletedRunsCount: number;
|
|
1531
|
+
};
|
|
1532
|
+
};
|
|
1533
|
+
type DeletePromptResponse = DeletePromptResponses[keyof DeletePromptResponses];
|
|
1534
|
+
type GetPromptErrors = {
|
|
1535
|
+
/** Invalid request data */
|
|
1536
|
+
400: ValidationError;
|
|
1537
|
+
/** Authentication required */
|
|
1538
|
+
401: UnauthorizedError;
|
|
1539
|
+
/**
|
|
1540
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1541
|
+
* read-only (demo) mode.
|
|
1542
|
+
*/
|
|
1543
|
+
403: ForbiddenError;
|
|
1544
|
+
/** Resource not found */
|
|
1545
|
+
404: NotFoundError;
|
|
1546
|
+
/** Per-key rate limit exceeded. */
|
|
1547
|
+
429: RateLimitError;
|
|
1548
|
+
/** Internal server error */
|
|
1549
|
+
500: InternalServerError;
|
|
1550
|
+
};
|
|
1551
|
+
type GetPromptResponses = {
|
|
1552
|
+
/** Prompt details */
|
|
1553
|
+
200: Prompt;
|
|
1554
|
+
};
|
|
1555
|
+
type UpdatePromptErrors = {
|
|
1556
|
+
/** Invalid request data */
|
|
1557
|
+
400: ValidationError;
|
|
1558
|
+
/** Authentication required */
|
|
1559
|
+
401: UnauthorizedError;
|
|
1560
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
1561
|
+
402: PaymentRequiredError;
|
|
1562
|
+
/**
|
|
1563
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1564
|
+
* read-only (demo) mode.
|
|
1565
|
+
*/
|
|
1566
|
+
403: ForbiddenError;
|
|
1567
|
+
/** Resource not found */
|
|
1568
|
+
404: NotFoundError;
|
|
1569
|
+
/** Resource already exists */
|
|
1570
|
+
409: ConflictError;
|
|
1571
|
+
/** Per-key rate limit exceeded. */
|
|
1572
|
+
429: RateLimitError;
|
|
1573
|
+
/** Internal server error */
|
|
1574
|
+
500: InternalServerError;
|
|
1575
|
+
};
|
|
1576
|
+
type UpdatePromptResponses = {
|
|
1577
|
+
/** Prompt updated successfully */
|
|
1578
|
+
200: Prompt;
|
|
1579
|
+
};
|
|
1580
|
+
type ListPromptsParams = {
|
|
1581
|
+
/** Filter prompts by brand ID */
|
|
1582
|
+
brandId?: string;
|
|
1583
|
+
/**
|
|
1584
|
+
* Page number, 1-based.
|
|
1585
|
+
*
|
|
1586
|
+
* @default 1
|
|
1587
|
+
* @minimum 1
|
|
1588
|
+
*/
|
|
1589
|
+
page?: Page;
|
|
1590
|
+
/**
|
|
1591
|
+
* Items per page. Values above the maximum are clamped, not rejected. This list had no ceiling
|
|
1592
|
+
* before, so the maximum is set to bound a runaway query rather than to change what an existing
|
|
1593
|
+
* caller gets back.
|
|
1594
|
+
*
|
|
1595
|
+
* @default 20
|
|
1596
|
+
* @minimum 1
|
|
1597
|
+
* @maximum 1000
|
|
1598
|
+
*/
|
|
1599
|
+
limit?: number;
|
|
1600
|
+
/** Only prompts with this tracking state. */
|
|
1601
|
+
enabled?: boolean;
|
|
1602
|
+
/** Comma-separated tags. A prompt matches if it carries any of them. */
|
|
1603
|
+
tags?: string;
|
|
1604
|
+
/** Case-insensitive substring match on prompt text. */
|
|
1605
|
+
q?: string;
|
|
1606
|
+
};
|
|
1607
|
+
type CreatePromptParams = {
|
|
1608
|
+
/** Brand identifier this prompt belongs to */
|
|
1609
|
+
brandId: string;
|
|
1610
|
+
/**
|
|
1611
|
+
* The prompt text
|
|
1612
|
+
*
|
|
1613
|
+
* @minLength 1
|
|
1614
|
+
*/
|
|
1615
|
+
value: string;
|
|
1616
|
+
/** User-defined tags for categorizing this prompt */
|
|
1617
|
+
tags?: Array<string>;
|
|
1618
|
+
};
|
|
1619
|
+
type UpdatePromptParams = {
|
|
1620
|
+
/**
|
|
1621
|
+
* The prompt text
|
|
1622
|
+
*
|
|
1623
|
+
* @minLength 1
|
|
1624
|
+
*/
|
|
1625
|
+
value?: string;
|
|
1626
|
+
/** Whether the prompt is enabled */
|
|
1627
|
+
enabled?: boolean;
|
|
1628
|
+
/** User-defined tags for categorizing this prompt */
|
|
1629
|
+
tags?: Array<string>;
|
|
1630
|
+
/** Replaces the prompt's grounded models. Checked against the organization's premium pool. */
|
|
1631
|
+
premiumModels?: Array<string>;
|
|
1632
|
+
};
|
|
1633
|
+
//#endregion
|
|
1634
|
+
//#region src/types/reports.d.ts
|
|
1635
|
+
type ReportSummary = {
|
|
1636
|
+
/** Other names counted as brand mentions */
|
|
1637
|
+
brandAliases: Array<string>;
|
|
1638
|
+
/** Brand name analyzed */
|
|
1639
|
+
brandName: string;
|
|
1640
|
+
/** Brand website URL */
|
|
1641
|
+
brandWebsite: string;
|
|
1642
|
+
/** Timestamp when the report completed */
|
|
1643
|
+
completedAt: Date | null;
|
|
1644
|
+
/** Timestamp when the report was created */
|
|
1645
|
+
createdAt: Date;
|
|
1646
|
+
/** Unique identifier for the report */
|
|
1647
|
+
id: string;
|
|
1648
|
+
/** Current report status */
|
|
1649
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
1650
|
+
};
|
|
1651
|
+
/**
|
|
1652
|
+
* Per-prompt snapshot of raw mention data from a report. Consumers compute SoV and other derived
|
|
1653
|
+
* metrics.
|
|
1654
|
+
*/
|
|
1655
|
+
type ReportPromptSnapshot = {
|
|
1656
|
+
mentions: MentionsSummary;
|
|
1657
|
+
/** The prompt text that was evaluated */
|
|
1658
|
+
promptValue: string;
|
|
1659
|
+
/** Number of evaluation runs for this prompt */
|
|
1660
|
+
totalRuns: number;
|
|
1661
|
+
};
|
|
1662
|
+
type ListReportsErrors = {
|
|
1663
|
+
/** Authentication required */
|
|
1664
|
+
401: UnauthorizedError;
|
|
1665
|
+
/**
|
|
1666
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1667
|
+
* read-only (demo) mode.
|
|
1668
|
+
*/
|
|
1669
|
+
403: ForbiddenError;
|
|
1670
|
+
/** Per-key rate limit exceeded. */
|
|
1671
|
+
429: RateLimitError;
|
|
1672
|
+
/** Internal server error */
|
|
1673
|
+
500: InternalServerError;
|
|
1674
|
+
};
|
|
1675
|
+
type ListReportsResponses = {
|
|
1676
|
+
/** Paginated list of reports */
|
|
1677
|
+
200: {
|
|
1678
|
+
/** The items on this page. Read this rather than the named key below. */
|
|
1679
|
+
data: Array<ReportSummary>;
|
|
1680
|
+
pagination: {
|
|
1681
|
+
limit: number;
|
|
1682
|
+
page: number;
|
|
1683
|
+
total: number;
|
|
1684
|
+
totalPages: number;
|
|
1685
|
+
};
|
|
1686
|
+
/**
|
|
1687
|
+
* Deprecated: read `data` instead. Kept while the one known consumer migrates, and removed in a
|
|
1688
|
+
* future release.
|
|
1689
|
+
*
|
|
1690
|
+
* @deprecated
|
|
1691
|
+
*/
|
|
1692
|
+
reports: Array<ReportSummary>;
|
|
1693
|
+
};
|
|
1694
|
+
};
|
|
1695
|
+
type ListReportsResponse = ListReportsResponses[keyof ListReportsResponses];
|
|
1696
|
+
type CreateReportErrors = {
|
|
1697
|
+
/** Invalid request data */
|
|
1698
|
+
400: ValidationError;
|
|
1699
|
+
/** Authentication required */
|
|
1700
|
+
401: UnauthorizedError;
|
|
1701
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
1702
|
+
402: PaymentRequiredError;
|
|
1703
|
+
/**
|
|
1704
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1705
|
+
* read-only (demo) mode.
|
|
1706
|
+
*/
|
|
1707
|
+
403: ForbiddenError;
|
|
1708
|
+
/** Resource already exists */
|
|
1709
|
+
409: ConflictError;
|
|
1710
|
+
/** Per-key rate limit exceeded. */
|
|
1711
|
+
429: RateLimitError;
|
|
1712
|
+
/** Internal server error */
|
|
1713
|
+
500: InternalServerError;
|
|
1714
|
+
};
|
|
1715
|
+
type CreateReportResponses = {
|
|
1716
|
+
/** Report created and queued for generation */
|
|
1717
|
+
201: {
|
|
1718
|
+
brandAliases: Array<string>;
|
|
1719
|
+
brandName: string;
|
|
1720
|
+
brandWebsite: string;
|
|
1721
|
+
createdAt: Date;
|
|
1722
|
+
/** Unique identifier for the created report */
|
|
1723
|
+
reportId: string;
|
|
1724
|
+
/** Initial report status */
|
|
1725
|
+
status: 'pending';
|
|
1726
|
+
};
|
|
1727
|
+
};
|
|
1728
|
+
type CreateReportResponse = CreateReportResponses[keyof CreateReportResponses];
|
|
1729
|
+
type GetReportErrors = {
|
|
1730
|
+
/** Invalid request data */
|
|
1731
|
+
400: ValidationError;
|
|
1732
|
+
/** Authentication required */
|
|
1733
|
+
401: UnauthorizedError;
|
|
1734
|
+
/**
|
|
1735
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1736
|
+
* read-only (demo) mode.
|
|
1737
|
+
*/
|
|
1738
|
+
403: ForbiddenError;
|
|
1739
|
+
/** Resource not found */
|
|
1740
|
+
404: NotFoundError;
|
|
1741
|
+
/** Per-key rate limit exceeded. */
|
|
1742
|
+
429: RateLimitError;
|
|
1743
|
+
/** Internal server error */
|
|
1744
|
+
500: InternalServerError;
|
|
1745
|
+
};
|
|
1746
|
+
type GetReportResponses = {
|
|
1747
|
+
/**
|
|
1748
|
+
* Report status and data. When status is 'completed', includes per-prompt snapshot data with raw
|
|
1749
|
+
* mention counts.
|
|
1750
|
+
*/
|
|
1751
|
+
200: {
|
|
1752
|
+
brandAliases: Array<string>;
|
|
1753
|
+
brandName: string;
|
|
1754
|
+
brandWebsite: string;
|
|
1755
|
+
completedAt: Date | null;
|
|
1756
|
+
createdAt: Date;
|
|
1757
|
+
/** Generation progress percentage (0-100). Available while processing. */
|
|
1758
|
+
progress?: number;
|
|
1759
|
+
/** Per-prompt snapshot data. Only present when status is 'completed'. */
|
|
1760
|
+
prompts?: Array<ReportPromptSnapshot>;
|
|
1761
|
+
reportId: string;
|
|
1762
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
1763
|
+
/**
|
|
1764
|
+
* Derived stats (SoV, visibility, etc.). Format may change between versions. Only present when
|
|
1765
|
+
* status is 'completed'.
|
|
1766
|
+
*/
|
|
1767
|
+
unstable?: {
|
|
1768
|
+
/** Per-competitor SoV breakdown, sorted by SoV descending */
|
|
1769
|
+
competitors?: Array<{
|
|
1770
|
+
/** Competitor name */
|
|
1771
|
+
name: string;
|
|
1772
|
+
/** Number of individual prompt runs where this competitor was mentioned */
|
|
1773
|
+
promptRunsWithMentions: number;
|
|
1774
|
+
/** Number of prompts where this competitor was mentioned in at least one run */
|
|
1775
|
+
promptsWithMentions: number;
|
|
1776
|
+
/**
|
|
1777
|
+
* Share of voice (0-1): this competitor's mentions / total mentions (brand + all
|
|
1778
|
+
* competitors)
|
|
1779
|
+
*
|
|
1780
|
+
* @minimum 0
|
|
1781
|
+
* @maximum 1
|
|
1782
|
+
*/
|
|
1783
|
+
sov: number;
|
|
1784
|
+
/**
|
|
1785
|
+
* Visibility (0-1): prompt runs mentioning this competitor / total prompt runs
|
|
1786
|
+
*
|
|
1787
|
+
* @minimum 0
|
|
1788
|
+
* @maximum 1
|
|
1789
|
+
*/
|
|
1790
|
+
visibility: number;
|
|
1791
|
+
}>;
|
|
1792
|
+
/** Number of individual prompt runs where the brand was mentioned */
|
|
1793
|
+
promptRunsWithBrandMentions?: number;
|
|
1794
|
+
/** Number of prompts where the brand was mentioned in at least one prompt run */
|
|
1795
|
+
promptsWithBrandMentions?: number;
|
|
1796
|
+
/**
|
|
1797
|
+
* Overall share of voice (0-1): brand_mentions / (brand_mentions + competitor_mentions). Null
|
|
1798
|
+
* when no mentions at all.
|
|
1799
|
+
*
|
|
1800
|
+
* @minimum 0
|
|
1801
|
+
* @maximum 1
|
|
1802
|
+
*/
|
|
1803
|
+
sov?: number | null;
|
|
1804
|
+
/**
|
|
1805
|
+
* Total number of prompt runs across all prompts (each prompt is executed multiple times
|
|
1806
|
+
* across different AI engines)
|
|
1807
|
+
*/
|
|
1808
|
+
totalPromptRuns?: number;
|
|
1809
|
+
/** Total number of prompts evaluated */
|
|
1810
|
+
totalPrompts?: number;
|
|
1811
|
+
/**
|
|
1812
|
+
* Brand visibility (0-1): brand_mentions / total_prompt_runs (how often the brand appears at
|
|
1813
|
+
* all across all prompt runs)
|
|
1814
|
+
*
|
|
1815
|
+
* @minimum 0
|
|
1816
|
+
* @maximum 1
|
|
1817
|
+
*/
|
|
1818
|
+
visibility?: number;
|
|
1819
|
+
};
|
|
1820
|
+
};
|
|
1821
|
+
};
|
|
1822
|
+
type GetReportResponse = GetReportResponses[keyof GetReportResponses];
|
|
1823
|
+
type ListReportsParams = {
|
|
1824
|
+
/**
|
|
1825
|
+
* Page number, 1-based.
|
|
1826
|
+
*
|
|
1827
|
+
* @default 1
|
|
1828
|
+
* @minimum 1
|
|
1829
|
+
*/
|
|
1830
|
+
page?: Page;
|
|
1831
|
+
/**
|
|
1832
|
+
* Items per page. Values above the maximum are clamped, not rejected.
|
|
1833
|
+
*
|
|
1834
|
+
* @default 20
|
|
1835
|
+
* @minimum 1
|
|
1836
|
+
* @maximum 100
|
|
1837
|
+
*/
|
|
1838
|
+
limit?: Limit;
|
|
1839
|
+
};
|
|
1840
|
+
type CreateReportParams = {
|
|
1841
|
+
/**
|
|
1842
|
+
* The brand name to analyze
|
|
1843
|
+
*
|
|
1844
|
+
* @minLength 1
|
|
1845
|
+
*/
|
|
1846
|
+
brandName: string;
|
|
1847
|
+
/**
|
|
1848
|
+
* Other names the brand goes by (spellings, abbreviations, product names). A mention of any of
|
|
1849
|
+
* them counts as a brand mention.
|
|
1850
|
+
*
|
|
1851
|
+
* @maxItems 10
|
|
1852
|
+
*/
|
|
1853
|
+
brandAliases?: Array<string>;
|
|
1854
|
+
/**
|
|
1855
|
+
* The brand's website — a domain (nike.com) or a full URL. A URL with a path (e.g.
|
|
1856
|
+
* https://www.nike.com/golf) scopes the analysis to that page; mentions are tracked against its
|
|
1857
|
+
* domain either way.
|
|
1858
|
+
*
|
|
1859
|
+
* @minLength 1
|
|
1860
|
+
*/
|
|
1861
|
+
brandWebsite: string;
|
|
1862
|
+
/** Optional list of custom prompts to include in the report */
|
|
1863
|
+
manualPrompts?: Array<string>;
|
|
1864
|
+
};
|
|
1865
|
+
type GetReportParams = {
|
|
1866
|
+
/**
|
|
1867
|
+
* Number of top competitor entities to return in each prompt's mentionsTopK
|
|
1868
|
+
*
|
|
1869
|
+
* @default 5
|
|
1870
|
+
* @minimum 1
|
|
1871
|
+
* @maximum 50
|
|
1872
|
+
*/
|
|
1873
|
+
kMentions?: number;
|
|
1874
|
+
};
|
|
1875
|
+
//#endregion
|
|
1876
|
+
//#region src/types/tools.d.ts
|
|
1877
|
+
type OnboardingSuggestion = {
|
|
1878
|
+
additionalDomains: Array<string>;
|
|
1879
|
+
aliases: Array<string>;
|
|
1880
|
+
brandName: string;
|
|
1881
|
+
competitors: Array<{
|
|
1882
|
+
aliases: Array<string>;
|
|
1883
|
+
domains: Array<string>;
|
|
1884
|
+
name: string;
|
|
1885
|
+
}>;
|
|
1886
|
+
suggestedPrompts: Array<{
|
|
1887
|
+
prompt: string;
|
|
1888
|
+
tags: Array<string>;
|
|
1889
|
+
}>;
|
|
1890
|
+
/** Cleaned hostname */
|
|
1891
|
+
website: string;
|
|
1892
|
+
};
|
|
1893
|
+
type AnalyzeBrandErrors = {
|
|
1894
|
+
/** Invalid request data */
|
|
1895
|
+
400: ValidationError;
|
|
1896
|
+
/** Authentication required */
|
|
1897
|
+
401: UnauthorizedError;
|
|
1898
|
+
/** The organization has no active subscription. Cloud deployments only. */
|
|
1899
|
+
402: PaymentRequiredError;
|
|
1900
|
+
/**
|
|
1901
|
+
* The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
|
|
1902
|
+
* read-only (demo) mode.
|
|
1903
|
+
*/
|
|
1904
|
+
403: ForbiddenError;
|
|
1905
|
+
/** Resource already exists */
|
|
1906
|
+
409: ConflictError;
|
|
1907
|
+
/** Per-key rate limit exceeded. */
|
|
1908
|
+
429: RateLimitError;
|
|
1909
|
+
/** Internal server error */
|
|
1910
|
+
500: InternalServerError;
|
|
1911
|
+
};
|
|
1912
|
+
type AnalyzeBrandResponses = {
|
|
1913
|
+
/** Brand analysis suggestion */
|
|
1914
|
+
200: OnboardingSuggestion;
|
|
1915
|
+
};
|
|
1916
|
+
type AnalyzeBrandParams = {
|
|
1917
|
+
/**
|
|
1918
|
+
* Brand's website — a hostname or a full URL. A URL with a path (e.g. https://www.nike.com/golf)
|
|
1919
|
+
* is analyzed as given; the returned website is always its domain.
|
|
1920
|
+
*
|
|
1921
|
+
* @minLength 1
|
|
1922
|
+
*/
|
|
1923
|
+
website: string;
|
|
1924
|
+
/** Optional brand name hint. If omitted, inferred from the domain. */
|
|
1925
|
+
brandName?: string;
|
|
1926
|
+
/**
|
|
1927
|
+
* Maximum number of competitor suggestions. 0 disables competitor generation entirely.
|
|
1928
|
+
*
|
|
1929
|
+
* @default 20
|
|
1930
|
+
* @minimum 0
|
|
1931
|
+
* @maximum 100
|
|
1932
|
+
*/
|
|
1933
|
+
maxCompetitors?: number;
|
|
1934
|
+
/**
|
|
1935
|
+
* Maximum number of suggested prompts. 0 disables prompt generation entirely.
|
|
1936
|
+
*
|
|
1937
|
+
* @default 30
|
|
1938
|
+
* @minimum 0
|
|
1939
|
+
* @maximum 100
|
|
1940
|
+
*/
|
|
1941
|
+
maxPrompts?: number;
|
|
1942
|
+
};
|
|
1943
|
+
//#endregion
|
|
1944
|
+
export { GetOrganizationBillingResponses as $, BrandOpportunities as $t, ListPromptsResponses as A, PromptPerformance as An, UpdateCompetitorResponses as At, MentionEntry as B, WindowStart as Bn, ListBrandsResponses as Bt, DeletePromptResponse as C, ListBrandCitationURLsErrors as Cn, GetCompetitorErrors as Ct, ListPromptsErrors as D, ListBrandPromptPerformanceParams as Dn, ListCompetitorsResponses as Dt, GetPromptResponses as E, ListBrandPromptPerformanceErrors as En, ListCompetitorsParams as Et, CitedURLEntry as F, VisibilityPoint as Fn, CreateBrandResponses as Ft, ListPromptRunsParams as G, UnauthorizedError as Gn, Page as Gt, GetRunErrors as H, ForbiddenError as Hn, UpdateBrandParams as Ht, GetPromptSnapshotErrors as I, ValidationError as In, GetBrandErrors as It, RunCitation as J, PaymentRequiredError as Jt, ListPromptRunsResponses as K, Limit as Kt, GetPromptSnapshotParams as L, NotFoundError as Ln, GetBrandResponses as Lt, UpdatePromptErrors as M, ShareOfVoiceEntry as Mn, BrandsList as Mt, UpdatePromptParams as N, ShareOfVoicePoint as Nn, CreateBrandErrors as Nt, ListPromptsParams as O, ListBrandPromptPerformanceResponses as On, UpdateCompetitorErrors as Ot, UpdatePromptResponses as P, TagsFilter as Pn, CreateBrandParams as Pt, GetOrganizationBillingErrors as Q, TagList as Qt, GetPromptSnapshotResponses as R, ModelFilter as Rn, ListBrandsErrors as Rt, DeletePromptErrors as S, ListBrandCitationDomainsResponses as Sn, DeleteCompetitorResponses as St, GetPromptErrors as T, ListBrandCitationURLsResponses as Tn, ListCompetitorsErrors as Tt, GetRunResponses as U, InternalServerError as Un, UpdateBrandResponses as Ut, MentionsSummary as V, Error as Vn, UpdateBrandErrors as Vt, ListPromptRunsErrors as W, RateLimitError as Wn, Pagination as Wt, RunSummary as X, ListBrandTagsResponses as Xt, RunList as Y, ListBrandTagsErrors as Yt, BillingPlan as Z, Tag as Zt, ReportPromptSnapshot as _, GetBrandQueryFanoutErrors as _n, CompetitorsList as _t, CreateReportErrors as a, BrandIdPath as an, Organization as at, CreatePromptParams as b, ListBrandCitationDomainsErrors as bn, CreateCompetitorResponses as bt, CreateReportResponses as c, CitationDomain as cn, PlanLimits as ct, GetReportResponse as d, CitationURLList as dn, Model as dt, CitedPage as en, GetOrganizationErrors as et, GetReportResponses as f, DateRange as fn, ModelList as ft, ListReportsResponses as g, GetBrandAnalyticsResponses as gn, Competitor as gt, ListReportsResponse as h, GetBrandAnalyticsParams as hn, GetMeResponses as ht, OnboardingSuggestion as i, OpportunityPrompt as in, ListOrganizationsResponses as it, Prompt as j, PromptPerformanceList as jn, Brand as jt, ListPromptsResponse as k, ModelVisibility as kn, UpdateCompetitorParams as kt, GetReportErrors as l, CitationDomainList as ln, ListModelsErrors as lt, ListReportsParams as m, GetBrandAnalyticsErrors as mn, GetMeErrors as mt, AnalyzeBrandParams as n, GetBrandOpportunitiesResponses as nn, ListOrganizationsErrors as nt, CreateReportParams as o, BrandAnalytics as on, OrganizationBilling as ot, ListReportsErrors as p, FanoutQuery as pn, APIKeyIdentity as pt, Run as q, ConflictError as qt, AnalyzeBrandResponses as r, Opportunity as rn, ListOrganizationsParams as rt, CreateReportResponse as s, BrandQueryFanout as sn, OrganizationList as st, AnalyzeBrandErrors as t, GetBrandOpportunitiesErrors as tn, GetOrganizationResponses as tt, GetReportParams as u, CitationURL as un, ListModelsResponses as ut, ReportSummary as v, GetBrandQueryFanoutParams as vn, CreateCompetitorErrors as vt, DeletePromptResponses as w, ListBrandCitationURLsParams as wn, GetCompetitorResponses as wt, CreatePromptResponses as x, ListBrandCitationDomainsParams as xn, DeleteCompetitorErrors as xt, CreatePromptErrors as y, GetBrandQueryFanoutResponses as yn, CreateCompetitorParams as yt, PromptSnapshot as z, WindowEnd as zn, ListBrandsParams as zt };
|
|
1945
|
+
//# sourceMappingURL=tools-7Hs5J2xb.d.mts.map
|