serpkite 0.0.0-stage → 0.2.0
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 +21 -0
- package/README.md +275 -2
- package/dist/index.cjs +420 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2259 -0
- package/dist/index.d.ts +2259 -0
- package/dist/index.js +412 -0
- package/dist/index.js.map +1 -0
- package/package.json +61 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by openapi-typescript.
|
|
3
|
+
* Do not make direct changes to the file.
|
|
4
|
+
*/
|
|
5
|
+
interface paths {
|
|
6
|
+
"/healthz": {
|
|
7
|
+
parameters: {
|
|
8
|
+
query?: never;
|
|
9
|
+
header?: never;
|
|
10
|
+
path?: never;
|
|
11
|
+
cookie?: never;
|
|
12
|
+
};
|
|
13
|
+
/** Readiness (DB, Valkey) */
|
|
14
|
+
get: {
|
|
15
|
+
parameters: {
|
|
16
|
+
query?: never;
|
|
17
|
+
header?: never;
|
|
18
|
+
path?: never;
|
|
19
|
+
cookie?: never;
|
|
20
|
+
};
|
|
21
|
+
requestBody?: never;
|
|
22
|
+
responses: {
|
|
23
|
+
/** @description OK */
|
|
24
|
+
200: {
|
|
25
|
+
headers: {
|
|
26
|
+
[name: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
content?: never;
|
|
29
|
+
};
|
|
30
|
+
/** @description A dependency is down */
|
|
31
|
+
503: {
|
|
32
|
+
headers: {
|
|
33
|
+
[name: string]: unknown;
|
|
34
|
+
};
|
|
35
|
+
content?: never;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
put?: never;
|
|
40
|
+
post?: never;
|
|
41
|
+
delete?: never;
|
|
42
|
+
options?: never;
|
|
43
|
+
head?: never;
|
|
44
|
+
patch?: never;
|
|
45
|
+
trace?: never;
|
|
46
|
+
};
|
|
47
|
+
"/livez": {
|
|
48
|
+
parameters: {
|
|
49
|
+
query?: never;
|
|
50
|
+
header?: never;
|
|
51
|
+
path?: never;
|
|
52
|
+
cookie?: never;
|
|
53
|
+
};
|
|
54
|
+
/** Liveness only */
|
|
55
|
+
get: {
|
|
56
|
+
parameters: {
|
|
57
|
+
query?: never;
|
|
58
|
+
header?: never;
|
|
59
|
+
path?: never;
|
|
60
|
+
cookie?: never;
|
|
61
|
+
};
|
|
62
|
+
requestBody?: never;
|
|
63
|
+
responses: {
|
|
64
|
+
/** @description OK */
|
|
65
|
+
200: {
|
|
66
|
+
headers: {
|
|
67
|
+
[name: string]: unknown;
|
|
68
|
+
};
|
|
69
|
+
content?: never;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
put?: never;
|
|
74
|
+
post?: never;
|
|
75
|
+
delete?: never;
|
|
76
|
+
options?: never;
|
|
77
|
+
head?: never;
|
|
78
|
+
patch?: never;
|
|
79
|
+
trace?: never;
|
|
80
|
+
};
|
|
81
|
+
"/v1/search": {
|
|
82
|
+
parameters: {
|
|
83
|
+
query?: never;
|
|
84
|
+
header?: never;
|
|
85
|
+
path?: never;
|
|
86
|
+
cookie?: never;
|
|
87
|
+
};
|
|
88
|
+
/** Same as POST /v1/search with query-string parameters */
|
|
89
|
+
get: operations["searchGet"];
|
|
90
|
+
put?: never;
|
|
91
|
+
/** Google web search (organic results, knowledge graph, answer box, people also ask, top stories, local pack…) */
|
|
92
|
+
post: operations["search"];
|
|
93
|
+
delete?: never;
|
|
94
|
+
options?: never;
|
|
95
|
+
head?: never;
|
|
96
|
+
patch?: never;
|
|
97
|
+
trace?: never;
|
|
98
|
+
};
|
|
99
|
+
"/v1/images": {
|
|
100
|
+
parameters: {
|
|
101
|
+
query?: never;
|
|
102
|
+
header?: never;
|
|
103
|
+
path?: never;
|
|
104
|
+
cookie?: never;
|
|
105
|
+
};
|
|
106
|
+
get?: never;
|
|
107
|
+
put?: never;
|
|
108
|
+
/** Google Images */
|
|
109
|
+
post: operations["images"];
|
|
110
|
+
delete?: never;
|
|
111
|
+
options?: never;
|
|
112
|
+
head?: never;
|
|
113
|
+
patch?: never;
|
|
114
|
+
trace?: never;
|
|
115
|
+
};
|
|
116
|
+
"/v1/videos": {
|
|
117
|
+
parameters: {
|
|
118
|
+
query?: never;
|
|
119
|
+
header?: never;
|
|
120
|
+
path?: never;
|
|
121
|
+
cookie?: never;
|
|
122
|
+
};
|
|
123
|
+
get?: never;
|
|
124
|
+
put?: never;
|
|
125
|
+
/** Google Videos */
|
|
126
|
+
post: operations["videos"];
|
|
127
|
+
delete?: never;
|
|
128
|
+
options?: never;
|
|
129
|
+
head?: never;
|
|
130
|
+
patch?: never;
|
|
131
|
+
trace?: never;
|
|
132
|
+
};
|
|
133
|
+
"/v1/news": {
|
|
134
|
+
parameters: {
|
|
135
|
+
query?: never;
|
|
136
|
+
header?: never;
|
|
137
|
+
path?: never;
|
|
138
|
+
cookie?: never;
|
|
139
|
+
};
|
|
140
|
+
get?: never;
|
|
141
|
+
put?: never;
|
|
142
|
+
/** Google News */
|
|
143
|
+
post: operations["news"];
|
|
144
|
+
delete?: never;
|
|
145
|
+
options?: never;
|
|
146
|
+
head?: never;
|
|
147
|
+
patch?: never;
|
|
148
|
+
trace?: never;
|
|
149
|
+
};
|
|
150
|
+
"/v1/maps": {
|
|
151
|
+
parameters: {
|
|
152
|
+
query?: never;
|
|
153
|
+
header?: never;
|
|
154
|
+
path?: never;
|
|
155
|
+
cookie?: never;
|
|
156
|
+
};
|
|
157
|
+
get?: never;
|
|
158
|
+
put?: never;
|
|
159
|
+
/** Google Maps search (places with coordinates). Accepts `ll` ("@lat,lng,zoomz") */
|
|
160
|
+
post: operations["maps"];
|
|
161
|
+
delete?: never;
|
|
162
|
+
options?: never;
|
|
163
|
+
head?: never;
|
|
164
|
+
patch?: never;
|
|
165
|
+
trace?: never;
|
|
166
|
+
};
|
|
167
|
+
"/v1/places": {
|
|
168
|
+
parameters: {
|
|
169
|
+
query?: never;
|
|
170
|
+
header?: never;
|
|
171
|
+
path?: never;
|
|
172
|
+
cookie?: never;
|
|
173
|
+
};
|
|
174
|
+
get?: never;
|
|
175
|
+
put?: never;
|
|
176
|
+
/** Google local results (places) */
|
|
177
|
+
post: operations["places"];
|
|
178
|
+
delete?: never;
|
|
179
|
+
options?: never;
|
|
180
|
+
head?: never;
|
|
181
|
+
patch?: never;
|
|
182
|
+
trace?: never;
|
|
183
|
+
};
|
|
184
|
+
"/v1/reviews": {
|
|
185
|
+
parameters: {
|
|
186
|
+
query?: never;
|
|
187
|
+
header?: never;
|
|
188
|
+
path?: never;
|
|
189
|
+
cookie?: never;
|
|
190
|
+
};
|
|
191
|
+
get?: never;
|
|
192
|
+
put?: never;
|
|
193
|
+
/** Reviews of a place (by `place_id`, `cid` or `fid`); 1 credit per 10 reviews */
|
|
194
|
+
post: operations["reviews"];
|
|
195
|
+
delete?: never;
|
|
196
|
+
options?: never;
|
|
197
|
+
head?: never;
|
|
198
|
+
patch?: never;
|
|
199
|
+
trace?: never;
|
|
200
|
+
};
|
|
201
|
+
"/v1/shopping": {
|
|
202
|
+
parameters: {
|
|
203
|
+
query?: never;
|
|
204
|
+
header?: never;
|
|
205
|
+
path?: never;
|
|
206
|
+
cookie?: never;
|
|
207
|
+
};
|
|
208
|
+
get?: never;
|
|
209
|
+
put?: never;
|
|
210
|
+
/** Google Shopping */
|
|
211
|
+
post: operations["shopping"];
|
|
212
|
+
delete?: never;
|
|
213
|
+
options?: never;
|
|
214
|
+
head?: never;
|
|
215
|
+
patch?: never;
|
|
216
|
+
trace?: never;
|
|
217
|
+
};
|
|
218
|
+
"/v1/scholar": {
|
|
219
|
+
parameters: {
|
|
220
|
+
query?: never;
|
|
221
|
+
header?: never;
|
|
222
|
+
path?: never;
|
|
223
|
+
cookie?: never;
|
|
224
|
+
};
|
|
225
|
+
get?: never;
|
|
226
|
+
put?: never;
|
|
227
|
+
/** Google Scholar */
|
|
228
|
+
post: operations["scholar"];
|
|
229
|
+
delete?: never;
|
|
230
|
+
options?: never;
|
|
231
|
+
head?: never;
|
|
232
|
+
patch?: never;
|
|
233
|
+
trace?: never;
|
|
234
|
+
};
|
|
235
|
+
"/v1/patents": {
|
|
236
|
+
parameters: {
|
|
237
|
+
query?: never;
|
|
238
|
+
header?: never;
|
|
239
|
+
path?: never;
|
|
240
|
+
cookie?: never;
|
|
241
|
+
};
|
|
242
|
+
get?: never;
|
|
243
|
+
put?: never;
|
|
244
|
+
/** Google Patents */
|
|
245
|
+
post: operations["patents"];
|
|
246
|
+
delete?: never;
|
|
247
|
+
options?: never;
|
|
248
|
+
head?: never;
|
|
249
|
+
patch?: never;
|
|
250
|
+
trace?: never;
|
|
251
|
+
};
|
|
252
|
+
"/v1/autocomplete": {
|
|
253
|
+
parameters: {
|
|
254
|
+
query?: never;
|
|
255
|
+
header?: never;
|
|
256
|
+
path?: never;
|
|
257
|
+
cookie?: never;
|
|
258
|
+
};
|
|
259
|
+
get?: never;
|
|
260
|
+
put?: never;
|
|
261
|
+
/** Google autocomplete suggestions (0.5 credit) */
|
|
262
|
+
post: operations["autocomplete"];
|
|
263
|
+
delete?: never;
|
|
264
|
+
options?: never;
|
|
265
|
+
head?: never;
|
|
266
|
+
patch?: never;
|
|
267
|
+
trace?: never;
|
|
268
|
+
};
|
|
269
|
+
"/v1/lens": {
|
|
270
|
+
parameters: {
|
|
271
|
+
query?: never;
|
|
272
|
+
header?: never;
|
|
273
|
+
path?: never;
|
|
274
|
+
cookie?: never;
|
|
275
|
+
};
|
|
276
|
+
get?: never;
|
|
277
|
+
put?: never;
|
|
278
|
+
/** Google Lens visual matches for an image URL (2 credits) */
|
|
279
|
+
post: operations["lens"];
|
|
280
|
+
delete?: never;
|
|
281
|
+
options?: never;
|
|
282
|
+
head?: never;
|
|
283
|
+
patch?: never;
|
|
284
|
+
trace?: never;
|
|
285
|
+
};
|
|
286
|
+
"/v1/webpage": {
|
|
287
|
+
parameters: {
|
|
288
|
+
query?: never;
|
|
289
|
+
header?: never;
|
|
290
|
+
path?: never;
|
|
291
|
+
cookie?: never;
|
|
292
|
+
};
|
|
293
|
+
get?: never;
|
|
294
|
+
put?: never;
|
|
295
|
+
/** Fetch any public URL and return clean Markdown + metadata (1 credit) */
|
|
296
|
+
post: operations["webpage"];
|
|
297
|
+
delete?: never;
|
|
298
|
+
options?: never;
|
|
299
|
+
head?: never;
|
|
300
|
+
patch?: never;
|
|
301
|
+
trace?: never;
|
|
302
|
+
};
|
|
303
|
+
"/customsearch/v1": {
|
|
304
|
+
parameters: {
|
|
305
|
+
query?: never;
|
|
306
|
+
header?: never;
|
|
307
|
+
path?: never;
|
|
308
|
+
cookie?: never;
|
|
309
|
+
};
|
|
310
|
+
/** Google Custom Search JSON API–compatible endpoint (for apps moving off CSE) */
|
|
311
|
+
get: operations["customSearch"];
|
|
312
|
+
put?: never;
|
|
313
|
+
post?: never;
|
|
314
|
+
delete?: never;
|
|
315
|
+
options?: never;
|
|
316
|
+
head?: never;
|
|
317
|
+
patch?: never;
|
|
318
|
+
trace?: never;
|
|
319
|
+
};
|
|
320
|
+
"/v1/rank": {
|
|
321
|
+
parameters: {
|
|
322
|
+
query?: never;
|
|
323
|
+
header?: never;
|
|
324
|
+
path?: never;
|
|
325
|
+
cookie?: never;
|
|
326
|
+
};
|
|
327
|
+
get?: never;
|
|
328
|
+
put?: never;
|
|
329
|
+
/** Position of a domain for a keyword in the top N (default 100; priced like /v1/search depth, 7 credits for 100) */
|
|
330
|
+
post: operations["rank"];
|
|
331
|
+
delete?: never;
|
|
332
|
+
options?: never;
|
|
333
|
+
head?: never;
|
|
334
|
+
patch?: never;
|
|
335
|
+
trace?: never;
|
|
336
|
+
};
|
|
337
|
+
"/v1/status": {
|
|
338
|
+
parameters: {
|
|
339
|
+
query?: never;
|
|
340
|
+
header?: never;
|
|
341
|
+
path?: never;
|
|
342
|
+
cookie?: never;
|
|
343
|
+
};
|
|
344
|
+
/** Public live status — requests, success rate, p50/p95 latency per endpoint over the last hour */
|
|
345
|
+
get: operations["status"];
|
|
346
|
+
put?: never;
|
|
347
|
+
post?: never;
|
|
348
|
+
delete?: never;
|
|
349
|
+
options?: never;
|
|
350
|
+
head?: never;
|
|
351
|
+
patch?: never;
|
|
352
|
+
trace?: never;
|
|
353
|
+
};
|
|
354
|
+
"/v1/batches": {
|
|
355
|
+
parameters: {
|
|
356
|
+
query?: never;
|
|
357
|
+
header?: never;
|
|
358
|
+
path?: never;
|
|
359
|
+
cookie?: never;
|
|
360
|
+
};
|
|
361
|
+
get?: never;
|
|
362
|
+
put?: never;
|
|
363
|
+
/**
|
|
364
|
+
* Queue up to 100 requests for one endpoint at half price. Each request becomes one batch job
|
|
365
|
+
* @description Credits for the whole batch are reserved together: if the balance, spend cap, key limit or
|
|
366
|
+
* free daily cap can't cover every valid request, none is queued and each gets the error
|
|
367
|
+
* (invalid requests get their own 400 entry either way). Each job is settled and refunded on
|
|
368
|
+
* its own once it runs.
|
|
369
|
+
*
|
|
370
|
+
* **Retries.** Send an `Idempotency-Key` to make the call safe to retry: for 24 hours a
|
|
371
|
+
* repeat with the same key and the same body returns the first response (with
|
|
372
|
+
* `Idempotent-Replayed: true`) without queueing or billing again. The same key with a
|
|
373
|
+
* different body is rejected with 422 `idempotency_key_reused`; a repeat while the first
|
|
374
|
+
* call is still running gets 409.
|
|
375
|
+
*
|
|
376
|
+
* **Webhooks.** Every delivery is a `POST` with `X-SerpKite-Event: batch.completed`,
|
|
377
|
+
* `X-SerpKite-Delivery` (the job id), `X-SerpKite-Timestamp` (Unix seconds) and
|
|
378
|
+
* `X-SerpKite-Signature: v1=<hex HMAC-SHA256(secret, "<timestamp>.<raw body>")>`. Deliveries
|
|
379
|
+
* are always signed; the account's secret is created with its first webhook and revealed by
|
|
380
|
+
* rotating it (dashboard Settings → Webhooks). Verify by recomputing the HMAC over the raw
|
|
381
|
+
* body, comparing in constant time, and rejecting timestamps older than 5 minutes. The SDKs
|
|
382
|
+
* ship `verifyWebhook` / `verify_webhook` / `VerifyWebhook`.
|
|
383
|
+
*/
|
|
384
|
+
post: operations["createBatches"];
|
|
385
|
+
delete?: never;
|
|
386
|
+
options?: never;
|
|
387
|
+
head?: never;
|
|
388
|
+
patch?: never;
|
|
389
|
+
trace?: never;
|
|
390
|
+
};
|
|
391
|
+
"/v1/batches/{id}": {
|
|
392
|
+
parameters: {
|
|
393
|
+
query?: never;
|
|
394
|
+
header?: never;
|
|
395
|
+
path?: never;
|
|
396
|
+
cookie?: never;
|
|
397
|
+
};
|
|
398
|
+
/** Poll a batch job */
|
|
399
|
+
get: operations["getBatch"];
|
|
400
|
+
put?: never;
|
|
401
|
+
post?: never;
|
|
402
|
+
delete?: never;
|
|
403
|
+
options?: never;
|
|
404
|
+
head?: never;
|
|
405
|
+
patch?: never;
|
|
406
|
+
trace?: never;
|
|
407
|
+
};
|
|
408
|
+
"/v1/account": {
|
|
409
|
+
parameters: {
|
|
410
|
+
query?: never;
|
|
411
|
+
header?: never;
|
|
412
|
+
path?: never;
|
|
413
|
+
cookie?: never;
|
|
414
|
+
};
|
|
415
|
+
/** Balance, limits and this month's usage for the calling key's account */
|
|
416
|
+
get: operations["account"];
|
|
417
|
+
put?: never;
|
|
418
|
+
post?: never;
|
|
419
|
+
delete?: never;
|
|
420
|
+
options?: never;
|
|
421
|
+
head?: never;
|
|
422
|
+
patch?: never;
|
|
423
|
+
trace?: never;
|
|
424
|
+
};
|
|
425
|
+
"/playground/search": {
|
|
426
|
+
parameters: {
|
|
427
|
+
query?: never;
|
|
428
|
+
header?: never;
|
|
429
|
+
path?: never;
|
|
430
|
+
cookie?: never;
|
|
431
|
+
};
|
|
432
|
+
get?: never;
|
|
433
|
+
put?: never;
|
|
434
|
+
/** No-login demo of /v1/search (and news, images, autocomplete via `endpoint`). Per-IP rate limited (IPv6 per /64), not billed. Browser calls only from serpkite.com and app.serpkite.com */
|
|
435
|
+
post: operations["playground"];
|
|
436
|
+
delete?: never;
|
|
437
|
+
options?: never;
|
|
438
|
+
head?: never;
|
|
439
|
+
patch?: never;
|
|
440
|
+
trace?: never;
|
|
441
|
+
};
|
|
442
|
+
"/v1/mcp": {
|
|
443
|
+
parameters: {
|
|
444
|
+
query?: never;
|
|
445
|
+
header?: never;
|
|
446
|
+
path?: never;
|
|
447
|
+
cookie?: never;
|
|
448
|
+
};
|
|
449
|
+
get?: never;
|
|
450
|
+
put?: never;
|
|
451
|
+
/** Remote MCP server (streamable HTTP, JSON-RPC 2.0). Tools search, news, maps, scholar, webpage */
|
|
452
|
+
post: operations["mcp"];
|
|
453
|
+
delete?: never;
|
|
454
|
+
options?: never;
|
|
455
|
+
head?: never;
|
|
456
|
+
patch?: never;
|
|
457
|
+
trace?: never;
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
interface components {
|
|
461
|
+
schemas: {
|
|
462
|
+
Error: {
|
|
463
|
+
error: {
|
|
464
|
+
/**
|
|
465
|
+
* @description 403: spend_cap_reached, key_limit_reached, forbidden. 409/422: idempotency_key_reused. 429: rate_limited, daily_limit_reached. 503: upstream_error, upstream_blocked, upstream_timeout, unavailable (the API never sends 502 or 504)
|
|
466
|
+
* @example unauthorized
|
|
467
|
+
* @example invalid_request
|
|
468
|
+
* @example insufficient_credits
|
|
469
|
+
* @example rate_limited
|
|
470
|
+
* @example daily_limit_reached
|
|
471
|
+
* @example spend_cap_reached
|
|
472
|
+
* @example key_limit_reached
|
|
473
|
+
* @example idempotency_key_reused
|
|
474
|
+
* @example forbidden
|
|
475
|
+
* @example not_found
|
|
476
|
+
* @example upstream_error
|
|
477
|
+
* @example upstream_blocked
|
|
478
|
+
* @example upstream_timeout
|
|
479
|
+
* @example unavailable
|
|
480
|
+
* @example internal
|
|
481
|
+
*/
|
|
482
|
+
code: string;
|
|
483
|
+
message: string;
|
|
484
|
+
request_id?: string;
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
SearchRequest: {
|
|
488
|
+
q: string;
|
|
489
|
+
/**
|
|
490
|
+
* @description Country code (ISO 3166-1 alpha-2)
|
|
491
|
+
* @default us
|
|
492
|
+
*/
|
|
493
|
+
country?: string;
|
|
494
|
+
/**
|
|
495
|
+
* @description Interface language (e.g. en
|
|
496
|
+
* @default en
|
|
497
|
+
*/
|
|
498
|
+
language?: string;
|
|
499
|
+
/** @description Free-text location, e.g. "Austin, Texas, United States" */
|
|
500
|
+
location?: string;
|
|
501
|
+
/** @description Pre-encoded Google location (overrides location) */
|
|
502
|
+
uule?: string;
|
|
503
|
+
/** @description Maps viewport "@lat,lng,14z" (maps only) */
|
|
504
|
+
ll?: string;
|
|
505
|
+
/**
|
|
506
|
+
* @description 10, or up to 100 for the depth bundle on search and news (7 credits for 100; values between round up to whole pages). Other verticals return one page of 10
|
|
507
|
+
* @default 10
|
|
508
|
+
*/
|
|
509
|
+
num?: number;
|
|
510
|
+
/** @default 1 */
|
|
511
|
+
page?: number;
|
|
512
|
+
/**
|
|
513
|
+
* @description Only results from the last hour/day/…
|
|
514
|
+
* @enum {string}
|
|
515
|
+
*/
|
|
516
|
+
time?: "hour" | "day" | "week" | "month" | "year";
|
|
517
|
+
/** @description Advanced: raw Google tbs filter (e.g. qdr:d); overrides time */
|
|
518
|
+
tbs?: string;
|
|
519
|
+
/**
|
|
520
|
+
* @default desktop
|
|
521
|
+
* @enum {string}
|
|
522
|
+
*/
|
|
523
|
+
device?: "desktop" | "mobile";
|
|
524
|
+
/**
|
|
525
|
+
* @default off
|
|
526
|
+
* @enum {string}
|
|
527
|
+
*/
|
|
528
|
+
safe?: "active" | "off";
|
|
529
|
+
/** @default true */
|
|
530
|
+
autocorrect?: boolean;
|
|
531
|
+
/**
|
|
532
|
+
* @default json
|
|
533
|
+
* @enum {string}
|
|
534
|
+
*/
|
|
535
|
+
format?: "json" | "markdown" | "compact";
|
|
536
|
+
/** @description Comma-separated projection, e.g. "results.title,results.link,knowledge_graph" */
|
|
537
|
+
fields?: string;
|
|
538
|
+
/**
|
|
539
|
+
* @description Also fetch the top N organic pages as Markdown (+1 credit each fetched page)
|
|
540
|
+
* @default 0
|
|
541
|
+
*/
|
|
542
|
+
include_content?: number;
|
|
543
|
+
/**
|
|
544
|
+
* @description Include sponsored results
|
|
545
|
+
* @default false
|
|
546
|
+
*/
|
|
547
|
+
ads?: boolean;
|
|
548
|
+
/** @description Accept a cached result up to this many seconds old (50% of credits on a hit) */
|
|
549
|
+
max_age?: number;
|
|
550
|
+
engine?: components["schemas"]["EngineParam"];
|
|
551
|
+
};
|
|
552
|
+
/** @description One of place_id, cid or fid is required */
|
|
553
|
+
ReviewsRequest: {
|
|
554
|
+
place_id?: string;
|
|
555
|
+
cid?: string;
|
|
556
|
+
fid?: string;
|
|
557
|
+
country?: string;
|
|
558
|
+
language?: string;
|
|
559
|
+
/**
|
|
560
|
+
* @default most_relevant
|
|
561
|
+
* @enum {string}
|
|
562
|
+
*/
|
|
563
|
+
sort?: "most_relevant" | "newest" | "highest_rating" | "lowest_rating";
|
|
564
|
+
/** @description `next_page_token` from the previous page, unchanged. Opaque and bound to the place and `sort` it was issued for (anything else is a 400). Paging reaches the first 100 reviews of a place per sort order. */
|
|
565
|
+
page_token?: string;
|
|
566
|
+
/**
|
|
567
|
+
* @description Reviews per page (a page can be shorter when Google stops loading early; `next_page_token` then resumes after it)
|
|
568
|
+
* @default 10
|
|
569
|
+
*/
|
|
570
|
+
num?: number;
|
|
571
|
+
/** @enum {string} */
|
|
572
|
+
format?: "json" | "markdown" | "compact";
|
|
573
|
+
fields?: string;
|
|
574
|
+
max_age?: number;
|
|
575
|
+
};
|
|
576
|
+
LensRequest: {
|
|
577
|
+
/**
|
|
578
|
+
* Format: uri
|
|
579
|
+
* @description Image URL
|
|
580
|
+
*/
|
|
581
|
+
url: string;
|
|
582
|
+
country?: string;
|
|
583
|
+
language?: string;
|
|
584
|
+
/** @enum {string} */
|
|
585
|
+
format?: "json" | "markdown" | "compact";
|
|
586
|
+
fields?: string;
|
|
587
|
+
max_age?: number;
|
|
588
|
+
};
|
|
589
|
+
WebpageRequest: {
|
|
590
|
+
/** Format: uri */
|
|
591
|
+
url: string;
|
|
592
|
+
/**
|
|
593
|
+
* @default json
|
|
594
|
+
* @enum {string}
|
|
595
|
+
*/
|
|
596
|
+
format?: "json" | "markdown" | "compact";
|
|
597
|
+
/** @default false */
|
|
598
|
+
include_html?: boolean;
|
|
599
|
+
max_age?: number;
|
|
600
|
+
};
|
|
601
|
+
/**
|
|
602
|
+
* @description A search provider (docs/providers). Which verticals each serves depends on the deployment.
|
|
603
|
+
* @enum {string}
|
|
604
|
+
*/
|
|
605
|
+
Provider: "google" | "brave" | "bing" | "yahoo" | "duckduckgo" | "mojeek" | "wikipedia";
|
|
606
|
+
/** @description Which search providers may answer. `google` (the default) is Google only; within Google, SerpKite always fails over across its own proxy pools. `auto` allows falling back to other enabled providers, in route order, when Google is blocked or times out. A single other provider (`brave`) or a list (`["google","brave"]`, or `google,brave` in a query string) restricts the request to those providers. `meta.engine` always names the provider that answered and credits follow that provider's price. A key with "Allow fallback to other search engines" on treats a request without `engine` as `auto`. `consensus` (`/v1/search` only; 400 elsewhere, and it can't be combined with other names) queries several independent search indexes in parallel (at most one Bing-backed provider, so Yahoo or DuckDuckGo never count as agreeing with Bing), merges the results by URL and ranks them by how many providers returned each one. Each result lists its `sources`; `meta.engine` is `consensus` and `meta.route` lists every provider attempt. It stops once `num` unique results are in hand or after a few seconds, and costs the sum of one page at each provider that returned results (providers that failed, came back empty or were never started are free). */
|
|
607
|
+
EngineParam: string | components["schemas"]["Provider"][];
|
|
608
|
+
/** @description One provider attempt behind this answer. Proxy pools are internal and never listed. */
|
|
609
|
+
RouteStep: {
|
|
610
|
+
/**
|
|
611
|
+
* @example google
|
|
612
|
+
* @example brave
|
|
613
|
+
*/
|
|
614
|
+
provider: string;
|
|
615
|
+
/** @enum {string} */
|
|
616
|
+
outcome: "ok" | "partial" | "empty" | "soft_empty" | "blocked" | "timeout" | "error" | "unsupported" | "bad_param" | "bad_target" | "canceled";
|
|
617
|
+
/** @description Duration of the attempt in milliseconds */
|
|
618
|
+
ms: number;
|
|
619
|
+
};
|
|
620
|
+
Meta: {
|
|
621
|
+
request_id: string;
|
|
622
|
+
credits_used: number;
|
|
623
|
+
/**
|
|
624
|
+
* @description The provider that produced the result (`consensus` for a merged engine=consensus answer)
|
|
625
|
+
* @example google
|
|
626
|
+
* @example brave
|
|
627
|
+
* @example consensus
|
|
628
|
+
* @example stub
|
|
629
|
+
*/
|
|
630
|
+
engine?: string;
|
|
631
|
+
/** @description Provider attempts in order (fresh results only; absent on cache hits). With engine=consensus, every provider started; ones stopped early are `canceled`, ones cut off by the deadline `timeout` */
|
|
632
|
+
route?: components["schemas"]["RouteStep"][];
|
|
633
|
+
cached: boolean;
|
|
634
|
+
/** Format: date-time */
|
|
635
|
+
cached_at?: string;
|
|
636
|
+
resolved_urls?: boolean;
|
|
637
|
+
/** @enum {string} */
|
|
638
|
+
parse_quality?: "ok" | "partial" | "empty";
|
|
639
|
+
latency_ms?: number;
|
|
640
|
+
};
|
|
641
|
+
/** @description The normalised request that produced this response (defaults filled in) */
|
|
642
|
+
RequestEcho: {
|
|
643
|
+
/**
|
|
644
|
+
* @example search
|
|
645
|
+
* @example news
|
|
646
|
+
* @example lens
|
|
647
|
+
*/
|
|
648
|
+
endpoint: string;
|
|
649
|
+
/** @description The engine policy as asked (google, auto, one provider or a list) */
|
|
650
|
+
engine: string | string[];
|
|
651
|
+
q?: string;
|
|
652
|
+
url?: string;
|
|
653
|
+
country?: string;
|
|
654
|
+
language?: string;
|
|
655
|
+
location?: string;
|
|
656
|
+
num?: number;
|
|
657
|
+
page?: number;
|
|
658
|
+
device?: string;
|
|
659
|
+
autocorrect?: boolean;
|
|
660
|
+
tbs?: string;
|
|
661
|
+
safe?: string;
|
|
662
|
+
place_id?: string;
|
|
663
|
+
cid?: string;
|
|
664
|
+
fid?: string;
|
|
665
|
+
sort?: string;
|
|
666
|
+
include_content?: number;
|
|
667
|
+
format?: string;
|
|
668
|
+
} & {
|
|
669
|
+
[key: string]: unknown;
|
|
670
|
+
};
|
|
671
|
+
Sitelink: {
|
|
672
|
+
title: string;
|
|
673
|
+
link: string;
|
|
674
|
+
snippet?: string;
|
|
675
|
+
};
|
|
676
|
+
OrganicResult: {
|
|
677
|
+
position: number;
|
|
678
|
+
title: string;
|
|
679
|
+
/** @description Resolved destination URL (never a google.com/url or /goto redirect) */
|
|
680
|
+
link: string;
|
|
681
|
+
/** @description Canonical host without www. */
|
|
682
|
+
domain: string;
|
|
683
|
+
displayed_link?: string;
|
|
684
|
+
snippet?: string;
|
|
685
|
+
date?: string;
|
|
686
|
+
sitelinks?: components["schemas"]["Sitelink"][];
|
|
687
|
+
attributes?: {
|
|
688
|
+
[key: string]: string;
|
|
689
|
+
};
|
|
690
|
+
rating?: number;
|
|
691
|
+
rating_count?: number;
|
|
692
|
+
/** @description Page Markdown when include_content covered this result */
|
|
693
|
+
content?: string;
|
|
694
|
+
/**
|
|
695
|
+
* @description engine=consensus only. The providers that returned this result, in route order; results are ranked by how many there are
|
|
696
|
+
* @example [
|
|
697
|
+
* "google",
|
|
698
|
+
* "brave",
|
|
699
|
+
* "bing"
|
|
700
|
+
* ]
|
|
701
|
+
*/
|
|
702
|
+
sources?: components["schemas"]["Provider"][];
|
|
703
|
+
};
|
|
704
|
+
AnswerBox: {
|
|
705
|
+
title?: string;
|
|
706
|
+
answer?: string;
|
|
707
|
+
snippet?: string;
|
|
708
|
+
snippet_highlighted?: string[];
|
|
709
|
+
link?: string;
|
|
710
|
+
};
|
|
711
|
+
KnowledgeGraph: {
|
|
712
|
+
title?: string;
|
|
713
|
+
type?: string;
|
|
714
|
+
website?: string;
|
|
715
|
+
image_url?: string;
|
|
716
|
+
description?: string;
|
|
717
|
+
description_source?: string;
|
|
718
|
+
description_link?: string;
|
|
719
|
+
attributes?: {
|
|
720
|
+
[key: string]: string;
|
|
721
|
+
};
|
|
722
|
+
};
|
|
723
|
+
PeopleAlsoAsk: {
|
|
724
|
+
question: string;
|
|
725
|
+
snippet?: string;
|
|
726
|
+
title?: string;
|
|
727
|
+
link?: string;
|
|
728
|
+
};
|
|
729
|
+
RelatedSearch: {
|
|
730
|
+
query: string;
|
|
731
|
+
};
|
|
732
|
+
SearchResponse: {
|
|
733
|
+
request: components["schemas"]["RequestEcho"];
|
|
734
|
+
results: components["schemas"]["OrganicResult"][];
|
|
735
|
+
answer_box?: components["schemas"]["AnswerBox"];
|
|
736
|
+
knowledge_graph?: components["schemas"]["KnowledgeGraph"];
|
|
737
|
+
ads?: components["schemas"]["OrganicResult"][];
|
|
738
|
+
people_also_ask?: components["schemas"]["PeopleAlsoAsk"][];
|
|
739
|
+
related_searches: components["schemas"]["RelatedSearch"][];
|
|
740
|
+
top_stories?: components["schemas"]["NewsResult"][];
|
|
741
|
+
places?: components["schemas"]["PlaceResult"][];
|
|
742
|
+
meta: components["schemas"]["Meta"];
|
|
743
|
+
};
|
|
744
|
+
ImageResult: {
|
|
745
|
+
position: number;
|
|
746
|
+
title: string;
|
|
747
|
+
image_url: string;
|
|
748
|
+
image_width?: number;
|
|
749
|
+
image_height?: number;
|
|
750
|
+
thumbnail_url?: string;
|
|
751
|
+
source?: string;
|
|
752
|
+
domain?: string;
|
|
753
|
+
link?: string;
|
|
754
|
+
};
|
|
755
|
+
ImagesResponse: {
|
|
756
|
+
request: components["schemas"]["RequestEcho"];
|
|
757
|
+
results: components["schemas"]["ImageResult"][];
|
|
758
|
+
meta: components["schemas"]["Meta"];
|
|
759
|
+
};
|
|
760
|
+
VideoResult: {
|
|
761
|
+
position: number;
|
|
762
|
+
title: string;
|
|
763
|
+
link: string;
|
|
764
|
+
domain?: string;
|
|
765
|
+
snippet?: string;
|
|
766
|
+
image_url?: string;
|
|
767
|
+
duration?: string;
|
|
768
|
+
source?: string;
|
|
769
|
+
channel?: string;
|
|
770
|
+
date?: string;
|
|
771
|
+
};
|
|
772
|
+
VideosResponse: {
|
|
773
|
+
request: components["schemas"]["RequestEcho"];
|
|
774
|
+
results: components["schemas"]["VideoResult"][];
|
|
775
|
+
meta: components["schemas"]["Meta"];
|
|
776
|
+
};
|
|
777
|
+
NewsResult: {
|
|
778
|
+
position: number;
|
|
779
|
+
title: string;
|
|
780
|
+
link: string;
|
|
781
|
+
domain?: string;
|
|
782
|
+
snippet?: string;
|
|
783
|
+
date?: string;
|
|
784
|
+
source?: string;
|
|
785
|
+
image_url?: string;
|
|
786
|
+
};
|
|
787
|
+
NewsResponse: {
|
|
788
|
+
request: components["schemas"]["RequestEcho"];
|
|
789
|
+
results: components["schemas"]["NewsResult"][];
|
|
790
|
+
meta: components["schemas"]["Meta"];
|
|
791
|
+
};
|
|
792
|
+
PlaceResult: {
|
|
793
|
+
position: number;
|
|
794
|
+
title: string;
|
|
795
|
+
address?: string;
|
|
796
|
+
latitude?: number;
|
|
797
|
+
longitude?: number;
|
|
798
|
+
rating?: number;
|
|
799
|
+
rating_count?: number;
|
|
800
|
+
price_level?: string;
|
|
801
|
+
type?: string;
|
|
802
|
+
types?: string[];
|
|
803
|
+
website?: string;
|
|
804
|
+
phone_number?: string;
|
|
805
|
+
opening_hours?: {
|
|
806
|
+
[key: string]: string;
|
|
807
|
+
};
|
|
808
|
+
thumbnail_url?: string;
|
|
809
|
+
place_id?: string;
|
|
810
|
+
cid?: string;
|
|
811
|
+
fid?: string;
|
|
812
|
+
};
|
|
813
|
+
PlacesResponse: {
|
|
814
|
+
request: components["schemas"]["RequestEcho"];
|
|
815
|
+
results: components["schemas"]["PlaceResult"][];
|
|
816
|
+
meta: components["schemas"]["Meta"];
|
|
817
|
+
};
|
|
818
|
+
ReviewResult: {
|
|
819
|
+
rating?: number;
|
|
820
|
+
date?: string;
|
|
821
|
+
iso_date?: string;
|
|
822
|
+
snippet?: string;
|
|
823
|
+
likes?: number;
|
|
824
|
+
user?: {
|
|
825
|
+
name?: string;
|
|
826
|
+
thumbnail?: string;
|
|
827
|
+
reviews?: number;
|
|
828
|
+
};
|
|
829
|
+
response?: {
|
|
830
|
+
snippet?: string;
|
|
831
|
+
date?: string;
|
|
832
|
+
};
|
|
833
|
+
};
|
|
834
|
+
ReviewsResponse: {
|
|
835
|
+
request: components["schemas"]["RequestEcho"];
|
|
836
|
+
results: components["schemas"]["ReviewResult"][];
|
|
837
|
+
/** @description Pass as `page_token` for the next page. Absent on the last page and at the 100-review depth limit */
|
|
838
|
+
next_page_token?: string;
|
|
839
|
+
meta: components["schemas"]["Meta"];
|
|
840
|
+
};
|
|
841
|
+
ShoppingResult: {
|
|
842
|
+
position: number;
|
|
843
|
+
title: string;
|
|
844
|
+
source?: string;
|
|
845
|
+
link?: string;
|
|
846
|
+
price?: string;
|
|
847
|
+
price_value?: number;
|
|
848
|
+
currency?: string;
|
|
849
|
+
delivery?: string;
|
|
850
|
+
image_url?: string;
|
|
851
|
+
rating?: number;
|
|
852
|
+
rating_count?: number;
|
|
853
|
+
offers?: string;
|
|
854
|
+
product_id?: string;
|
|
855
|
+
};
|
|
856
|
+
ShoppingResponse: {
|
|
857
|
+
request: components["schemas"]["RequestEcho"];
|
|
858
|
+
results: components["schemas"]["ShoppingResult"][];
|
|
859
|
+
meta: components["schemas"]["Meta"];
|
|
860
|
+
};
|
|
861
|
+
ScholarResult: {
|
|
862
|
+
position: number;
|
|
863
|
+
title: string;
|
|
864
|
+
link: string;
|
|
865
|
+
domain?: string;
|
|
866
|
+
publication_info?: string;
|
|
867
|
+
snippet?: string;
|
|
868
|
+
year?: number;
|
|
869
|
+
cited_by?: number;
|
|
870
|
+
pdf_url?: string;
|
|
871
|
+
id?: string;
|
|
872
|
+
};
|
|
873
|
+
ScholarResponse: {
|
|
874
|
+
request: components["schemas"]["RequestEcho"];
|
|
875
|
+
results: components["schemas"]["ScholarResult"][];
|
|
876
|
+
meta: components["schemas"]["Meta"];
|
|
877
|
+
};
|
|
878
|
+
PatentResult: {
|
|
879
|
+
position: number;
|
|
880
|
+
title: string;
|
|
881
|
+
snippet?: string;
|
|
882
|
+
link: string;
|
|
883
|
+
publication_number?: string;
|
|
884
|
+
priority_date?: string;
|
|
885
|
+
filing_date?: string;
|
|
886
|
+
grant_date?: string;
|
|
887
|
+
publication_date?: string;
|
|
888
|
+
inventor?: string;
|
|
889
|
+
assignee?: string;
|
|
890
|
+
language?: string;
|
|
891
|
+
pdf_url?: string;
|
|
892
|
+
thumbnail_url?: string;
|
|
893
|
+
};
|
|
894
|
+
PatentsResponse: {
|
|
895
|
+
request: components["schemas"]["RequestEcho"];
|
|
896
|
+
results: components["schemas"]["PatentResult"][];
|
|
897
|
+
meta: components["schemas"]["Meta"];
|
|
898
|
+
};
|
|
899
|
+
Suggestion: {
|
|
900
|
+
value: string;
|
|
901
|
+
};
|
|
902
|
+
AutocompleteResponse: {
|
|
903
|
+
request: components["schemas"]["RequestEcho"];
|
|
904
|
+
results: components["schemas"]["Suggestion"][];
|
|
905
|
+
meta: components["schemas"]["Meta"];
|
|
906
|
+
};
|
|
907
|
+
LensResult: {
|
|
908
|
+
position: number;
|
|
909
|
+
title: string;
|
|
910
|
+
source?: string;
|
|
911
|
+
link: string;
|
|
912
|
+
domain?: string;
|
|
913
|
+
image_url?: string;
|
|
914
|
+
thumbnail_url?: string;
|
|
915
|
+
};
|
|
916
|
+
LensResponse: {
|
|
917
|
+
request: components["schemas"]["RequestEcho"];
|
|
918
|
+
results: components["schemas"]["LensResult"][];
|
|
919
|
+
meta: components["schemas"]["Meta"];
|
|
920
|
+
};
|
|
921
|
+
PageMetadata: {
|
|
922
|
+
title?: string;
|
|
923
|
+
description?: string;
|
|
924
|
+
language?: string;
|
|
925
|
+
canonical?: string;
|
|
926
|
+
site_name?: string;
|
|
927
|
+
image?: string;
|
|
928
|
+
published_time?: string;
|
|
929
|
+
author?: string;
|
|
930
|
+
};
|
|
931
|
+
WebpageResponse: {
|
|
932
|
+
request: components["schemas"]["RequestEcho"];
|
|
933
|
+
/** @description Final URL after redirects */
|
|
934
|
+
url: string;
|
|
935
|
+
status_code?: number;
|
|
936
|
+
markdown: string;
|
|
937
|
+
text?: string;
|
|
938
|
+
/** @description Only with include_html=true */
|
|
939
|
+
html?: string;
|
|
940
|
+
metadata: components["schemas"]["PageMetadata"];
|
|
941
|
+
meta: components["schemas"]["Meta"];
|
|
942
|
+
};
|
|
943
|
+
CSEResponse: {
|
|
944
|
+
/** @constant */
|
|
945
|
+
kind: "customsearch#search";
|
|
946
|
+
url?: Record<string, never>;
|
|
947
|
+
queries?: {
|
|
948
|
+
[key: string]: unknown;
|
|
949
|
+
};
|
|
950
|
+
context?: Record<string, never>;
|
|
951
|
+
searchInformation: {
|
|
952
|
+
searchTime?: number;
|
|
953
|
+
formattedSearchTime?: string;
|
|
954
|
+
totalResults?: string;
|
|
955
|
+
formattedTotalResults?: string;
|
|
956
|
+
};
|
|
957
|
+
items: {
|
|
958
|
+
/** @constant */
|
|
959
|
+
kind?: "customsearch#result";
|
|
960
|
+
title?: string;
|
|
961
|
+
htmlTitle?: string;
|
|
962
|
+
link?: string;
|
|
963
|
+
displayLink?: string;
|
|
964
|
+
snippet?: string;
|
|
965
|
+
htmlSnippet?: string;
|
|
966
|
+
formattedUrl?: string;
|
|
967
|
+
htmlFormattedUrl?: string;
|
|
968
|
+
pagemap?: {
|
|
969
|
+
[key: string]: unknown;
|
|
970
|
+
};
|
|
971
|
+
image?: {
|
|
972
|
+
[key: string]: unknown;
|
|
973
|
+
};
|
|
974
|
+
}[];
|
|
975
|
+
};
|
|
976
|
+
RankRequest: {
|
|
977
|
+
q: string;
|
|
978
|
+
/** @description Domain to find, e.g. "example.com" (subdomains match) */
|
|
979
|
+
domain: string;
|
|
980
|
+
/**
|
|
981
|
+
* @default 100
|
|
982
|
+
* @enum {integer}
|
|
983
|
+
*/
|
|
984
|
+
num?: 10 | 20 | 30 | 50 | 100;
|
|
985
|
+
country?: string;
|
|
986
|
+
language?: string;
|
|
987
|
+
location?: string;
|
|
988
|
+
/** @enum {string} */
|
|
989
|
+
device?: "desktop" | "mobile";
|
|
990
|
+
max_age?: number;
|
|
991
|
+
};
|
|
992
|
+
RankResponse: {
|
|
993
|
+
request: components["schemas"]["RequestEcho"];
|
|
994
|
+
domain: string;
|
|
995
|
+
/** @description Best organic position */
|
|
996
|
+
position: number | null;
|
|
997
|
+
matches: {
|
|
998
|
+
position: number;
|
|
999
|
+
title: string;
|
|
1000
|
+
link: string;
|
|
1001
|
+
}[];
|
|
1002
|
+
/** @description Organic results inspected */
|
|
1003
|
+
checked: number;
|
|
1004
|
+
meta: components["schemas"]["Meta"];
|
|
1005
|
+
};
|
|
1006
|
+
Status: {
|
|
1007
|
+
/** @enum {string} */
|
|
1008
|
+
status: "operational" | "degraded";
|
|
1009
|
+
window_minutes: number;
|
|
1010
|
+
/** Format: date-time */
|
|
1011
|
+
updated_at: string;
|
|
1012
|
+
endpoints: {
|
|
1013
|
+
endpoint: string;
|
|
1014
|
+
requests: number;
|
|
1015
|
+
/** @description Share of requests without a 5xx (0-1) */
|
|
1016
|
+
success_rate: number;
|
|
1017
|
+
p50_ms: number;
|
|
1018
|
+
p95_ms: number;
|
|
1019
|
+
}[];
|
|
1020
|
+
};
|
|
1021
|
+
BatchCreateRequest: {
|
|
1022
|
+
/** @enum {string} */
|
|
1023
|
+
endpoint: "search" | "images" | "videos" | "news" | "maps" | "places" | "reviews" | "shopping" | "scholar" | "patents" | "autocomplete" | "lens" | "webpage";
|
|
1024
|
+
/** @description Request bodies for `endpoint` (same fields as the realtime endpoint) */
|
|
1025
|
+
requests: {
|
|
1026
|
+
[key: string]: unknown;
|
|
1027
|
+
}[];
|
|
1028
|
+
/**
|
|
1029
|
+
* Format: uri
|
|
1030
|
+
* @description POSTed each job's result, always signed with X-SerpKite-Signature (v1=hex HMAC-SHA256 of `<timestamp>.<body>` with the account webhook secret; see createBatches). Defaults to the account webhook
|
|
1031
|
+
*/
|
|
1032
|
+
webhook_url?: string;
|
|
1033
|
+
};
|
|
1034
|
+
BatchCreateResponse: {
|
|
1035
|
+
batches: (components["schemas"]["Batch"] | components["schemas"]["Error"])[];
|
|
1036
|
+
};
|
|
1037
|
+
Batch: {
|
|
1038
|
+
/** Format: uuid */
|
|
1039
|
+
id: string;
|
|
1040
|
+
/** @enum {string} */
|
|
1041
|
+
status: "queued" | "running" | "done" | "failed";
|
|
1042
|
+
/** @example /v1/search */
|
|
1043
|
+
endpoint: string;
|
|
1044
|
+
/** Format: date-time */
|
|
1045
|
+
created_at: string;
|
|
1046
|
+
/** Format: date-time */
|
|
1047
|
+
completed_at?: string | null;
|
|
1048
|
+
credits_used?: number;
|
|
1049
|
+
poll_url: string;
|
|
1050
|
+
webhook_url?: string | null;
|
|
1051
|
+
/** @enum {string|null} */
|
|
1052
|
+
webhook_status?: "pending" | "delivered" | "failed" | null;
|
|
1053
|
+
error?: {
|
|
1054
|
+
code?: string;
|
|
1055
|
+
message?: string;
|
|
1056
|
+
} | null;
|
|
1057
|
+
/** @description Present when done; kept 24h. The endpoint's response body, or {markdown, meta} for format=markdown jobs */
|
|
1058
|
+
result?: {
|
|
1059
|
+
[key: string]: unknown;
|
|
1060
|
+
} | null;
|
|
1061
|
+
};
|
|
1062
|
+
Account: {
|
|
1063
|
+
/** @description Negative after a refund of credits that were already spent; requests then get 402 insufficient_credits */
|
|
1064
|
+
balance: number;
|
|
1065
|
+
rate_limit_rps: number;
|
|
1066
|
+
/** @enum {string} */
|
|
1067
|
+
plan: "free" | "paid";
|
|
1068
|
+
key?: {
|
|
1069
|
+
id?: string;
|
|
1070
|
+
name?: string;
|
|
1071
|
+
credit_limit?: number | null;
|
|
1072
|
+
credits_used_month?: number;
|
|
1073
|
+
};
|
|
1074
|
+
monthly_spend_cap?: number | null;
|
|
1075
|
+
month: {
|
|
1076
|
+
credits: number;
|
|
1077
|
+
requests: number;
|
|
1078
|
+
};
|
|
1079
|
+
};
|
|
1080
|
+
};
|
|
1081
|
+
responses: {
|
|
1082
|
+
/** @description Error */
|
|
1083
|
+
Error: {
|
|
1084
|
+
headers: {
|
|
1085
|
+
[name: string]: unknown;
|
|
1086
|
+
};
|
|
1087
|
+
content: {
|
|
1088
|
+
"application/json": components["schemas"]["Error"];
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
/**
|
|
1092
|
+
* @description Temporarily unavailable, not billed, safe to retry after `Retry-After`.
|
|
1093
|
+
* Codes: `upstream_error` (the upstream page couldn't be fetched or parsed),
|
|
1094
|
+
* `upstream_blocked` (the upstream is rate limiting us), `upstream_timeout`
|
|
1095
|
+
* (the search took too long), `unavailable` (endpoint or dependency down).
|
|
1096
|
+
* The API never sends 502 or 504.
|
|
1097
|
+
*/
|
|
1098
|
+
Unavailable: {
|
|
1099
|
+
headers: {
|
|
1100
|
+
"Retry-After": components["headers"]["RetryAfter"];
|
|
1101
|
+
[name: string]: unknown;
|
|
1102
|
+
};
|
|
1103
|
+
content: {
|
|
1104
|
+
"application/json": components["schemas"]["Error"];
|
|
1105
|
+
};
|
|
1106
|
+
};
|
|
1107
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1108
|
+
SearchOK: {
|
|
1109
|
+
headers: {
|
|
1110
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1111
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1112
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1113
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1114
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1115
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1116
|
+
[name: string]: unknown;
|
|
1117
|
+
};
|
|
1118
|
+
content: {
|
|
1119
|
+
"application/json": components["schemas"]["SearchResponse"];
|
|
1120
|
+
"text/markdown": string;
|
|
1121
|
+
};
|
|
1122
|
+
};
|
|
1123
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1124
|
+
ImagesOK: {
|
|
1125
|
+
headers: {
|
|
1126
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1127
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1128
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1129
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1130
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1131
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1132
|
+
[name: string]: unknown;
|
|
1133
|
+
};
|
|
1134
|
+
content: {
|
|
1135
|
+
"application/json": components["schemas"]["ImagesResponse"];
|
|
1136
|
+
"text/markdown": string;
|
|
1137
|
+
};
|
|
1138
|
+
};
|
|
1139
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1140
|
+
VideosOK: {
|
|
1141
|
+
headers: {
|
|
1142
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1143
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1144
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1145
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1146
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1147
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1148
|
+
[name: string]: unknown;
|
|
1149
|
+
};
|
|
1150
|
+
content: {
|
|
1151
|
+
"application/json": components["schemas"]["VideosResponse"];
|
|
1152
|
+
"text/markdown": string;
|
|
1153
|
+
};
|
|
1154
|
+
};
|
|
1155
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1156
|
+
NewsOK: {
|
|
1157
|
+
headers: {
|
|
1158
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1159
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1160
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1161
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1162
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1163
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1164
|
+
[name: string]: unknown;
|
|
1165
|
+
};
|
|
1166
|
+
content: {
|
|
1167
|
+
"application/json": components["schemas"]["NewsResponse"];
|
|
1168
|
+
"text/markdown": string;
|
|
1169
|
+
};
|
|
1170
|
+
};
|
|
1171
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1172
|
+
PlacesOK: {
|
|
1173
|
+
headers: {
|
|
1174
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1175
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1176
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1177
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1178
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1179
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1180
|
+
[name: string]: unknown;
|
|
1181
|
+
};
|
|
1182
|
+
content: {
|
|
1183
|
+
"application/json": components["schemas"]["PlacesResponse"];
|
|
1184
|
+
"text/markdown": string;
|
|
1185
|
+
};
|
|
1186
|
+
};
|
|
1187
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1188
|
+
ReviewsOK: {
|
|
1189
|
+
headers: {
|
|
1190
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1191
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1192
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1193
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1194
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1195
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1196
|
+
[name: string]: unknown;
|
|
1197
|
+
};
|
|
1198
|
+
content: {
|
|
1199
|
+
"application/json": components["schemas"]["ReviewsResponse"];
|
|
1200
|
+
"text/markdown": string;
|
|
1201
|
+
};
|
|
1202
|
+
};
|
|
1203
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1204
|
+
ShoppingOK: {
|
|
1205
|
+
headers: {
|
|
1206
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1207
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1208
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1209
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1210
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1211
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1212
|
+
[name: string]: unknown;
|
|
1213
|
+
};
|
|
1214
|
+
content: {
|
|
1215
|
+
"application/json": components["schemas"]["ShoppingResponse"];
|
|
1216
|
+
"text/markdown": string;
|
|
1217
|
+
};
|
|
1218
|
+
};
|
|
1219
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1220
|
+
ScholarOK: {
|
|
1221
|
+
headers: {
|
|
1222
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1223
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1224
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1225
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1226
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1227
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1228
|
+
[name: string]: unknown;
|
|
1229
|
+
};
|
|
1230
|
+
content: {
|
|
1231
|
+
"application/json": components["schemas"]["ScholarResponse"];
|
|
1232
|
+
"text/markdown": string;
|
|
1233
|
+
};
|
|
1234
|
+
};
|
|
1235
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1236
|
+
PatentsOK: {
|
|
1237
|
+
headers: {
|
|
1238
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1239
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1240
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1241
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1242
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1243
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1244
|
+
[name: string]: unknown;
|
|
1245
|
+
};
|
|
1246
|
+
content: {
|
|
1247
|
+
"application/json": components["schemas"]["PatentsResponse"];
|
|
1248
|
+
"text/markdown": string;
|
|
1249
|
+
};
|
|
1250
|
+
};
|
|
1251
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1252
|
+
AutocompleteOK: {
|
|
1253
|
+
headers: {
|
|
1254
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1255
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1256
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1257
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1258
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1259
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1260
|
+
[name: string]: unknown;
|
|
1261
|
+
};
|
|
1262
|
+
content: {
|
|
1263
|
+
"application/json": components["schemas"]["AutocompleteResponse"];
|
|
1264
|
+
"text/markdown": string;
|
|
1265
|
+
};
|
|
1266
|
+
};
|
|
1267
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1268
|
+
LensOK: {
|
|
1269
|
+
headers: {
|
|
1270
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1271
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1272
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1273
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1274
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1275
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1276
|
+
[name: string]: unknown;
|
|
1277
|
+
};
|
|
1278
|
+
content: {
|
|
1279
|
+
"application/json": components["schemas"]["LensResponse"];
|
|
1280
|
+
"text/markdown": string;
|
|
1281
|
+
};
|
|
1282
|
+
};
|
|
1283
|
+
/** @description OK (text/markdown when format=markdown) */
|
|
1284
|
+
WebpageOK: {
|
|
1285
|
+
headers: {
|
|
1286
|
+
"X-Credits-Used": components["headers"]["CreditsUsed"];
|
|
1287
|
+
"X-Credits-Remaining": components["headers"]["CreditsRemaining"];
|
|
1288
|
+
"X-Cost-USD": components["headers"]["CostUSD"];
|
|
1289
|
+
"X-Cache": components["headers"]["Cache"];
|
|
1290
|
+
"X-Latency-Ms": components["headers"]["LatencyMs"];
|
|
1291
|
+
"X-Tokens-Estimate": components["headers"]["TokensEstimate"];
|
|
1292
|
+
[name: string]: unknown;
|
|
1293
|
+
};
|
|
1294
|
+
content: {
|
|
1295
|
+
"application/json": components["schemas"]["WebpageResponse"];
|
|
1296
|
+
"text/markdown": string;
|
|
1297
|
+
};
|
|
1298
|
+
};
|
|
1299
|
+
};
|
|
1300
|
+
parameters: never;
|
|
1301
|
+
requestBodies: {
|
|
1302
|
+
Search: {
|
|
1303
|
+
content: {
|
|
1304
|
+
"application/json": components["schemas"]["SearchRequest"];
|
|
1305
|
+
};
|
|
1306
|
+
};
|
|
1307
|
+
};
|
|
1308
|
+
headers: {
|
|
1309
|
+
CreditsUsed: number;
|
|
1310
|
+
CreditsRemaining: number;
|
|
1311
|
+
CostUSD: number;
|
|
1312
|
+
Cache: "HIT" | "MISS";
|
|
1313
|
+
LatencyMs: number;
|
|
1314
|
+
TokensEstimate: number;
|
|
1315
|
+
/** @description Seconds to wait before retrying */
|
|
1316
|
+
RetryAfter: number;
|
|
1317
|
+
};
|
|
1318
|
+
pathItems: never;
|
|
1319
|
+
}
|
|
1320
|
+
interface operations {
|
|
1321
|
+
searchGet: {
|
|
1322
|
+
parameters: {
|
|
1323
|
+
query: {
|
|
1324
|
+
q: string;
|
|
1325
|
+
country?: string;
|
|
1326
|
+
language?: string;
|
|
1327
|
+
location?: string;
|
|
1328
|
+
num?: number;
|
|
1329
|
+
page?: number;
|
|
1330
|
+
uule?: string;
|
|
1331
|
+
ll?: string;
|
|
1332
|
+
time?: string;
|
|
1333
|
+
tbs?: string;
|
|
1334
|
+
device?: string;
|
|
1335
|
+
safe?: string;
|
|
1336
|
+
autocorrect?: boolean;
|
|
1337
|
+
format?: string;
|
|
1338
|
+
fields?: string;
|
|
1339
|
+
include_content?: number;
|
|
1340
|
+
ads?: boolean;
|
|
1341
|
+
max_age?: number;
|
|
1342
|
+
/** @description google (default), auto, consensus, one provider, or a comma-separated list (e.g. google,brave) */
|
|
1343
|
+
engine?: string;
|
|
1344
|
+
api_key?: string;
|
|
1345
|
+
};
|
|
1346
|
+
header?: never;
|
|
1347
|
+
path?: never;
|
|
1348
|
+
cookie?: never;
|
|
1349
|
+
};
|
|
1350
|
+
requestBody?: never;
|
|
1351
|
+
responses: {
|
|
1352
|
+
200: components["responses"]["SearchOK"];
|
|
1353
|
+
400: components["responses"]["Error"];
|
|
1354
|
+
401: components["responses"]["Error"];
|
|
1355
|
+
402: components["responses"]["Error"];
|
|
1356
|
+
403: components["responses"]["Error"];
|
|
1357
|
+
429: components["responses"]["Error"];
|
|
1358
|
+
503: components["responses"]["Unavailable"];
|
|
1359
|
+
};
|
|
1360
|
+
};
|
|
1361
|
+
search: {
|
|
1362
|
+
parameters: {
|
|
1363
|
+
query?: never;
|
|
1364
|
+
header?: never;
|
|
1365
|
+
path?: never;
|
|
1366
|
+
cookie?: never;
|
|
1367
|
+
};
|
|
1368
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1369
|
+
responses: {
|
|
1370
|
+
200: components["responses"]["SearchOK"];
|
|
1371
|
+
400: components["responses"]["Error"];
|
|
1372
|
+
401: components["responses"]["Error"];
|
|
1373
|
+
402: components["responses"]["Error"];
|
|
1374
|
+
403: components["responses"]["Error"];
|
|
1375
|
+
429: components["responses"]["Error"];
|
|
1376
|
+
503: components["responses"]["Unavailable"];
|
|
1377
|
+
};
|
|
1378
|
+
};
|
|
1379
|
+
images: {
|
|
1380
|
+
parameters: {
|
|
1381
|
+
query?: never;
|
|
1382
|
+
header?: never;
|
|
1383
|
+
path?: never;
|
|
1384
|
+
cookie?: never;
|
|
1385
|
+
};
|
|
1386
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1387
|
+
responses: {
|
|
1388
|
+
200: components["responses"]["ImagesOK"];
|
|
1389
|
+
400: components["responses"]["Error"];
|
|
1390
|
+
401: components["responses"]["Error"];
|
|
1391
|
+
402: components["responses"]["Error"];
|
|
1392
|
+
403: components["responses"]["Error"];
|
|
1393
|
+
429: components["responses"]["Error"];
|
|
1394
|
+
503: components["responses"]["Unavailable"];
|
|
1395
|
+
};
|
|
1396
|
+
};
|
|
1397
|
+
videos: {
|
|
1398
|
+
parameters: {
|
|
1399
|
+
query?: never;
|
|
1400
|
+
header?: never;
|
|
1401
|
+
path?: never;
|
|
1402
|
+
cookie?: never;
|
|
1403
|
+
};
|
|
1404
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1405
|
+
responses: {
|
|
1406
|
+
200: components["responses"]["VideosOK"];
|
|
1407
|
+
400: components["responses"]["Error"];
|
|
1408
|
+
401: components["responses"]["Error"];
|
|
1409
|
+
402: components["responses"]["Error"];
|
|
1410
|
+
403: components["responses"]["Error"];
|
|
1411
|
+
429: components["responses"]["Error"];
|
|
1412
|
+
503: components["responses"]["Unavailable"];
|
|
1413
|
+
};
|
|
1414
|
+
};
|
|
1415
|
+
news: {
|
|
1416
|
+
parameters: {
|
|
1417
|
+
query?: never;
|
|
1418
|
+
header?: never;
|
|
1419
|
+
path?: never;
|
|
1420
|
+
cookie?: never;
|
|
1421
|
+
};
|
|
1422
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1423
|
+
responses: {
|
|
1424
|
+
200: components["responses"]["NewsOK"];
|
|
1425
|
+
400: components["responses"]["Error"];
|
|
1426
|
+
401: components["responses"]["Error"];
|
|
1427
|
+
402: components["responses"]["Error"];
|
|
1428
|
+
403: components["responses"]["Error"];
|
|
1429
|
+
429: components["responses"]["Error"];
|
|
1430
|
+
503: components["responses"]["Unavailable"];
|
|
1431
|
+
};
|
|
1432
|
+
};
|
|
1433
|
+
maps: {
|
|
1434
|
+
parameters: {
|
|
1435
|
+
query?: never;
|
|
1436
|
+
header?: never;
|
|
1437
|
+
path?: never;
|
|
1438
|
+
cookie?: never;
|
|
1439
|
+
};
|
|
1440
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1441
|
+
responses: {
|
|
1442
|
+
200: components["responses"]["PlacesOK"];
|
|
1443
|
+
400: components["responses"]["Error"];
|
|
1444
|
+
401: components["responses"]["Error"];
|
|
1445
|
+
402: components["responses"]["Error"];
|
|
1446
|
+
403: components["responses"]["Error"];
|
|
1447
|
+
429: components["responses"]["Error"];
|
|
1448
|
+
503: components["responses"]["Unavailable"];
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1451
|
+
places: {
|
|
1452
|
+
parameters: {
|
|
1453
|
+
query?: never;
|
|
1454
|
+
header?: never;
|
|
1455
|
+
path?: never;
|
|
1456
|
+
cookie?: never;
|
|
1457
|
+
};
|
|
1458
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1459
|
+
responses: {
|
|
1460
|
+
200: components["responses"]["PlacesOK"];
|
|
1461
|
+
400: components["responses"]["Error"];
|
|
1462
|
+
401: components["responses"]["Error"];
|
|
1463
|
+
402: components["responses"]["Error"];
|
|
1464
|
+
403: components["responses"]["Error"];
|
|
1465
|
+
429: components["responses"]["Error"];
|
|
1466
|
+
503: components["responses"]["Unavailable"];
|
|
1467
|
+
};
|
|
1468
|
+
};
|
|
1469
|
+
reviews: {
|
|
1470
|
+
parameters: {
|
|
1471
|
+
query?: never;
|
|
1472
|
+
header?: never;
|
|
1473
|
+
path?: never;
|
|
1474
|
+
cookie?: never;
|
|
1475
|
+
};
|
|
1476
|
+
requestBody: {
|
|
1477
|
+
content: {
|
|
1478
|
+
"application/json": components["schemas"]["ReviewsRequest"];
|
|
1479
|
+
};
|
|
1480
|
+
};
|
|
1481
|
+
responses: {
|
|
1482
|
+
200: components["responses"]["ReviewsOK"];
|
|
1483
|
+
400: components["responses"]["Error"];
|
|
1484
|
+
401: components["responses"]["Error"];
|
|
1485
|
+
402: components["responses"]["Error"];
|
|
1486
|
+
403: components["responses"]["Error"];
|
|
1487
|
+
429: components["responses"]["Error"];
|
|
1488
|
+
503: components["responses"]["Unavailable"];
|
|
1489
|
+
};
|
|
1490
|
+
};
|
|
1491
|
+
shopping: {
|
|
1492
|
+
parameters: {
|
|
1493
|
+
query?: never;
|
|
1494
|
+
header?: never;
|
|
1495
|
+
path?: never;
|
|
1496
|
+
cookie?: never;
|
|
1497
|
+
};
|
|
1498
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1499
|
+
responses: {
|
|
1500
|
+
200: components["responses"]["ShoppingOK"];
|
|
1501
|
+
400: components["responses"]["Error"];
|
|
1502
|
+
401: components["responses"]["Error"];
|
|
1503
|
+
402: components["responses"]["Error"];
|
|
1504
|
+
403: components["responses"]["Error"];
|
|
1505
|
+
429: components["responses"]["Error"];
|
|
1506
|
+
503: components["responses"]["Unavailable"];
|
|
1507
|
+
};
|
|
1508
|
+
};
|
|
1509
|
+
scholar: {
|
|
1510
|
+
parameters: {
|
|
1511
|
+
query?: never;
|
|
1512
|
+
header?: never;
|
|
1513
|
+
path?: never;
|
|
1514
|
+
cookie?: never;
|
|
1515
|
+
};
|
|
1516
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1517
|
+
responses: {
|
|
1518
|
+
200: components["responses"]["ScholarOK"];
|
|
1519
|
+
400: components["responses"]["Error"];
|
|
1520
|
+
401: components["responses"]["Error"];
|
|
1521
|
+
402: components["responses"]["Error"];
|
|
1522
|
+
403: components["responses"]["Error"];
|
|
1523
|
+
429: components["responses"]["Error"];
|
|
1524
|
+
503: components["responses"]["Unavailable"];
|
|
1525
|
+
};
|
|
1526
|
+
};
|
|
1527
|
+
patents: {
|
|
1528
|
+
parameters: {
|
|
1529
|
+
query?: never;
|
|
1530
|
+
header?: never;
|
|
1531
|
+
path?: never;
|
|
1532
|
+
cookie?: never;
|
|
1533
|
+
};
|
|
1534
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1535
|
+
responses: {
|
|
1536
|
+
200: components["responses"]["PatentsOK"];
|
|
1537
|
+
400: components["responses"]["Error"];
|
|
1538
|
+
401: components["responses"]["Error"];
|
|
1539
|
+
402: components["responses"]["Error"];
|
|
1540
|
+
403: components["responses"]["Error"];
|
|
1541
|
+
429: components["responses"]["Error"];
|
|
1542
|
+
503: components["responses"]["Unavailable"];
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
autocomplete: {
|
|
1546
|
+
parameters: {
|
|
1547
|
+
query?: never;
|
|
1548
|
+
header?: never;
|
|
1549
|
+
path?: never;
|
|
1550
|
+
cookie?: never;
|
|
1551
|
+
};
|
|
1552
|
+
requestBody: components["requestBodies"]["Search"];
|
|
1553
|
+
responses: {
|
|
1554
|
+
200: components["responses"]["AutocompleteOK"];
|
|
1555
|
+
400: components["responses"]["Error"];
|
|
1556
|
+
401: components["responses"]["Error"];
|
|
1557
|
+
402: components["responses"]["Error"];
|
|
1558
|
+
403: components["responses"]["Error"];
|
|
1559
|
+
429: components["responses"]["Error"];
|
|
1560
|
+
503: components["responses"]["Unavailable"];
|
|
1561
|
+
};
|
|
1562
|
+
};
|
|
1563
|
+
lens: {
|
|
1564
|
+
parameters: {
|
|
1565
|
+
query?: never;
|
|
1566
|
+
header?: never;
|
|
1567
|
+
path?: never;
|
|
1568
|
+
cookie?: never;
|
|
1569
|
+
};
|
|
1570
|
+
requestBody: {
|
|
1571
|
+
content: {
|
|
1572
|
+
"application/json": components["schemas"]["LensRequest"];
|
|
1573
|
+
};
|
|
1574
|
+
};
|
|
1575
|
+
responses: {
|
|
1576
|
+
200: components["responses"]["LensOK"];
|
|
1577
|
+
400: components["responses"]["Error"];
|
|
1578
|
+
401: components["responses"]["Error"];
|
|
1579
|
+
402: components["responses"]["Error"];
|
|
1580
|
+
403: components["responses"]["Error"];
|
|
1581
|
+
429: components["responses"]["Error"];
|
|
1582
|
+
503: components["responses"]["Unavailable"];
|
|
1583
|
+
};
|
|
1584
|
+
};
|
|
1585
|
+
webpage: {
|
|
1586
|
+
parameters: {
|
|
1587
|
+
query?: never;
|
|
1588
|
+
header?: never;
|
|
1589
|
+
path?: never;
|
|
1590
|
+
cookie?: never;
|
|
1591
|
+
};
|
|
1592
|
+
requestBody: {
|
|
1593
|
+
content: {
|
|
1594
|
+
"application/json": components["schemas"]["WebpageRequest"];
|
|
1595
|
+
};
|
|
1596
|
+
};
|
|
1597
|
+
responses: {
|
|
1598
|
+
200: components["responses"]["WebpageOK"];
|
|
1599
|
+
400: components["responses"]["Error"];
|
|
1600
|
+
401: components["responses"]["Error"];
|
|
1601
|
+
402: components["responses"]["Error"];
|
|
1602
|
+
403: components["responses"]["Error"];
|
|
1603
|
+
429: components["responses"]["Error"];
|
|
1604
|
+
503: components["responses"]["Unavailable"];
|
|
1605
|
+
};
|
|
1606
|
+
};
|
|
1607
|
+
customSearch: {
|
|
1608
|
+
parameters: {
|
|
1609
|
+
query: {
|
|
1610
|
+
/** @description API key (or Authorization Bearer) */
|
|
1611
|
+
key?: string;
|
|
1612
|
+
/** @description Accepted and ignored */
|
|
1613
|
+
cx?: string;
|
|
1614
|
+
q: string;
|
|
1615
|
+
start?: number;
|
|
1616
|
+
num?: number;
|
|
1617
|
+
gl?: string;
|
|
1618
|
+
hl?: string;
|
|
1619
|
+
lr?: string;
|
|
1620
|
+
safe?: "active" | "off";
|
|
1621
|
+
dateRestrict?: string;
|
|
1622
|
+
siteSearch?: string;
|
|
1623
|
+
searchType?: "image";
|
|
1624
|
+
};
|
|
1625
|
+
header?: never;
|
|
1626
|
+
path?: never;
|
|
1627
|
+
cookie?: never;
|
|
1628
|
+
};
|
|
1629
|
+
requestBody?: never;
|
|
1630
|
+
responses: {
|
|
1631
|
+
/** @description CSE-shaped response */
|
|
1632
|
+
200: {
|
|
1633
|
+
headers: {
|
|
1634
|
+
[name: string]: unknown;
|
|
1635
|
+
};
|
|
1636
|
+
content: {
|
|
1637
|
+
"application/json": components["schemas"]["CSEResponse"];
|
|
1638
|
+
};
|
|
1639
|
+
};
|
|
1640
|
+
400: components["responses"]["Error"];
|
|
1641
|
+
401: components["responses"]["Error"];
|
|
1642
|
+
402: components["responses"]["Error"];
|
|
1643
|
+
429: components["responses"]["Error"];
|
|
1644
|
+
503: components["responses"]["Unavailable"];
|
|
1645
|
+
};
|
|
1646
|
+
};
|
|
1647
|
+
rank: {
|
|
1648
|
+
parameters: {
|
|
1649
|
+
query?: never;
|
|
1650
|
+
header?: never;
|
|
1651
|
+
path?: never;
|
|
1652
|
+
cookie?: never;
|
|
1653
|
+
};
|
|
1654
|
+
requestBody: {
|
|
1655
|
+
content: {
|
|
1656
|
+
"application/json": components["schemas"]["RankRequest"];
|
|
1657
|
+
};
|
|
1658
|
+
};
|
|
1659
|
+
responses: {
|
|
1660
|
+
/** @description OK */
|
|
1661
|
+
200: {
|
|
1662
|
+
headers: {
|
|
1663
|
+
[name: string]: unknown;
|
|
1664
|
+
};
|
|
1665
|
+
content: {
|
|
1666
|
+
"application/json": components["schemas"]["RankResponse"];
|
|
1667
|
+
};
|
|
1668
|
+
};
|
|
1669
|
+
400: components["responses"]["Error"];
|
|
1670
|
+
401: components["responses"]["Error"];
|
|
1671
|
+
402: components["responses"]["Error"];
|
|
1672
|
+
403: components["responses"]["Error"];
|
|
1673
|
+
429: components["responses"]["Error"];
|
|
1674
|
+
503: components["responses"]["Unavailable"];
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
status: {
|
|
1678
|
+
parameters: {
|
|
1679
|
+
query?: never;
|
|
1680
|
+
header?: never;
|
|
1681
|
+
path?: never;
|
|
1682
|
+
cookie?: never;
|
|
1683
|
+
};
|
|
1684
|
+
requestBody?: never;
|
|
1685
|
+
responses: {
|
|
1686
|
+
/** @description OK */
|
|
1687
|
+
200: {
|
|
1688
|
+
headers: {
|
|
1689
|
+
[name: string]: unknown;
|
|
1690
|
+
};
|
|
1691
|
+
content: {
|
|
1692
|
+
"application/json": components["schemas"]["Status"];
|
|
1693
|
+
};
|
|
1694
|
+
};
|
|
1695
|
+
};
|
|
1696
|
+
};
|
|
1697
|
+
createBatches: {
|
|
1698
|
+
parameters: {
|
|
1699
|
+
query?: never;
|
|
1700
|
+
header?: {
|
|
1701
|
+
/** @description 1-255 printable ASCII characters (e.g. a UUID). Retries with the same key and body replay the first response for 24 h */
|
|
1702
|
+
"Idempotency-Key"?: string;
|
|
1703
|
+
};
|
|
1704
|
+
path?: never;
|
|
1705
|
+
cookie?: never;
|
|
1706
|
+
};
|
|
1707
|
+
requestBody: {
|
|
1708
|
+
content: {
|
|
1709
|
+
"application/json": components["schemas"]["BatchCreateRequest"];
|
|
1710
|
+
};
|
|
1711
|
+
};
|
|
1712
|
+
responses: {
|
|
1713
|
+
/** @description Queued. One entry per request, in order; an entry is a batch job or an error object */
|
|
1714
|
+
202: {
|
|
1715
|
+
headers: {
|
|
1716
|
+
/** @description `true` when this is the stored response of an earlier call with the same Idempotency-Key */
|
|
1717
|
+
"Idempotent-Replayed"?: "true";
|
|
1718
|
+
[name: string]: unknown;
|
|
1719
|
+
};
|
|
1720
|
+
content: {
|
|
1721
|
+
"application/json": components["schemas"]["BatchCreateResponse"];
|
|
1722
|
+
};
|
|
1723
|
+
};
|
|
1724
|
+
400: components["responses"]["Error"];
|
|
1725
|
+
401: components["responses"]["Error"];
|
|
1726
|
+
402: components["responses"]["Error"];
|
|
1727
|
+
403: components["responses"]["Error"];
|
|
1728
|
+
409: components["responses"]["Error"];
|
|
1729
|
+
422: components["responses"]["Error"];
|
|
1730
|
+
429: components["responses"]["Error"];
|
|
1731
|
+
503: components["responses"]["Unavailable"];
|
|
1732
|
+
};
|
|
1733
|
+
};
|
|
1734
|
+
getBatch: {
|
|
1735
|
+
parameters: {
|
|
1736
|
+
query?: never;
|
|
1737
|
+
header?: never;
|
|
1738
|
+
path: {
|
|
1739
|
+
id: string;
|
|
1740
|
+
};
|
|
1741
|
+
cookie?: never;
|
|
1742
|
+
};
|
|
1743
|
+
requestBody?: never;
|
|
1744
|
+
responses: {
|
|
1745
|
+
/** @description OK */
|
|
1746
|
+
200: {
|
|
1747
|
+
headers: {
|
|
1748
|
+
[name: string]: unknown;
|
|
1749
|
+
};
|
|
1750
|
+
content: {
|
|
1751
|
+
"application/json": components["schemas"]["Batch"];
|
|
1752
|
+
};
|
|
1753
|
+
};
|
|
1754
|
+
401: components["responses"]["Error"];
|
|
1755
|
+
404: components["responses"]["Error"];
|
|
1756
|
+
429: components["responses"]["Error"];
|
|
1757
|
+
};
|
|
1758
|
+
};
|
|
1759
|
+
account: {
|
|
1760
|
+
parameters: {
|
|
1761
|
+
query?: never;
|
|
1762
|
+
header?: never;
|
|
1763
|
+
path?: never;
|
|
1764
|
+
cookie?: never;
|
|
1765
|
+
};
|
|
1766
|
+
requestBody?: never;
|
|
1767
|
+
responses: {
|
|
1768
|
+
/** @description OK */
|
|
1769
|
+
200: {
|
|
1770
|
+
headers: {
|
|
1771
|
+
[name: string]: unknown;
|
|
1772
|
+
};
|
|
1773
|
+
content: {
|
|
1774
|
+
"application/json": components["schemas"]["Account"];
|
|
1775
|
+
};
|
|
1776
|
+
};
|
|
1777
|
+
401: components["responses"]["Error"];
|
|
1778
|
+
429: components["responses"]["Error"];
|
|
1779
|
+
};
|
|
1780
|
+
};
|
|
1781
|
+
playground: {
|
|
1782
|
+
parameters: {
|
|
1783
|
+
query?: never;
|
|
1784
|
+
header?: never;
|
|
1785
|
+
path?: never;
|
|
1786
|
+
cookie?: never;
|
|
1787
|
+
};
|
|
1788
|
+
requestBody: {
|
|
1789
|
+
content: {
|
|
1790
|
+
"application/json": components["schemas"]["SearchRequest"] & {
|
|
1791
|
+
/**
|
|
1792
|
+
* @default search
|
|
1793
|
+
* @enum {string}
|
|
1794
|
+
*/
|
|
1795
|
+
endpoint?: "search" | "news" | "images" | "autocomplete";
|
|
1796
|
+
/** @description Cloudflare Turnstile token, required when the server enforces Turnstile. Single-use: get a fresh one for every request */
|
|
1797
|
+
turnstile_token?: string;
|
|
1798
|
+
};
|
|
1799
|
+
};
|
|
1800
|
+
};
|
|
1801
|
+
responses: {
|
|
1802
|
+
/** @description Same body as the corresponding endpoint */
|
|
1803
|
+
200: {
|
|
1804
|
+
headers: {
|
|
1805
|
+
[name: string]: unknown;
|
|
1806
|
+
};
|
|
1807
|
+
content: {
|
|
1808
|
+
"application/json": {
|
|
1809
|
+
[key: string]: unknown;
|
|
1810
|
+
};
|
|
1811
|
+
};
|
|
1812
|
+
};
|
|
1813
|
+
400: components["responses"]["Error"];
|
|
1814
|
+
/** @description Bot check failed (missing, spent or foreign Turnstile token) or the Origin is not one of our sites */
|
|
1815
|
+
403: {
|
|
1816
|
+
headers: {
|
|
1817
|
+
[name: string]: unknown;
|
|
1818
|
+
};
|
|
1819
|
+
content: {
|
|
1820
|
+
"application/json": components["schemas"]["Error"];
|
|
1821
|
+
};
|
|
1822
|
+
};
|
|
1823
|
+
429: components["responses"]["Error"];
|
|
1824
|
+
};
|
|
1825
|
+
};
|
|
1826
|
+
mcp: {
|
|
1827
|
+
parameters: {
|
|
1828
|
+
query?: never;
|
|
1829
|
+
header?: never;
|
|
1830
|
+
path?: never;
|
|
1831
|
+
cookie?: never;
|
|
1832
|
+
};
|
|
1833
|
+
requestBody: {
|
|
1834
|
+
content: {
|
|
1835
|
+
"application/json": {
|
|
1836
|
+
[key: string]: unknown;
|
|
1837
|
+
};
|
|
1838
|
+
};
|
|
1839
|
+
};
|
|
1840
|
+
responses: {
|
|
1841
|
+
/** @description JSON-RPC response */
|
|
1842
|
+
200: {
|
|
1843
|
+
headers: {
|
|
1844
|
+
[name: string]: unknown;
|
|
1845
|
+
};
|
|
1846
|
+
content: {
|
|
1847
|
+
"application/json": {
|
|
1848
|
+
[key: string]: unknown;
|
|
1849
|
+
};
|
|
1850
|
+
};
|
|
1851
|
+
};
|
|
1852
|
+
/** @description Notification accepted */
|
|
1853
|
+
202: {
|
|
1854
|
+
headers: {
|
|
1855
|
+
[name: string]: unknown;
|
|
1856
|
+
};
|
|
1857
|
+
content?: never;
|
|
1858
|
+
};
|
|
1859
|
+
401: components["responses"]["Error"];
|
|
1860
|
+
};
|
|
1861
|
+
};
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
type Schemas = components["schemas"];
|
|
1865
|
+
/** A search provider that can answer a request. `meta.engine` names the one that did. */
|
|
1866
|
+
type Provider = Schemas["Provider"];
|
|
1867
|
+
/**
|
|
1868
|
+
* Which search providers may answer (`engine` param):
|
|
1869
|
+
* - `"google"` (default): Google only.
|
|
1870
|
+
* - `"auto"`: fall back to other enabled providers when Google is blocked or times out.
|
|
1871
|
+
* - `"consensus"` (`search` only): several independent indexes in parallel, merged by URL and
|
|
1872
|
+
* ranked by agreement; each result lists its `sources`, `meta.engine` is `"consensus"`, and
|
|
1873
|
+
* it costs the sum of one page per provider that returned results.
|
|
1874
|
+
* - a single provider (`"brave"`) or a list (`["google", "brave"]`): only those, in order.
|
|
1875
|
+
*
|
|
1876
|
+
* `auto` and `consensus` can't be combined with other names. Unknown names, or a provider
|
|
1877
|
+
* that doesn't serve the endpoint, are a 400 `invalid_request`. Plain strings stay accepted
|
|
1878
|
+
* so a provider added to the API before this SDK is updated still type-checks.
|
|
1879
|
+
*/
|
|
1880
|
+
type Engine = "google" | "auto" | "consensus" | Provider | Provider[] | (string & {});
|
|
1881
|
+
/** One provider attempt in `meta.route`. */
|
|
1882
|
+
type RouteStep = Schemas["RouteStep"];
|
|
1883
|
+
type RouteOutcome = RouteStep["outcome"];
|
|
1884
|
+
/** Parameters for search, images, videos, news, maps, places, shopping, scholar, patents and autocomplete. */
|
|
1885
|
+
type SearchParams = Omit<Schemas["SearchRequest"], "engine"> & {
|
|
1886
|
+
/** Search providers allowed to answer. Default `"google"`. See {@link Engine}. */
|
|
1887
|
+
engine?: Engine;
|
|
1888
|
+
};
|
|
1889
|
+
type ReviewsParams = Schemas["ReviewsRequest"];
|
|
1890
|
+
type LensParams = Schemas["LensRequest"];
|
|
1891
|
+
type WebpageParams = Schemas["WebpageRequest"];
|
|
1892
|
+
type RankParams = Schemas["RankRequest"];
|
|
1893
|
+
/** `format` values accepted by the verticals. */
|
|
1894
|
+
type Format = NonNullable<SearchParams["format"]>;
|
|
1895
|
+
type Meta = Schemas["Meta"];
|
|
1896
|
+
type RequestEcho = Schemas["RequestEcho"];
|
|
1897
|
+
type ErrorBody = Schemas["Error"];
|
|
1898
|
+
type OrganicResult = Schemas["OrganicResult"];
|
|
1899
|
+
type Sitelink = Schemas["Sitelink"];
|
|
1900
|
+
type AnswerBox = Schemas["AnswerBox"];
|
|
1901
|
+
type KnowledgeGraph = Schemas["KnowledgeGraph"];
|
|
1902
|
+
type PeopleAlsoAsk = Schemas["PeopleAlsoAsk"];
|
|
1903
|
+
type RelatedSearch = Schemas["RelatedSearch"];
|
|
1904
|
+
type ImageResult = Schemas["ImageResult"];
|
|
1905
|
+
type VideoResult = Schemas["VideoResult"];
|
|
1906
|
+
type NewsResult = Schemas["NewsResult"];
|
|
1907
|
+
type PlaceResult = Schemas["PlaceResult"];
|
|
1908
|
+
type ReviewResult = Schemas["ReviewResult"];
|
|
1909
|
+
type ShoppingResult = Schemas["ShoppingResult"];
|
|
1910
|
+
type ScholarResult = Schemas["ScholarResult"];
|
|
1911
|
+
type PatentResult = Schemas["PatentResult"];
|
|
1912
|
+
type Suggestion = Schemas["Suggestion"];
|
|
1913
|
+
type LensResult = Schemas["LensResult"];
|
|
1914
|
+
type PageMetadata = Schemas["PageMetadata"];
|
|
1915
|
+
type RankMatch = Schemas["RankResponse"]["matches"][number];
|
|
1916
|
+
type SearchResponse = Schemas["SearchResponse"];
|
|
1917
|
+
type ImagesResponse = Schemas["ImagesResponse"];
|
|
1918
|
+
type VideosResponse = Schemas["VideosResponse"];
|
|
1919
|
+
type NewsResponse = Schemas["NewsResponse"];
|
|
1920
|
+
/** Returned by both `maps` and `places`. */
|
|
1921
|
+
type PlacesResponse = Schemas["PlacesResponse"];
|
|
1922
|
+
type MapsResponse = PlacesResponse;
|
|
1923
|
+
type ReviewsResponse = Schemas["ReviewsResponse"];
|
|
1924
|
+
type ShoppingResponse = Schemas["ShoppingResponse"];
|
|
1925
|
+
type ScholarResponse = Schemas["ScholarResponse"];
|
|
1926
|
+
type PatentsResponse = Schemas["PatentsResponse"];
|
|
1927
|
+
type AutocompleteResponse = Schemas["AutocompleteResponse"];
|
|
1928
|
+
type LensResponse = Schemas["LensResponse"];
|
|
1929
|
+
type WebpageResponse = Schemas["WebpageResponse"];
|
|
1930
|
+
type RankResponse = Schemas["RankResponse"];
|
|
1931
|
+
type Account = Schemas["Account"];
|
|
1932
|
+
type Status = Schemas["Status"];
|
|
1933
|
+
/**
|
|
1934
|
+
* `format: "compact"` returns a token-lean object: short snippets, no
|
|
1935
|
+
* thumbnails or positions. Its keys depend on the vertical.
|
|
1936
|
+
*/
|
|
1937
|
+
interface CompactResponse {
|
|
1938
|
+
results?: Record<string, unknown>[];
|
|
1939
|
+
meta: Meta;
|
|
1940
|
+
[key: string]: unknown;
|
|
1941
|
+
}
|
|
1942
|
+
type Batch = Schemas["Batch"];
|
|
1943
|
+
type BatchStatus = Batch["status"];
|
|
1944
|
+
type BatchEndpoint = Schemas["BatchCreateRequest"]["endpoint"];
|
|
1945
|
+
/** An entry of `batches.create` that could not be queued. */
|
|
1946
|
+
type BatchCreateError = ErrorBody & {
|
|
1947
|
+
id?: never;
|
|
1948
|
+
status?: never;
|
|
1949
|
+
};
|
|
1950
|
+
/** One entry per submitted request, in order: a queued job or an error. */
|
|
1951
|
+
type BatchCreateEntry = Batch | BatchCreateError;
|
|
1952
|
+
interface BatchCreateResponse {
|
|
1953
|
+
batches: BatchCreateEntry[];
|
|
1954
|
+
}
|
|
1955
|
+
type BatchRequestMap = {
|
|
1956
|
+
search: SearchParams;
|
|
1957
|
+
images: SearchParams;
|
|
1958
|
+
videos: SearchParams;
|
|
1959
|
+
news: SearchParams;
|
|
1960
|
+
maps: SearchParams;
|
|
1961
|
+
places: SearchParams;
|
|
1962
|
+
reviews: ReviewsParams;
|
|
1963
|
+
shopping: SearchParams;
|
|
1964
|
+
scholar: SearchParams;
|
|
1965
|
+
patents: SearchParams;
|
|
1966
|
+
autocomplete: SearchParams;
|
|
1967
|
+
lens: LensParams;
|
|
1968
|
+
webpage: WebpageParams;
|
|
1969
|
+
};
|
|
1970
|
+
/** Body of `POST /v1/batches`. `requests` takes the same fields as the realtime endpoint. */
|
|
1971
|
+
type BatchCreateParams = {
|
|
1972
|
+
[E in BatchEndpoint]: {
|
|
1973
|
+
endpoint: E;
|
|
1974
|
+
/** 1-100 request bodies. */
|
|
1975
|
+
requests: BatchRequestMap[E][];
|
|
1976
|
+
/** Receives each job's result (signed with X-SerpKite-Signature). Defaults to the account webhook. */
|
|
1977
|
+
webhook_url?: string;
|
|
1978
|
+
};
|
|
1979
|
+
}[BatchEndpoint];
|
|
1980
|
+
|
|
1981
|
+
declare const VERSION = "0.2.0";
|
|
1982
|
+
declare const DEFAULT_BASE_URL = "https://api.serpkite.com";
|
|
1983
|
+
interface SerpKiteOptions {
|
|
1984
|
+
/** API key (`skt_live_…`). Defaults to the `SERPKITE_API_KEY` environment variable. */
|
|
1985
|
+
apiKey?: string;
|
|
1986
|
+
/** Defaults to `SERPKITE_BASE_URL` or https://api.serpkite.com. */
|
|
1987
|
+
baseUrl?: string;
|
|
1988
|
+
/** Per-attempt timeout in milliseconds. Default 60000. */
|
|
1989
|
+
timeoutMs?: number;
|
|
1990
|
+
/** Retries after the first attempt on 429, 5xx and network errors. Default 2. */
|
|
1991
|
+
maxRetries?: number;
|
|
1992
|
+
/** Base delay of the exponential backoff in milliseconds. Default 500. */
|
|
1993
|
+
retryDelayMs?: number;
|
|
1994
|
+
/** Custom fetch implementation. Defaults to the global `fetch`. */
|
|
1995
|
+
fetch?: typeof fetch;
|
|
1996
|
+
/** Extra headers sent with every request. */
|
|
1997
|
+
headers?: Record<string, string>;
|
|
1998
|
+
}
|
|
1999
|
+
/** Billing and tracing details from the response headers. */
|
|
2000
|
+
interface ResponseInfo {
|
|
2001
|
+
status: number;
|
|
2002
|
+
headers: Headers;
|
|
2003
|
+
requestId: string | undefined;
|
|
2004
|
+
creditsUsed: number | undefined;
|
|
2005
|
+
creditsRemaining: number | undefined;
|
|
2006
|
+
costUsd: number | undefined;
|
|
2007
|
+
/** `HIT` when served from cache (`max_age`), else `MISS`. */
|
|
2008
|
+
cache: "HIT" | "MISS" | undefined;
|
|
2009
|
+
latencyMs: number | undefined;
|
|
2010
|
+
tokensEstimate: number | undefined;
|
|
2011
|
+
}
|
|
2012
|
+
interface RequestOptions {
|
|
2013
|
+
signal?: AbortSignal;
|
|
2014
|
+
/** Overrides the client's per-attempt timeout. */
|
|
2015
|
+
timeoutMs?: number;
|
|
2016
|
+
/** Overrides the client's retry count. */
|
|
2017
|
+
maxRetries?: number;
|
|
2018
|
+
headers?: Record<string, string>;
|
|
2019
|
+
/** Called with the final response's headers (credits used/remaining, cache, request id). */
|
|
2020
|
+
onResponse?: (info: ResponseInfo) => void;
|
|
2021
|
+
}
|
|
2022
|
+
interface BatchCreateOptions extends RequestOptions {
|
|
2023
|
+
/**
|
|
2024
|
+
* Sent as `Idempotency-Key` (1-255 printable ASCII characters, e.g. a UUID).
|
|
2025
|
+
* For 24 hours a retry with the same key and body returns the first response
|
|
2026
|
+
* instead of queueing and billing the jobs again.
|
|
2027
|
+
*/
|
|
2028
|
+
idempotencyKey?: string;
|
|
2029
|
+
}
|
|
2030
|
+
interface WaitOptions {
|
|
2031
|
+
/** Give up after this many milliseconds. Default 600000 (10 minutes). */
|
|
2032
|
+
timeoutMs?: number;
|
|
2033
|
+
/** First delay between polls. Default 1000. Grows 1.5× per poll. */
|
|
2034
|
+
pollIntervalMs?: number;
|
|
2035
|
+
/** Upper bound of the delay between polls. Default 10000. */
|
|
2036
|
+
maxPollIntervalMs?: number;
|
|
2037
|
+
signal?: AbortSignal;
|
|
2038
|
+
}
|
|
2039
|
+
/** A vertical whose return type follows `format`: `"markdown"` → string, `"compact"` → CompactResponse. */
|
|
2040
|
+
interface VerticalMethod<P, R> {
|
|
2041
|
+
(params: P & {
|
|
2042
|
+
format: "markdown";
|
|
2043
|
+
}, options?: RequestOptions): Promise<string>;
|
|
2044
|
+
(params: P & {
|
|
2045
|
+
format: "compact";
|
|
2046
|
+
}, options?: RequestOptions): Promise<CompactResponse>;
|
|
2047
|
+
(params: P & {
|
|
2048
|
+
format?: "json";
|
|
2049
|
+
}, options?: RequestOptions): Promise<R>;
|
|
2050
|
+
(params: P, options?: RequestOptions): Promise<R | CompactResponse | string>;
|
|
2051
|
+
}
|
|
2052
|
+
type Method = "GET" | "POST";
|
|
2053
|
+
interface Call {
|
|
2054
|
+
method: Method;
|
|
2055
|
+
path: string;
|
|
2056
|
+
body?: unknown;
|
|
2057
|
+
options?: RequestOptions;
|
|
2058
|
+
/** Which failures are safe to retry. `all` = 429, 5xx and network errors. */
|
|
2059
|
+
retry?: "all" | "rate_limit";
|
|
2060
|
+
}
|
|
2061
|
+
declare class SerpKite {
|
|
2062
|
+
#private;
|
|
2063
|
+
readonly baseUrl: string;
|
|
2064
|
+
readonly timeoutMs: number;
|
|
2065
|
+
readonly maxRetries: number;
|
|
2066
|
+
readonly retryDelayMs: number;
|
|
2067
|
+
constructor(options?: SerpKiteOptions);
|
|
2068
|
+
/** Google web search: organic results, answer box, knowledge graph, people also ask… */
|
|
2069
|
+
readonly search: VerticalMethod<SearchParams, {
|
|
2070
|
+
request: components["schemas"]["RequestEcho"];
|
|
2071
|
+
results: components["schemas"]["OrganicResult"][];
|
|
2072
|
+
answer_box?: components["schemas"]["AnswerBox"];
|
|
2073
|
+
knowledge_graph?: components["schemas"]["KnowledgeGraph"];
|
|
2074
|
+
ads?: components["schemas"]["OrganicResult"][];
|
|
2075
|
+
people_also_ask?: components["schemas"]["PeopleAlsoAsk"][];
|
|
2076
|
+
related_searches: components["schemas"]["RelatedSearch"][];
|
|
2077
|
+
top_stories?: components["schemas"]["NewsResult"][];
|
|
2078
|
+
places?: components["schemas"]["PlaceResult"][];
|
|
2079
|
+
meta: components["schemas"]["Meta"];
|
|
2080
|
+
}>;
|
|
2081
|
+
/** Google Images. */
|
|
2082
|
+
readonly images: VerticalMethod<SearchParams, {
|
|
2083
|
+
request: components["schemas"]["RequestEcho"];
|
|
2084
|
+
results: components["schemas"]["ImageResult"][];
|
|
2085
|
+
meta: components["schemas"]["Meta"];
|
|
2086
|
+
}>;
|
|
2087
|
+
/** Google Videos. */
|
|
2088
|
+
readonly videos: VerticalMethod<SearchParams, {
|
|
2089
|
+
request: components["schemas"]["RequestEcho"];
|
|
2090
|
+
results: components["schemas"]["VideoResult"][];
|
|
2091
|
+
meta: components["schemas"]["Meta"];
|
|
2092
|
+
}>;
|
|
2093
|
+
/** Google News. */
|
|
2094
|
+
readonly news: VerticalMethod<SearchParams, {
|
|
2095
|
+
request: components["schemas"]["RequestEcho"];
|
|
2096
|
+
results: components["schemas"]["NewsResult"][];
|
|
2097
|
+
meta: components["schemas"]["Meta"];
|
|
2098
|
+
}>;
|
|
2099
|
+
/** Google Maps search (places with coordinates). Accepts `ll` ("@lat,lng,14z"). */
|
|
2100
|
+
readonly maps: VerticalMethod<SearchParams, {
|
|
2101
|
+
request: components["schemas"]["RequestEcho"];
|
|
2102
|
+
results: components["schemas"]["PlaceResult"][];
|
|
2103
|
+
meta: components["schemas"]["Meta"];
|
|
2104
|
+
}>;
|
|
2105
|
+
/** Google local results. */
|
|
2106
|
+
readonly places: VerticalMethod<SearchParams, {
|
|
2107
|
+
request: components["schemas"]["RequestEcho"];
|
|
2108
|
+
results: components["schemas"]["PlaceResult"][];
|
|
2109
|
+
meta: components["schemas"]["Meta"];
|
|
2110
|
+
}>;
|
|
2111
|
+
/** Reviews of a place by `place_id`, `cid` or `fid`. Page with `page_token` = `next_page_token`. */
|
|
2112
|
+
readonly reviews: VerticalMethod<{
|
|
2113
|
+
place_id?: string;
|
|
2114
|
+
cid?: string;
|
|
2115
|
+
fid?: string;
|
|
2116
|
+
country?: string;
|
|
2117
|
+
language?: string;
|
|
2118
|
+
sort?: "most_relevant" | "newest" | "highest_rating" | "lowest_rating";
|
|
2119
|
+
page_token?: string;
|
|
2120
|
+
num?: number;
|
|
2121
|
+
format?: "json" | "markdown" | "compact";
|
|
2122
|
+
fields?: string;
|
|
2123
|
+
max_age?: number;
|
|
2124
|
+
}, {
|
|
2125
|
+
request: components["schemas"]["RequestEcho"];
|
|
2126
|
+
results: components["schemas"]["ReviewResult"][];
|
|
2127
|
+
next_page_token?: string;
|
|
2128
|
+
meta: components["schemas"]["Meta"];
|
|
2129
|
+
}>;
|
|
2130
|
+
/** Google Shopping. */
|
|
2131
|
+
readonly shopping: VerticalMethod<SearchParams, {
|
|
2132
|
+
request: components["schemas"]["RequestEcho"];
|
|
2133
|
+
results: components["schemas"]["ShoppingResult"][];
|
|
2134
|
+
meta: components["schemas"]["Meta"];
|
|
2135
|
+
}>;
|
|
2136
|
+
/** Google Scholar. */
|
|
2137
|
+
readonly scholar: VerticalMethod<SearchParams, {
|
|
2138
|
+
request: components["schemas"]["RequestEcho"];
|
|
2139
|
+
results: components["schemas"]["ScholarResult"][];
|
|
2140
|
+
meta: components["schemas"]["Meta"];
|
|
2141
|
+
}>;
|
|
2142
|
+
/** Google Patents. */
|
|
2143
|
+
readonly patents: VerticalMethod<SearchParams, {
|
|
2144
|
+
request: components["schemas"]["RequestEcho"];
|
|
2145
|
+
results: components["schemas"]["PatentResult"][];
|
|
2146
|
+
meta: components["schemas"]["Meta"];
|
|
2147
|
+
}>;
|
|
2148
|
+
/** Google autocomplete suggestions. */
|
|
2149
|
+
readonly autocomplete: VerticalMethod<SearchParams, {
|
|
2150
|
+
request: components["schemas"]["RequestEcho"];
|
|
2151
|
+
results: components["schemas"]["Suggestion"][];
|
|
2152
|
+
meta: components["schemas"]["Meta"];
|
|
2153
|
+
}>;
|
|
2154
|
+
/** Fetch any public URL as clean Markdown plus metadata. */
|
|
2155
|
+
readonly webpage: VerticalMethod<{
|
|
2156
|
+
url: string;
|
|
2157
|
+
format?: "json" | "markdown" | "compact";
|
|
2158
|
+
include_html?: boolean;
|
|
2159
|
+
max_age?: number;
|
|
2160
|
+
}, {
|
|
2161
|
+
request: components["schemas"]["RequestEcho"];
|
|
2162
|
+
url: string;
|
|
2163
|
+
status_code?: number;
|
|
2164
|
+
markdown: string;
|
|
2165
|
+
text?: string;
|
|
2166
|
+
html?: string;
|
|
2167
|
+
metadata: components["schemas"]["PageMetadata"];
|
|
2168
|
+
meta: components["schemas"]["Meta"];
|
|
2169
|
+
}>;
|
|
2170
|
+
/** Google Lens visual matches for an image URL. */
|
|
2171
|
+
lens(params: LensParams, options?: RequestOptions): Promise<LensResponse>;
|
|
2172
|
+
/** Position of `domain` for keyword `q` in the top `num` results (default 100). */
|
|
2173
|
+
rank(params: RankParams, options?: RequestOptions): Promise<RankResponse>;
|
|
2174
|
+
/** Balance, limits and this month's usage for the key's account. */
|
|
2175
|
+
account(options?: RequestOptions): Promise<Account>;
|
|
2176
|
+
readonly batches: {
|
|
2177
|
+
/**
|
|
2178
|
+
* Queue 1-100 requests for one endpoint at half price. Returns one entry per
|
|
2179
|
+
* request, in order: a queued `Batch` or an error object. Without an
|
|
2180
|
+
* `idempotencyKey` it is only retried on 429, so a lost response never queues
|
|
2181
|
+
* (and bills) the same requests twice. With one, 5xx and network errors are
|
|
2182
|
+
* retried too: the server replays the first response for the same key and body.
|
|
2183
|
+
*/
|
|
2184
|
+
create: (params: BatchCreateParams, options?: BatchCreateOptions) => Promise<BatchCreateResponse>;
|
|
2185
|
+
/** Poll one batch job. */
|
|
2186
|
+
get: (id: string, options?: RequestOptions) => Promise<Batch>;
|
|
2187
|
+
/**
|
|
2188
|
+
* Poll until the job is `done` or `failed` and return it (a failed job is
|
|
2189
|
+
* returned, not thrown; check `status` and `error`). Accepts an id or an
|
|
2190
|
+
* entry from `create`; an entry that failed to queue throws its error.
|
|
2191
|
+
*/
|
|
2192
|
+
wait: (idOrEntry: string | BatchCreateEntry | undefined, options?: WaitOptions) => Promise<{
|
|
2193
|
+
id: string;
|
|
2194
|
+
status: "queued" | "running" | "done" | "failed";
|
|
2195
|
+
endpoint: string;
|
|
2196
|
+
created_at: string;
|
|
2197
|
+
completed_at?: string | null;
|
|
2198
|
+
credits_used?: number;
|
|
2199
|
+
poll_url: string;
|
|
2200
|
+
webhook_url?: string | null;
|
|
2201
|
+
webhook_status?: "pending" | "delivered" | "failed" | null;
|
|
2202
|
+
error?: {
|
|
2203
|
+
code?: string;
|
|
2204
|
+
message?: string;
|
|
2205
|
+
} | null;
|
|
2206
|
+
result?: {
|
|
2207
|
+
[key: string]: unknown;
|
|
2208
|
+
} | null;
|
|
2209
|
+
}>;
|
|
2210
|
+
};
|
|
2211
|
+
/** Low-level request: JSON body in, parsed JSON (or text for non-JSON responses) out. */
|
|
2212
|
+
request<T>(call: Call): Promise<T>;
|
|
2213
|
+
}
|
|
2214
|
+
/** Parses Retry-After (seconds or an HTTP date) into milliseconds. */
|
|
2215
|
+
declare function parseRetryAfter(v: string | null): number | undefined;
|
|
2216
|
+
|
|
2217
|
+
/**
|
|
2218
|
+
* Every failure thrown by the SDK. API errors carry the fields of the
|
|
2219
|
+
* `{"error":{"code","message","request_id"}}` envelope; network failures and
|
|
2220
|
+
* timeouts use `status: 0` with code `connection_error` or `timeout`.
|
|
2221
|
+
*/
|
|
2222
|
+
declare class SerpKiteError extends Error {
|
|
2223
|
+
/** HTTP status, or 0 when no response was received. */
|
|
2224
|
+
readonly status: number;
|
|
2225
|
+
/** Machine-readable code, e.g. `unauthorized`, `insufficient_credits`, `rate_limited`. */
|
|
2226
|
+
readonly code: string;
|
|
2227
|
+
/** `X-Request-Id` of the failed request, when the API returned one. */
|
|
2228
|
+
readonly requestId: string | undefined;
|
|
2229
|
+
/** Response headers, when the API responded. */
|
|
2230
|
+
readonly headers: Headers | undefined;
|
|
2231
|
+
constructor(status: number, code: string, message: string, requestId?: string, headers?: Headers, options?: {
|
|
2232
|
+
cause?: unknown;
|
|
2233
|
+
});
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
/** True when a `batches.create` entry was rejected instead of queued. */
|
|
2237
|
+
declare function isBatchError(entry: BatchCreateEntry): entry is BatchCreateError;
|
|
2238
|
+
|
|
2239
|
+
/** Options for {@link verifyWebhook}. */
|
|
2240
|
+
interface VerifyWebhookOptions {
|
|
2241
|
+
/** Reject deliveries whose timestamp is further than this from now. Default 300. */
|
|
2242
|
+
toleranceSeconds?: number;
|
|
2243
|
+
/** Current time in Unix seconds (tests). */
|
|
2244
|
+
now?: number;
|
|
2245
|
+
}
|
|
2246
|
+
type HeaderSource = Headers | Record<string, string | string[] | undefined>;
|
|
2247
|
+
/**
|
|
2248
|
+
* Checks a batch webhook delivery: `X-SerpKite-Signature` must be
|
|
2249
|
+
* `v1=<hex HMAC-SHA256(secret, "<X-SerpKite-Timestamp>.<raw body>")>` and the
|
|
2250
|
+
* timestamp recent. Pass the raw request body exactly as received (not
|
|
2251
|
+
* re-serialised JSON). Uses Web Crypto (Node 18+, Deno, Bun, browsers).
|
|
2252
|
+
*
|
|
2253
|
+
* ```ts
|
|
2254
|
+
* const ok = await verifyWebhook(process.env.SERPKITE_WEBHOOK_SECRET!, rawBody, req.headers);
|
|
2255
|
+
* ```
|
|
2256
|
+
*/
|
|
2257
|
+
declare function verifyWebhook(secret: string, payload: string | Uint8Array, headers: HeaderSource, options?: VerifyWebhookOptions): Promise<boolean>;
|
|
2258
|
+
|
|
2259
|
+
export { type Account, type AnswerBox, type AutocompleteResponse, type Batch, type BatchCreateEntry, type BatchCreateError, type BatchCreateOptions, type BatchCreateParams, type BatchCreateResponse, type BatchEndpoint, type BatchStatus, type CompactResponse, DEFAULT_BASE_URL, type Engine, type ErrorBody, type Format, type ImageResult, type ImagesResponse, type KnowledgeGraph, type LensParams, type LensResponse, type LensResult, type MapsResponse, type Meta, type NewsResponse, type NewsResult, type OrganicResult, type PageMetadata, type PatentResult, type PatentsResponse, type PeopleAlsoAsk, type PlaceResult, type PlacesResponse, type Provider, type RankMatch, type RankParams, type RankResponse, type RelatedSearch, type RequestEcho, type RequestOptions, type ResponseInfo, type ReviewResult, type ReviewsParams, type ReviewsResponse, type RouteOutcome, type RouteStep, type ScholarResponse, type ScholarResult, type SearchParams, type SearchResponse, SerpKite, SerpKiteError, type SerpKiteOptions, type ShoppingResponse, type ShoppingResult, type Sitelink, type Status, type Suggestion, VERSION, type VerifyWebhookOptions, type VerticalMethod, type VideoResult, type VideosResponse, type WaitOptions, type WebpageParams, type WebpageResponse, type components, isBatchError, type operations, parseRetryAfter, type paths, verifyWebhook };
|