@0xinsider/sdk 0.134.2 → 0.134.4
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/README.md +3 -1
- package/dist/client.d.ts +5 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +49 -18
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +5 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -5
- package/dist/errors.js.map +1 -1
- package/dist/pagination.d.ts +35 -16
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +86 -24
- package/dist/pagination.js.map +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/provenance.js +2 -2
- package/dist/schema.d.ts +4 -4
- package/dist/schema.d.ts.map +1 -1
- package/dist/webhooks.d.ts.map +1 -1
- package/dist/webhooks.js +23 -3
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
package/dist/pagination.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,OAAQ,CAAC;AAE1C,4DAA4D;AAC5D,MAAM,MAAM,cAAc;AACxB,sEAAsE;AACpE,WAAW;AACb,4EAA4E;GAC1E,WAAW,CAAC;AAEhB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC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_LIMIT = 1_024;
|
|
|
44
44
|
* walk stops before yielding the page and before any further request.
|
|
45
45
|
*
|
|
46
46
|
* `page` is the response as received, so its `data` is still available to
|
|
47
|
-
* you; `cursor` is what that page was requested with (`undefined`
|
|
48
|
-
* first page) and `nextCursor` is what it offered next.
|
|
49
|
-
* counts the pages already yielded. `paginationResumePoint(error)`
|
|
50
|
-
* `{ cursor, pagesFetched }` for this error too. Retrying the
|
|
51
|
-
* is reasonable for a transient server fault; a repeat
|
|
52
|
-
* means the route's
|
|
53
|
-
* `page.meta.request_id`.
|
|
47
|
+
* you; `cursor` / `offset` is what that page was requested with (`undefined`
|
|
48
|
+
* for the first page) and `nextCursor` / `nextOffset` is what it offered next.
|
|
49
|
+
* `pagesFetched` counts the pages already yielded. `paginationResumePoint(error)`
|
|
50
|
+
* returns `{ cursor, offset?, pagesFetched }` for this error too. Retrying the
|
|
51
|
+
* same page later is reasonable for a transient server fault; a repeat or
|
|
52
|
+
* stalled offset means the route's pagination is broken and is worth reporting
|
|
53
|
+
* with `page.meta.request_id`.
|
|
54
54
|
*/
|
|
55
55
|
export class PaginationError extends Error {
|
|
56
56
|
reason;
|
|
57
57
|
operationId;
|
|
58
58
|
cursor;
|
|
59
59
|
nextCursor;
|
|
60
|
+
offset;
|
|
61
|
+
nextOffset;
|
|
60
62
|
pagesFetched;
|
|
61
63
|
page;
|
|
62
|
-
constructor(reason, operationId, page, cursor, pagesFetched) {
|
|
64
|
+
constructor(reason, operationId, page, cursor, pagesFetched, offset) {
|
|
63
65
|
const requestId = page.meta?.request_id;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
const reqSuffix = requestId ? ` (request ${requestId})` : "";
|
|
67
|
+
const message = reason === "missing_cursor"
|
|
68
|
+
? `0xinsider API ${operationId} page ${String(pagesFetched + 1)} says has_more but carries no next_cursor or next_offset${reqSuffix}; the walk cannot continue safely`
|
|
69
|
+
: reason === "repeated_cursor"
|
|
70
|
+
? `0xinsider API ${operationId} page ${String(pagesFetched + 1)} offers next_cursor ${JSON.stringify(page.next_cursor)}, which this walk already requested${reqSuffix}; stopping before the duplicate request`
|
|
71
|
+
: `0xinsider API ${operationId} page ${String(pagesFetched + 1)} offers next_offset ${String(page.next_offset)}, which does not advance past offset ${String(offset ?? 0)}${reqSuffix}; stopping before the stalled request`;
|
|
72
|
+
super(message);
|
|
67
73
|
this.name = "PaginationError";
|
|
68
74
|
this.reason = reason;
|
|
69
75
|
this.operationId = operationId;
|
|
70
76
|
this.cursor = cursor;
|
|
71
77
|
this.nextCursor = page.next_cursor;
|
|
78
|
+
this.offset = offset;
|
|
79
|
+
this.nextOffset = page.next_offset;
|
|
72
80
|
this.pagesFetched = pagesFetched;
|
|
73
81
|
this.page = page;
|
|
74
82
|
}
|
|
@@ -109,9 +117,26 @@ function assertMaxPages(value) {
|
|
|
109
117
|
function usableCursor(value) {
|
|
110
118
|
return typeof value === "string" && value !== "";
|
|
111
119
|
}
|
|
120
|
+
/** A `next_offset` the walk can request: a non-negative safe integer. */
|
|
121
|
+
function usableOffset(value) {
|
|
122
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
123
|
+
}
|
|
124
|
+
/** Parse a caller-supplied initial `query.offset` (number or decimal string). */
|
|
125
|
+
function parseInitialOffset(value) {
|
|
126
|
+
if (typeof value === "number" && Number.isSafeInteger(value) && value >= 0) {
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
130
|
+
const parsed = Number(value);
|
|
131
|
+
if (Number.isSafeInteger(parsed))
|
|
132
|
+
return parsed;
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
112
136
|
export async function* paginatePages(client, operationId, options = {}) {
|
|
113
137
|
const { path, query, strictQuery, signal, progress, timeoutMs, maxRetries, headers } = options;
|
|
114
138
|
let cursor = query?.cursor;
|
|
139
|
+
let offset = parseInitialOffset(query?.offset);
|
|
115
140
|
let pages = 0;
|
|
116
141
|
// Every cursor requested so far, newest last, capped at CURSOR_HISTORY_LIMIT.
|
|
117
142
|
const requested = new Set();
|
|
@@ -135,14 +160,18 @@ export async function* paginatePages(client, operationId, options = {}) {
|
|
|
135
160
|
}
|
|
136
161
|
};
|
|
137
162
|
const fail = (error) => {
|
|
138
|
-
record({ pagesFetched: pages, cursor, nextCursor: cursor });
|
|
139
|
-
resumePoints.set(error, {
|
|
163
|
+
record({ pagesFetched: pages, cursor, nextCursor: cursor, offset, nextOffset: offset });
|
|
164
|
+
resumePoints.set(error, {
|
|
165
|
+
cursor,
|
|
166
|
+
...(offset === undefined ? {} : { offset }),
|
|
167
|
+
pagesFetched: pages,
|
|
168
|
+
});
|
|
140
169
|
return error;
|
|
141
170
|
};
|
|
142
|
-
record({ pagesFetched: pages, cursor, nextCursor: undefined });
|
|
171
|
+
record({ pagesFetched: pages, cursor, nextCursor: undefined, offset, nextOffset: undefined });
|
|
143
172
|
const maxPages = assertMaxPages(options.maxPages);
|
|
144
173
|
for (;;) {
|
|
145
|
-
record({ pagesFetched: pages, cursor, nextCursor: undefined });
|
|
174
|
+
record({ pagesFetched: pages, cursor, nextCursor: undefined, offset, nextOffset: undefined });
|
|
146
175
|
if (signal?.aborted) {
|
|
147
176
|
throw fail(signal.reason instanceof Error
|
|
148
177
|
? signal.reason
|
|
@@ -150,11 +179,24 @@ export async function* paginatePages(client, operationId, options = {}) {
|
|
|
150
179
|
}
|
|
151
180
|
if (cursor !== undefined)
|
|
152
181
|
remember(cursor);
|
|
182
|
+
const pageQuery = { ...query };
|
|
183
|
+
if (cursor !== undefined) {
|
|
184
|
+
pageQuery.cursor = cursor;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
delete pageQuery.cursor;
|
|
188
|
+
}
|
|
189
|
+
if (offset !== undefined) {
|
|
190
|
+
pageQuery.offset = offset;
|
|
191
|
+
}
|
|
192
|
+
else if (cursor !== undefined) {
|
|
193
|
+
delete pageQuery.offset;
|
|
194
|
+
}
|
|
153
195
|
let page;
|
|
154
196
|
try {
|
|
155
197
|
page = await client.list(operationId, {
|
|
156
198
|
...(path === undefined ? {} : { path }),
|
|
157
|
-
query:
|
|
199
|
+
query: pageQuery,
|
|
158
200
|
...(strictQuery === undefined ? {} : { strictQuery }),
|
|
159
201
|
...(signal === undefined ? {} : { signal }),
|
|
160
202
|
...(timeoutMs === undefined ? {} : { timeoutMs }),
|
|
@@ -166,16 +208,29 @@ export async function* paginatePages(client, operationId, options = {}) {
|
|
|
166
208
|
if (typeof error === "object" && error !== null)
|
|
167
209
|
fail(error);
|
|
168
210
|
else
|
|
169
|
-
record({ pagesFetched: pages, cursor, nextCursor: cursor });
|
|
211
|
+
record({ pagesFetched: pages, cursor, nextCursor: cursor, offset, nextOffset: offset });
|
|
170
212
|
throw error;
|
|
171
213
|
}
|
|
172
214
|
const next = page.next_cursor;
|
|
215
|
+
const nextOffset = page.next_offset;
|
|
216
|
+
let nextMode;
|
|
173
217
|
if (page.has_more) {
|
|
174
|
-
if (
|
|
175
|
-
|
|
218
|
+
if (usableCursor(next)) {
|
|
219
|
+
if (requested.has(next)) {
|
|
220
|
+
throw fail(new PaginationError("repeated_cursor", operationId, page, cursor, pages, offset));
|
|
221
|
+
}
|
|
222
|
+
nextMode = "cursor";
|
|
223
|
+
}
|
|
224
|
+
else if (usableOffset(nextOffset)) {
|
|
225
|
+
// An offset-paginated first page starts at offset 0, so next_offset must
|
|
226
|
+
// strictly advance past the requested offset to prevent stalls and loops.
|
|
227
|
+
if (nextOffset <= (offset ?? 0)) {
|
|
228
|
+
throw fail(new PaginationError("non_advancing_offset", operationId, page, cursor, pages, offset));
|
|
229
|
+
}
|
|
230
|
+
nextMode = "offset";
|
|
176
231
|
}
|
|
177
|
-
|
|
178
|
-
throw fail(new PaginationError("
|
|
232
|
+
else {
|
|
233
|
+
throw fail(new PaginationError("missing_cursor", operationId, page, cursor, pages, offset));
|
|
179
234
|
}
|
|
180
235
|
}
|
|
181
236
|
pages += 1;
|
|
@@ -184,12 +239,19 @@ export async function* paginatePages(client, operationId, options = {}) {
|
|
|
184
239
|
: pages >= maxPages
|
|
185
240
|
? "max_pages"
|
|
186
241
|
: undefined;
|
|
187
|
-
record({ pagesFetched: pages, cursor, nextCursor: next, stoppedBy });
|
|
242
|
+
record({ pagesFetched: pages, cursor, nextCursor: next, offset, nextOffset, stoppedBy });
|
|
188
243
|
yield page;
|
|
189
244
|
if (stoppedBy !== undefined)
|
|
190
245
|
return;
|
|
191
|
-
// `has_more` was true and
|
|
192
|
-
cursor
|
|
246
|
+
// `has_more` was true and the selected continuation passed validation above.
|
|
247
|
+
if (nextMode === "cursor") {
|
|
248
|
+
cursor = next;
|
|
249
|
+
offset = undefined;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
cursor = undefined;
|
|
253
|
+
offset = nextOffset;
|
|
254
|
+
}
|
|
193
255
|
}
|
|
194
256
|
}
|
|
195
257
|
export async function* paginate(client, operationId, options = {}) {
|
package/dist/pagination.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAkBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAkBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AA6G1C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,eAA6B,SAAQ,KAAK;IAC5C,MAAM,CAAwB;IAC9B,WAAW,CAAiB;IAC5B,MAAM,CAAqB;IAC3B,UAAU,CAA4B;IACtC,MAAM,CAAqB;IAC3B,UAAU,CAA4B;IACtC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+1,5 @@
|
|
|
1
1
|
export declare const OPENAPI_SOURCE = "0xinsider/0xinsider:web/public/api/v1/openapi.json";
|
|
2
|
-
export declare const OPENAPI_SHA256 = "
|
|
2
|
+
export declare const OPENAPI_SHA256 = "e18a9d2ec7300a58e2de715ad0b8d1d9fe64c60bad4277f03921dc2ffafee38f";
|
|
3
3
|
export declare const OPENAPI_VERSION = "1.0.0";
|
|
4
4
|
export declare const OPERATION_COUNT = 120;
|
|
5
5
|
export declare const APP_REPOSITORY = "0xinsider/0xinsider";
|
package/dist/provenance.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
// when it could be resolved, else null. Compare OPENAPI_SHA256 with the live
|
|
7
7
|
// document to see whether a release is behind the API.
|
|
8
8
|
export const OPENAPI_SOURCE = "0xinsider/0xinsider:web/public/api/v1/openapi.json";
|
|
9
|
-
export const OPENAPI_SHA256 = "
|
|
9
|
+
export const OPENAPI_SHA256 = "e18a9d2ec7300a58e2de715ad0b8d1d9fe64c60bad4277f03921dc2ffafee38f";
|
|
10
10
|
export const OPENAPI_VERSION = "1.0.0";
|
|
11
11
|
export const OPERATION_COUNT = 120;
|
|
12
12
|
export const APP_REPOSITORY = "0xinsider/0xinsider";
|
|
13
13
|
export const APP_SPEC_PATH = "web/public/api/v1/openapi.json";
|
|
14
|
-
export const APP_COMMIT = "
|
|
14
|
+
export const APP_COMMIT = "adf84c574097a5eee3abd07ac9f83287a19c8620";
|
|
15
15
|
//# sourceMappingURL=provenance.js.map
|
package/dist/schema.d.ts
CHANGED
|
@@ -94,9 +94,9 @@ export type ApiError = {
|
|
|
94
94
|
/** The recommended next request instant (RFC3339), always in the future. Present on every retryable error: `pick_not_released`, `rate_limited`, `rate_limit_unavailable`, `read_model_warming`, and `kickoff_roster_pending`, whose retry_at is 30 s after kickoff. Omitted otherwise. The absolute twin of `Retry-After`; prefer the header for the sleep duration. For `pick_not_released`, the earliest of the next scheduled release, the next automatic selector attempt, the operating-window start, or about 60 seconds. See that response. */
|
|
95
95
|
retry_at?: string;
|
|
96
96
|
freshness?: FreshnessFailure;
|
|
97
|
-
/** Where a person clears this 402 (#32592): pays the overdue invoice (reason payment_overdue) or reactivates
|
|
97
|
+
/** Where a person clears this 402 (#32592): pays the overdue invoice (reason payment_overdue) or subscribes or reactivates Pro or Max (reason subscription_inactive). Present on every 402 subscription_required, omitted on every other error. The message names the same URL; link this field instead of parsing the message. */
|
|
98
98
|
billing_url?: string;
|
|
99
|
-
/** ADDITIVE (#7209). The specific, actionable cause behind `code`, when there is one more specific than the code itself. `code` keeps its published values, so existing clients are unaffected; new clients branch on `reason`. Omitted when the code already says everything we know. pick_not_released: no Pick of the Day is published for the current product day; schedule one request against retry_at instead of polling. unknown_endpoint: the PATH is not a route on this API -- read GET /api/v1, do not retry. trader_not_tracked: the wallet is real and the URL is right, but the trader is not on the warm sync tier (the wallets we sync most often) -- stop asking for this wallet. market_out_of_scope (404 not_found, #27303): the market or event is real and the URL is right, but 0xinsider serves sports and esports markets only -- stop asking for this market; neither a retry nor another URL for it can succeed. fill_history_too_large (404 not_found, #33245): the wallet and market are tracked, but the position timeline sums every earlier fill into its running totals and this wallet has more than 20,000 fills on the market before the requested page -- stop asking for this pair; neither a retry nor another page can succeed. kickoff_roster_pending (404 not_found, #34064): as_of=kickoff on a game moneyline whose kickoff is still ahead or less than 30 s past, so its kickoff roster is not served yet; retry_at is 30 s after kickoff, and a read before it cannot succeed. kickoff_roster_not_captured (404 not_found, #34064): as_of=kickoff on a market with no stored kickoff roster (not a game moneyline, a game that kicked off before the capture shipped, a game whose live score showed play before its listed kickoff, or no complete holder population held before kickoff); terminal for that market, and the current roster is never served in its place. cursor_expired: pagination went stale mid-walk -- re-request the first page and continue. read_model_warming: the requested endpoint cannot serve its read model yet; exact causes are endpoint-specific and can include a cold or contended refresh or a dependency that prevented refresh. database_unavailable: the API's database or its connection pool is temporarily unreachable (a connection-class failure, not a query fault); code stays rate_limit_unavailable, nothing is rate-limited, retry after Retry-After / retry_at. idempotency_in_progress: retain the exact Idempotency-Key and request body, then retry shortly. webhook_delivery_in_progress: retry the URL or signing-secret configuration change after the destination's active request completes. request_accounting_unavailable: accounting capacity is unavailable before the handler executes; retry after Retry-After / retry_at. sandbox_api_key: the credential is a sandbox key (oxi_sk_test_) from POST /api/v1/agents/register, which only the sandbox server accepts -- call the sandbox base URL with it, or get a live key or OAuth access token; do not retry it here. api_key_in_query: the key was sent as a ?token= query parameter, which no route reads because URLs land in logs and history; the key itself was not checked -- resend it as Authorization: Bearer. subscription_inactive: the key is valid but the account
|
|
99
|
+
/** ADDITIVE (#7209). The specific, actionable cause behind `code`, when there is one more specific than the code itself. `code` keeps its published values, so existing clients are unaffected; new clients branch on `reason`. Omitted when the code already says everything we know. pick_not_released: no Pick of the Day is published for the current product day; schedule one request against retry_at instead of polling. unknown_endpoint: the PATH is not a route on this API -- read GET /api/v1, do not retry. trader_not_tracked: the wallet is real and the URL is right, but the trader is not on the warm sync tier (the wallets we sync most often) -- stop asking for this wallet. market_out_of_scope (404 not_found, #27303): the market or event is real and the URL is right, but 0xinsider serves sports and esports markets only -- stop asking for this market; neither a retry nor another URL for it can succeed. fill_history_too_large (404 not_found, #33245): the wallet and market are tracked, but the position timeline sums every earlier fill into its running totals and this wallet has more than 20,000 fills on the market before the requested page -- stop asking for this pair; neither a retry nor another page can succeed. kickoff_roster_pending (404 not_found, #34064): as_of=kickoff on a game moneyline whose kickoff is still ahead or less than 30 s past, so its kickoff roster is not served yet; retry_at is 30 s after kickoff, and a read before it cannot succeed. kickoff_roster_not_captured (404 not_found, #34064): as_of=kickoff on a market with no stored kickoff roster (not a game moneyline, a game that kicked off before the capture shipped, a game whose live score showed play before its listed kickoff, or no complete holder population held before kickoff); terminal for that market, and the current roster is never served in its place. cursor_expired: pagination went stale mid-walk -- re-request the first page and continue. read_model_warming: the requested endpoint cannot serve its read model yet; exact causes are endpoint-specific and can include a cold or contended refresh or a dependency that prevented refresh. database_unavailable: the API's database or its connection pool is temporarily unreachable (a connection-class failure, not a query fault); code stays rate_limit_unavailable, nothing is rate-limited, retry after Retry-After / retry_at. idempotency_in_progress: retain the exact Idempotency-Key and request body, then retry shortly. webhook_delivery_in_progress: retry the URL or signing-secret configuration change after the destination's active request completes. request_accounting_unavailable: accounting capacity is unavailable before the handler executes; retry after Retry-After / retry_at. sandbox_api_key: the credential is a sandbox key (oxi_sk_test_) from POST /api/v1/agents/register, which only the sandbox server accepts -- call the sandbox base URL with it, or get a live key or OAuth access token; do not retry it here. api_key_in_query: the key was sent as a ?token= query parameter, which no route reads because URLs land in logs and history; the key itself was not checked -- resend it as Authorization: Bearer. subscription_inactive (402 subscription_required): the key is valid but the account has no active Pro or Max subscription, because the plan lapsed or the account never had one, so data requests answer 402; GET /api/v1/me, GET /api/v1/usage and the MCP tools get_account and get_usage still answer. Permanent until a person subscribes or reactivates at https://0xinsider.com/billing, which the message names -- a retry never clears it, so stop retrying on a schedule and surface the link. The key owner is emailed once per lapse, or once for an account that never paid. payment_overdue (402 subscription_required, #32592): the key is valid and the account still has its plan, but its latest subscription invoice is unpaid (Stripe past_due or unpaid), so paid access is paused; permanent until a person pays at billing_url (https://0xinsider.com/billing) -- stop retrying on a schedule and surface the link. The key works again the moment the invoice is paid. GET /api/v1/me, GET /api/v1/usage and the MCP tools get_account and get_usage still answer. monthly_quota_exceeded: the account has used the requests its plan includes for the UTC calendar month (429 rate_limited); retry_at and Retry-After name the first of next month, the only retry that can succeed, and the message names https://0xinsider.com/developers, where pay as you go for requests over the quota is turned on. The X-Monthly-Quota-Limit, X-Monthly-Quota-Remaining and X-Monthly-Quota-Reset headers on every authenticated response say how close the account is. invalid_query, invalid_path, invalid_body (400 bad_request, #16146): a query parameter, a path segment or the JSON body did not parse or does not fit the route's schema, so no handler ran; param names the field when the parser named one (a query key, a path segment, a JSON path such as traders[0], or body); fix the request, never retry it as sent. unsupported_media_type (415 bad_request, param content-type): send the body with Content-Type: application/json. payload_too_large (413 bad_request, param body): the body is over 1048576 bytes. method_not_allowed (405 bad_request): the path is a route but not with this method; the Allow header names the methods it serves. ip_rate_limited (429 rate_limited, #16380): the per-address budget every caller behind one IP shares, counted before authentication, is spent; not the key's own window, and the RateLimit-* headers describe that bucket. ip_throttled (429 rate_limited): the address is in a cooldown after sustained over-limit traffic; Retry-After is minutes to days, and a request before it does not shorten the cooldown. cold_read_limited (429 rate_limited, #28752, #34815): the account has used its share of cold reads on a route, requests whose answer is not cached, each of which reads Polymarket: GET /api/v1/market/{condition_id}/holders for a market whose roster is not cached (6 a minute, in bursts of up to 400), and GET /api/v1/market/{condition_id}/candles at 5m or 1h for a window not cached (6 a minute, in bursts of up to 30); not the per-minute window, so a cached answer still answers, and the next cold read is admitted at Retry-After. max_plan_required (403 forbidden, #23085): the key is valid and its account is on Pro, but the route is part of Max (GET /api/v1/edge-hunter); every Pro route keeps working with the same key, so do not disable it. The message names https://0xinsider.com/pricing, where the account upgrades; a retry never clears it. endpoint_retired (410): this legacy sports endpoint no longer serves data. Migrate to GET /api/v1/edge-hunter; retrying the retired path cannot succeed. */
|
|
100
100
|
reason?: "cursor_expired" | "unknown_endpoint" | "pick_not_released" | "trader_not_tracked" | "market_out_of_scope" | "fill_history_too_large" | "kickoff_roster_pending" | "kickoff_roster_not_captured" | "read_model_warming" | "database_unavailable" | "request_accounting_unavailable" | "idempotency_in_progress" | "webhook_delivery_in_progress" | "webhook_secret_rotation_not_prepared" | "webhook_secret_rotation_overlap_active" | "sandbox_api_key" | "api_key_in_query" | "subscription_inactive" | "payment_overdue" | "monthly_quota_exceeded" | "invalid_query" | "unknown_query_parameter" | "invalid_path" | "invalid_body" | "unsupported_media_type" | "payload_too_large" | "method_not_allowed" | "ip_rate_limited" | "ip_throttled" | "cold_read_limited" | "export_expired" | "freshness_ceiling_unsatisfied" | "max_plan_required" | "endpoint_retired";
|
|
101
101
|
};
|
|
102
102
|
meta: ResponseMeta;
|
|
@@ -110,9 +110,9 @@ export type ApiErrorBody = {
|
|
|
110
110
|
/** The recommended next retry instant (RFC3339). Present on every retryable error (reason=pick_not_released, code=rate_limited including reason=monthly_quota_exceeded, code=rate_limit_unavailable, reason=read_model_warming, reason=kickoff_roster_pending, whose retry_at is 30 s after kickoff) and omitted otherwise. Always in the future. For pick_not_released, the recommendation is advisory and can change before a pick becomes available. Schedule the next request from the returned value instead of inferring a release schedule or polling. Prefer Retry-After for the duration because it is immune to client clock skew. */
|
|
111
111
|
retry_at?: string;
|
|
112
112
|
freshness?: FreshnessFailure;
|
|
113
|
-
/** Where a person clears this 402 (#32592): pays the overdue invoice (reason payment_overdue) or reactivates
|
|
113
|
+
/** Where a person clears this 402 (#32592): pays the overdue invoice (reason payment_overdue) or subscribes or reactivates Pro or Max (reason subscription_inactive). Present on every 402 subscription_required, omitted on every other error. The message names the same URL; link this field instead of parsing the message. */
|
|
114
114
|
billing_url?: string;
|
|
115
|
-
/** ADDITIVE (#7209). The specific, actionable cause behind `code`, when there is one more specific than the code itself. `code` keeps its published values, so existing clients are unaffected; new clients branch on `reason`. Omitted when the code already says everything we know. pick_not_released: no Pick of the Day is published for the current product day; schedule one request against retry_at instead of polling. unknown_endpoint: the PATH is not a route on this API -- read GET /api/v1, do not retry. trader_not_tracked: the wallet is real and the URL is right, but the trader is not on the warm sync tier (the wallets we sync most often) -- stop asking for this wallet. market_out_of_scope (404 not_found, #27303): the market or event is real and the URL is right, but 0xinsider serves sports and esports markets only -- stop asking for this market; neither a retry nor another URL for it can succeed. fill_history_too_large (404 not_found, #33245): the wallet and market are tracked, but the position timeline sums every earlier fill into its running totals and this wallet has more than 20,000 fills on the market before the requested page -- stop asking for this pair; neither a retry nor another page can succeed. kickoff_roster_pending (404 not_found, #34064): as_of=kickoff on a game moneyline whose kickoff is still ahead or less than 30 s past, so its kickoff roster is not served yet; retry_at is 30 s after kickoff, and a read before it cannot succeed. kickoff_roster_not_captured (404 not_found, #34064): as_of=kickoff on a market with no stored kickoff roster (not a game moneyline, a game that kicked off before the capture shipped, a game whose live score showed play before its listed kickoff, or no complete holder population held before kickoff); terminal for that market, and the current roster is never served in its place. cursor_expired: pagination went stale mid-walk -- re-request the first page and continue. read_model_warming: the requested endpoint cannot serve its read model yet; exact causes are endpoint-specific and can include a cold or contended refresh or a dependency that prevented refresh. database_unavailable: the API's database or its connection pool is temporarily unreachable (a connection-class failure, not a query fault); code stays rate_limit_unavailable, nothing is rate-limited, retry after Retry-After / retry_at. idempotency_in_progress: retain the exact Idempotency-Key and request body, then retry shortly. webhook_delivery_in_progress: retry the URL or signing-secret configuration change after the destination's active request completes. request_accounting_unavailable: accounting capacity is unavailable before the handler executes; retry after Retry-After / retry_at. sandbox_api_key: the credential is a sandbox key (oxi_sk_test_) from POST /api/v1/agents/register, which only the sandbox server accepts -- call the sandbox base URL with it, or get a live key or OAuth access token; do not retry it here. api_key_in_query: the key was sent as a ?token= query parameter, which no route reads because URLs land in logs and history; the key itself was not checked -- resend it as Authorization: Bearer. subscription_inactive: the key is valid but the account
|
|
115
|
+
/** ADDITIVE (#7209). The specific, actionable cause behind `code`, when there is one more specific than the code itself. `code` keeps its published values, so existing clients are unaffected; new clients branch on `reason`. Omitted when the code already says everything we know. pick_not_released: no Pick of the Day is published for the current product day; schedule one request against retry_at instead of polling. unknown_endpoint: the PATH is not a route on this API -- read GET /api/v1, do not retry. trader_not_tracked: the wallet is real and the URL is right, but the trader is not on the warm sync tier (the wallets we sync most often) -- stop asking for this wallet. market_out_of_scope (404 not_found, #27303): the market or event is real and the URL is right, but 0xinsider serves sports and esports markets only -- stop asking for this market; neither a retry nor another URL for it can succeed. fill_history_too_large (404 not_found, #33245): the wallet and market are tracked, but the position timeline sums every earlier fill into its running totals and this wallet has more than 20,000 fills on the market before the requested page -- stop asking for this pair; neither a retry nor another page can succeed. kickoff_roster_pending (404 not_found, #34064): as_of=kickoff on a game moneyline whose kickoff is still ahead or less than 30 s past, so its kickoff roster is not served yet; retry_at is 30 s after kickoff, and a read before it cannot succeed. kickoff_roster_not_captured (404 not_found, #34064): as_of=kickoff on a market with no stored kickoff roster (not a game moneyline, a game that kicked off before the capture shipped, a game whose live score showed play before its listed kickoff, or no complete holder population held before kickoff); terminal for that market, and the current roster is never served in its place. cursor_expired: pagination went stale mid-walk -- re-request the first page and continue. read_model_warming: the requested endpoint cannot serve its read model yet; exact causes are endpoint-specific and can include a cold or contended refresh or a dependency that prevented refresh. database_unavailable: the API's database or its connection pool is temporarily unreachable (a connection-class failure, not a query fault); code stays rate_limit_unavailable, nothing is rate-limited, retry after Retry-After / retry_at. idempotency_in_progress: retain the exact Idempotency-Key and request body, then retry shortly. webhook_delivery_in_progress: retry the URL or signing-secret configuration change after the destination's active request completes. request_accounting_unavailable: accounting capacity is unavailable before the handler executes; retry after Retry-After / retry_at. sandbox_api_key: the credential is a sandbox key (oxi_sk_test_) from POST /api/v1/agents/register, which only the sandbox server accepts -- call the sandbox base URL with it, or get a live key or OAuth access token; do not retry it here. api_key_in_query: the key was sent as a ?token= query parameter, which no route reads because URLs land in logs and history; the key itself was not checked -- resend it as Authorization: Bearer. subscription_inactive (402 subscription_required): the key is valid but the account has no active Pro or Max subscription, because the plan lapsed or the account never had one, so data requests answer 402; GET /api/v1/me, GET /api/v1/usage and the MCP tools get_account and get_usage still answer. Permanent until a person subscribes or reactivates at https://0xinsider.com/billing, which the message names -- a retry never clears it, so stop retrying on a schedule and surface the link. The key owner is emailed once per lapse, or once for an account that never paid. payment_overdue (402 subscription_required, #32592): the key is valid and the account still has its plan, but its latest subscription invoice is unpaid (Stripe past_due or unpaid), so paid access is paused; permanent until a person pays at billing_url (https://0xinsider.com/billing) -- stop retrying on a schedule and surface the link. The key works again the moment the invoice is paid. GET /api/v1/me, GET /api/v1/usage and the MCP tools get_account and get_usage still answer. monthly_quota_exceeded: the account has used the requests its plan includes for the UTC calendar month (429 rate_limited); retry_at and Retry-After name the first of next month, the only retry that can succeed, and the message names https://0xinsider.com/developers, where pay as you go for requests over the quota is turned on. The X-Monthly-Quota-Limit, X-Monthly-Quota-Remaining and X-Monthly-Quota-Reset headers on every authenticated response say how close the account is. invalid_query, invalid_path, invalid_body (400 bad_request, #16146): a query parameter, a path segment or the JSON body did not parse or does not fit the route's schema, so no handler ran; param names the field when the parser named one (a query key, a path segment, a JSON path such as traders[0], or body); fix the request, never retry it as sent. unsupported_media_type (415 bad_request, param content-type): send the body with Content-Type: application/json. payload_too_large (413 bad_request, param body): the body is over 1048576 bytes. method_not_allowed (405 bad_request): the path is a route but not with this method; the Allow header names the methods it serves. ip_rate_limited (429 rate_limited, #16380): the per-address budget every caller behind one IP shares, counted before authentication, is spent; not the key's own window, and the RateLimit-* headers describe that bucket. ip_throttled (429 rate_limited): the address is in a cooldown after sustained over-limit traffic; Retry-After is minutes to days, and a request before it does not shorten the cooldown. cold_read_limited (429 rate_limited, #28752, #34815): the account has used its share of cold reads on a route, requests whose answer is not cached, each of which reads Polymarket: GET /api/v1/market/{condition_id}/holders for a market whose roster is not cached (6 a minute, in bursts of up to 400), and GET /api/v1/market/{condition_id}/candles at 5m or 1h for a window not cached (6 a minute, in bursts of up to 30); not the per-minute window, so a cached answer still answers, and the next cold read is admitted at Retry-After. max_plan_required (403 forbidden, #23085): the key is valid and its account is on Pro, but the route is part of Max (GET /api/v1/edge-hunter); every Pro route keeps working with the same key, so do not disable it. The message names https://0xinsider.com/pricing, where the account upgrades; a retry never clears it. endpoint_retired (410): this legacy sports endpoint no longer serves data. Migrate to GET /api/v1/edge-hunter; retrying the retired path cannot succeed. */
|
|
116
116
|
reason?: "cursor_expired" | "unknown_endpoint" | "pick_not_released" | "trader_not_tracked" | "market_out_of_scope" | "fill_history_too_large" | "kickoff_roster_pending" | "kickoff_roster_not_captured" | "read_model_warming" | "database_unavailable" | "request_accounting_unavailable" | "idempotency_in_progress" | "webhook_delivery_in_progress" | "webhook_secret_rotation_not_prepared" | "webhook_secret_rotation_overlap_active" | "sandbox_api_key" | "api_key_in_query" | "subscription_inactive" | "payment_overdue" | "monthly_quota_exceeded" | "invalid_query" | "unknown_query_parameter" | "invalid_path" | "invalid_body" | "unsupported_media_type" | "payload_too_large" | "method_not_allowed" | "ip_rate_limited" | "ip_throttled" | "cold_read_limited" | "export_expired" | "freshness_ceiling_unsatisfied" | "max_plan_required" | "endpoint_retired";
|
|
117
117
|
};
|
|
118
118
|
export type BatchGameHoldersItem = {
|