@hunt-labs/bytekit-sdk 0.11.9 → 0.11.10
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/CHANGELOG.md +68 -0
- package/dist/generated/api.d.ts +793 -158
- package/dist/resources/fetch.d.ts +6 -6
- package/dist/resources/fetch.js +3 -2
- package/dist/resources/screenshots.d.ts +3 -3
- package/dist/resources/screenshots.js +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/generated/api.d.ts
CHANGED
|
@@ -153,7 +153,9 @@ export interface paths {
|
|
|
153
153
|
put?: never;
|
|
154
154
|
/**
|
|
155
155
|
* Capture a screenshot
|
|
156
|
-
* @description Sync by default (holds up to 28s). Pass `?async=true`
|
|
156
|
+
* @description Sync by default (holds up to 28s). Pass `async: true` in the body or `?async=true` in the
|
|
157
|
+
* query string to return 202 immediately; either one is enough, and `false` in one never
|
|
158
|
+
* cancels `true` in the other.
|
|
157
159
|
* Poll via GET /v1/screenshots/{id}.
|
|
158
160
|
*
|
|
159
161
|
* **Limits:** request bodies are capped at 512 KB. An oversized body
|
|
@@ -198,13 +200,15 @@ export interface paths {
|
|
|
198
200
|
*
|
|
199
201
|
* **The response shape is decided by your request, not by how we route it.** In precedence order:
|
|
200
202
|
*
|
|
201
|
-
* 1. `async: true` → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET /v1/scrape/{id}` for the result.
|
|
203
|
+
* 1. `async: true` in the body, or `?async=true` in the query string (either one is enough; `false` in one never cancels `true` in the other) → **202** with a `ScrapeQueuedEnvelope` receipt, returned immediately. Poll `GET /v1/scrape/{id}` for the result.
|
|
202
204
|
* 2. Otherwise, a request that needs a full page render — today that is `delay_ms > 0` — is **held open** until the render reaches a terminal state, then returns **200** with the content envelope (`success` or `failed`). If the render is still running when the hold window expires (28 seconds by default), the request returns the **202** receipt instead and the job continues in the background.
|
|
203
205
|
* 3. Otherwise the request is served by the fast HTTP path and returns **200** with the content envelope, typically in under a second.
|
|
204
206
|
*
|
|
205
207
|
* **A failed fetch is a result, not a transport error.** An unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all come back on the same **200** as a `failed` envelope — never a 5xx. Narrow on the envelope's `status` before reading the body. A failure the fast path decides inline is recorded as a failed job, so its envelope normally carries that job's `id` and `GET /v1/scrape/{id}` returns the same envelope; if recording the failed job itself fails, the envelope still arrives on the same 200 with `id` set to `null` and there is nothing to poll. A failure a held render reaches carries that render's real `id`. Either way the request transfers no billable bytes and is charged nothing.
|
|
206
208
|
*
|
|
207
|
-
*
|
|
209
|
+
* **A target that rate-limits us is not ByteKit rate-limiting you.** The `failed` envelope's `error.code` is `target_rate_limited` when the target rate-limits the request. On the fast path that means our proxy attempts end on an HTTP 429 and no bot protection is identified on any attempt, even if the browser fallback then fails or reaches only an unidentified block page; the inline failure carries `error.retry_after_seconds` when the target sent a usable `Retry-After`. On a held render the browser's own answer decides: it observes a 429 on the page itself, or it fails outright after the proxy attempts ended on an HTTP 429. A bot-protection verdict on an earlier fetch attempt does not keep a held render `blocked` when the browser then observes the 429. A held render never carries `error.retry_after_seconds`. Retrying a `target_rate_limited` failure later is likely to work. A held render whose browser reaches an unidentified 403 or 503 page after a proxy 429 is `blocked`. A 429 that bot protection sends as a block stays `blocked` when it is the answer that decides the code: the fast path's proxy attempts, or the browser render on a held render. Your own per-key limit is a separate case: it answers HTTP 429 `rate_limited` with a `Retry-After` header (see the `429` response).
|
|
210
|
+
*
|
|
211
|
+
* So a 202 means one of exactly two things: you asked for one with `async: true` or `?async=true`, or the hold window expired. `wait_for_selector` and `wait_until` are `ScreenshotRequest` options, not `ScrapeRequest` options — sending either to this endpoint returns `422 validation_error`, so neither can produce a 202 here.
|
|
208
212
|
*/
|
|
209
213
|
post: operations["createScrape"];
|
|
210
214
|
delete?: never;
|
|
@@ -249,6 +253,12 @@ export interface paths {
|
|
|
249
253
|
* `BulkCompletedWebhook` contract: at most 500 complete items and 1 MiB,
|
|
250
254
|
* followed by cursor recovery through `GET /v1/scrape/bulk/{id}` whenever
|
|
251
255
|
* `recovery_required` is true.
|
|
256
|
+
*
|
|
257
|
+
* **Unknown keys.** An unknown key on an `items[]` entry, or at the top level of
|
|
258
|
+
* the body, is rejected with `422 validation_error`. An unknown key inside
|
|
259
|
+
* `defaults` is not: it is dropped without a warning and the request is accepted
|
|
260
|
+
* with `202`. The exception is `cookies` and `headers`, on an item or in `defaults`: they
|
|
261
|
+
* answer `400 validation_error`.
|
|
252
262
|
*/
|
|
253
263
|
post: operations["createScrapeBulk"];
|
|
254
264
|
delete?: never;
|
|
@@ -277,6 +287,17 @@ export interface paths {
|
|
|
277
287
|
* stored, or whose object cannot be signed, is omitted from `formats` and
|
|
278
288
|
* reported as `artifact_unavailable` in `warnings`. The private unsigned
|
|
279
289
|
* storage URL is never returned.
|
|
290
|
+
*
|
|
291
|
+
* **Cancelled by the platform.** When the account can no longer spend (its bandwidth
|
|
292
|
+
* balance is exhausted, or the account is deleted) while items are still pending, ByteKit
|
|
293
|
+
* cancels the job itself. It then reads `status: cancelled` even though you never called
|
|
294
|
+
* `DELETE /v1/bulk/{id}`, and the cancellation sends no webhook.
|
|
295
|
+
*
|
|
296
|
+
* **Job ids from other create routes.** The job is looked up by account only, so the id
|
|
297
|
+
* of a job created by `POST /v1/fetch/bulk` or `POST /v1/bulk` is found here too, not a `404`.
|
|
298
|
+
* The items listed are the job's scrape rows: a fetch-bulk job's items appear, and a
|
|
299
|
+
* `POST /v1/bulk` job shows its scrape items but not its screenshots. An id from another
|
|
300
|
+
* account answers `404`.
|
|
280
301
|
*/
|
|
281
302
|
get: operations["getScrapeBulk"];
|
|
282
303
|
put?: never;
|
|
@@ -296,15 +317,20 @@ export interface paths {
|
|
|
296
317
|
};
|
|
297
318
|
/**
|
|
298
319
|
* Fetch a URL (GET)
|
|
299
|
-
* @description Direct HTTP fetch.
|
|
300
|
-
*
|
|
301
|
-
* `
|
|
320
|
+
* @description Direct HTTP fetch. Metadata is returned in X-Fetch-* headers. What the body holds
|
|
321
|
+
* depends on `X-Fetch-Fast-Path`. When it is `true`, a successful response returns the
|
|
322
|
+
* upstream response bytes verbatim. When it is `false` the request fell back to a browser
|
|
323
|
+
* render, and the body is the rendered page rather than the bytes the target sent;
|
|
324
|
+
* `X-Fetch-Content-Length` is then the compressed size of that page. Non-2xx upstream
|
|
325
|
+
* responses use the `upstream_error` JSON envelope with the upstream HTTP status.
|
|
302
326
|
*/
|
|
303
327
|
get: operations["getFetch"];
|
|
304
328
|
put?: never;
|
|
305
329
|
/**
|
|
306
330
|
* Fetch a URL (POST)
|
|
307
|
-
* @description Same as GET /v1/fetch but with a JSON request body.
|
|
331
|
+
* @description Same as GET /v1/fetch but with a JSON request body. The response is the same, including
|
|
332
|
+
* the `X-Fetch-Fast-Path` rule for what the body holds: the upstream bytes verbatim when
|
|
333
|
+
* it is `true`, the rendered page when it is `false`.
|
|
308
334
|
*
|
|
309
335
|
* **Limits:** request bodies are capped at 512 KB. An oversized body
|
|
310
336
|
* returns a `400` with error code `request_too_large`.
|
|
@@ -373,6 +399,16 @@ export interface paths {
|
|
|
373
399
|
* stored object, or completed items whose object cannot be signed, carry
|
|
374
400
|
* `null`; the latter report `artifact_unavailable`. The private unsigned
|
|
375
401
|
* storage URL is never returned.
|
|
402
|
+
*
|
|
403
|
+
* **Cancelled by the platform.** When the account can no longer spend (its bandwidth
|
|
404
|
+
* balance is exhausted, or the account is deleted) while items are still pending, ByteKit
|
|
405
|
+
* cancels the job itself. It then reads `status: cancelled` even though you never called
|
|
406
|
+
* `DELETE /v1/bulk/{id}`, and the cancellation sends no webhook.
|
|
407
|
+
*
|
|
408
|
+
* **Job ids from other create routes.** The job is looked up by account only, so the id
|
|
409
|
+
* of a job created by `POST /v1/scrape/bulk` or `POST /v1/bulk` is found here too, not a
|
|
410
|
+
* `404`, with the job envelope and `items: []`: only items fetched through
|
|
411
|
+
* `POST /v1/fetch/bulk` are listed. An id from another account answers `404`.
|
|
376
412
|
*/
|
|
377
413
|
get: operations["getFetchBulk"];
|
|
378
414
|
put?: never;
|
|
@@ -436,7 +472,19 @@ export interface paths {
|
|
|
436
472
|
path?: never;
|
|
437
473
|
cookie?: never;
|
|
438
474
|
};
|
|
439
|
-
/**
|
|
475
|
+
/**
|
|
476
|
+
* Get bulk job status
|
|
477
|
+
* @description Returns the job envelope. Items are listed by `GET /v1/bulk/{id}/screenshots`.
|
|
478
|
+
*
|
|
479
|
+
* **Cancelled by the platform.** When the account can no longer spend (its bandwidth
|
|
480
|
+
* balance is exhausted, or the account is deleted) while items are still pending, ByteKit
|
|
481
|
+
* cancels the job itself. It then reads `status: cancelled` even though you never called
|
|
482
|
+
* `DELETE /v1/bulk/{id}`, and the cancellation sends no webhook.
|
|
483
|
+
*
|
|
484
|
+
* **Job ids from other create routes.** The job is looked up by account only, so the id
|
|
485
|
+
* of a job created by `POST /v1/scrape/bulk` or `POST /v1/fetch/bulk` is found here too, not
|
|
486
|
+
* a `404`, with that job's envelope. An id from another account answers `404`.
|
|
487
|
+
*/
|
|
440
488
|
get: operations["getBulk"];
|
|
441
489
|
put?: never;
|
|
442
490
|
post?: never;
|
|
@@ -567,6 +615,20 @@ export interface paths {
|
|
|
567
615
|
* `X-ByteKit-Event: sitemap.failed` so receivers can dispatch on the
|
|
568
616
|
* header without parsing the body shape.
|
|
569
617
|
*
|
|
618
|
+
* The webhook body is `{ event, data }`. For a job the worker ran, `data` is not a
|
|
619
|
+
* `SitemapResponse`:
|
|
620
|
+
*
|
|
621
|
+
* - `sitemap.completed` `data` carries `id`, `url`, `strategy`, `status`,
|
|
622
|
+
* `total_urls`, `sources`, `total_bytes`, `results_url`, `warnings`,
|
|
623
|
+
* `metadata`, `compact` and `billing`.
|
|
624
|
+
* - `sitemap.failed` `data` carries `id`, `url`, `strategy`, `status`,
|
|
625
|
+
* `error_code`, `error_message`, `warnings` and `metadata`.
|
|
626
|
+
*
|
|
627
|
+
* In both, `url` is the host as `scheme://host`, and `warnings` is the
|
|
628
|
+
* worker's own warnings or `null`. When the request is answered from a cached job
|
|
629
|
+
* (`cache: hit`), the `sitemap.completed` `data` is instead the full job object, the
|
|
630
|
+
* same fields as a `SitemapResponse`.
|
|
631
|
+
*
|
|
570
632
|
* **Limits:** request bodies are capped at 512 KB. An oversized body
|
|
571
633
|
* returns a `400` with error code `request_too_large`.
|
|
572
634
|
*/
|
|
@@ -740,7 +802,11 @@ export interface paths {
|
|
|
740
802
|
put?: never;
|
|
741
803
|
/**
|
|
742
804
|
* Create Stripe checkout session
|
|
743
|
-
* @description Creates
|
|
805
|
+
* @description Creates an Elements-mode Stripe Checkout session for subscription sign-up
|
|
806
|
+
* and returns its client secret. The dashboard mounts Stripe's Payment
|
|
807
|
+
* Element on `client_secret` and the user pays in-page; the plan activates
|
|
808
|
+
* asynchronously once Stripe's subscription webhook settles. The card paid
|
|
809
|
+
* with becomes the customer's default when none is set.
|
|
744
810
|
*/
|
|
745
811
|
post: operations["createCheckout"];
|
|
746
812
|
delete?: never;
|
|
@@ -758,7 +824,11 @@ export interface paths {
|
|
|
758
824
|
};
|
|
759
825
|
get?: never;
|
|
760
826
|
put?: never;
|
|
761
|
-
/**
|
|
827
|
+
/**
|
|
828
|
+
* Retired billing-portal compatibility terminal
|
|
829
|
+
* @description Returns 410 for every request and reads no body. Card update, cancellation and
|
|
830
|
+
* invoice history all stay in the dashboard at `/settings/billing`.
|
|
831
|
+
*/
|
|
762
832
|
post: operations["createPortal"];
|
|
763
833
|
delete?: never;
|
|
764
834
|
options?: never;
|
|
@@ -776,9 +846,8 @@ export interface paths {
|
|
|
776
846
|
get?: never;
|
|
777
847
|
put?: never;
|
|
778
848
|
/**
|
|
779
|
-
*
|
|
780
|
-
* @description
|
|
781
|
-
* a payment method without charging. For pay-as-you-go accounts.
|
|
849
|
+
* Legacy card-setup compatibility terminal
|
|
850
|
+
* @description Returns 410. Card setup moved to `POST /v1/billing/payment-methods/setup`.
|
|
782
851
|
*/
|
|
783
852
|
post: operations["registerPayg"];
|
|
784
853
|
delete?: never;
|
|
@@ -798,10 +867,11 @@ export interface paths {
|
|
|
798
867
|
put?: never;
|
|
799
868
|
/**
|
|
800
869
|
* One-time dollar deposit
|
|
801
|
-
* @description Creates
|
|
802
|
-
* USD balance and returns its
|
|
803
|
-
* `
|
|
804
|
-
*
|
|
870
|
+
* @description Creates an Elements-mode Stripe Checkout session for a deposit into the
|
|
871
|
+
* account's USD balance and returns its client secret. The dashboard mounts
|
|
872
|
+
* Stripe's Payment Element on `client_secret` and the user pays in-page; the
|
|
873
|
+
* balance is credited asynchronously once Stripe's payment webhook settles.
|
|
874
|
+
* The card paid with becomes the customer's default when none is set. The balance
|
|
805
875
|
* never expires and pays for usage beyond the included allowance, for
|
|
806
876
|
* bandwidth and search credits alike, at the plan's rate when it is used.
|
|
807
877
|
*/
|
|
@@ -819,15 +889,22 @@ export interface paths {
|
|
|
819
889
|
path?: never;
|
|
820
890
|
cookie?: never;
|
|
821
891
|
};
|
|
822
|
-
|
|
892
|
+
/**
|
|
893
|
+
* Read whether the plan is cancelling
|
|
894
|
+
* @description Whether the subscription is set to end at the end of the current period, read from Stripe on each call.
|
|
895
|
+
*/
|
|
896
|
+
get: operations["getCancellation"];
|
|
823
897
|
put?: never;
|
|
824
898
|
/**
|
|
825
|
-
*
|
|
826
|
-
* @description
|
|
827
|
-
* Billing Portal and projected through Stripe webhooks.
|
|
899
|
+
* Cancel the plan at the period end
|
|
900
|
+
* @description Sets the subscription to end at the end of the current period instead of renewing; the plan stays active until then and the account then moves to Pay As You Go. A plan change booked for the period end is released first. Send the current cancellation disclosure revision in the `Billing-Disclosure-Revision` header: without it, or with a stale one, the call answers `409 billing_disclosure_stale` with the current terms.
|
|
828
901
|
*/
|
|
829
902
|
post: operations["cancelSubscription"];
|
|
830
|
-
|
|
903
|
+
/**
|
|
904
|
+
* Keep a cancelling plan
|
|
905
|
+
* @description Undoes a pending cancellation, so the subscription renews at the end of the current period as before.
|
|
906
|
+
*/
|
|
907
|
+
delete: operations["keepSubscription"];
|
|
831
908
|
options?: never;
|
|
832
909
|
head?: never;
|
|
833
910
|
patch?: never;
|
|
@@ -846,7 +923,10 @@ export interface paths {
|
|
|
846
923
|
*/
|
|
847
924
|
get: operations["getPlanChange"];
|
|
848
925
|
put?: never;
|
|
849
|
-
/**
|
|
926
|
+
/**
|
|
927
|
+
* Change subscription plan
|
|
928
|
+
* @description A plan change made while the plan is cancelling clears the pending cancellation, so the subscription keeps renewing.
|
|
929
|
+
*/
|
|
850
930
|
post: operations["changePlan"];
|
|
851
931
|
/**
|
|
852
932
|
* Revoke a scheduled plan change
|
|
@@ -865,7 +945,10 @@ export interface paths {
|
|
|
865
945
|
path?: never;
|
|
866
946
|
cookie?: never;
|
|
867
947
|
};
|
|
868
|
-
/**
|
|
948
|
+
/**
|
|
949
|
+
* List Stripe invoices
|
|
950
|
+
* @description Invoices are ordered newest first. Page older with `starting_after` set to the last `id` of the previous page.
|
|
951
|
+
*/
|
|
869
952
|
get: operations["listInvoices"];
|
|
870
953
|
put?: never;
|
|
871
954
|
post?: never;
|
|
@@ -991,6 +1074,7 @@ export interface paths {
|
|
|
991
1074
|
/**
|
|
992
1075
|
* Detach a payment method
|
|
993
1076
|
* @description Detaches the specified payment method from the Stripe customer.
|
|
1077
|
+
* Removing the last card also turns auto-topup off.
|
|
994
1078
|
*/
|
|
995
1079
|
delete: operations["deletePaymentMethod"];
|
|
996
1080
|
options?: never;
|
|
@@ -1145,8 +1229,9 @@ export interface paths {
|
|
|
1145
1229
|
put?: never;
|
|
1146
1230
|
/**
|
|
1147
1231
|
* Accept current Terms of Service
|
|
1148
|
-
* @description Records the
|
|
1149
|
-
* Service version (clickwrap
|
|
1232
|
+
* @description Records the signed-in person's own acceptance of the current Terms of
|
|
1233
|
+
* Service version (clickwrap). The record is per person, so each member of
|
|
1234
|
+
* an account accepts for themselves. The server always records the
|
|
1150
1235
|
* current version — the client cannot accept an arbitrary version. The
|
|
1151
1236
|
* client IP and User-Agent are captured as legal evidence. Requires an
|
|
1152
1237
|
* active membership.
|
|
@@ -1169,9 +1254,10 @@ export interface paths {
|
|
|
1169
1254
|
put?: never;
|
|
1170
1255
|
/**
|
|
1171
1256
|
* Mark onboarding as finished
|
|
1172
|
-
* @description Records that the
|
|
1173
|
-
* of its exits, so `onboarding_completed`
|
|
1174
|
-
*
|
|
1257
|
+
* @description Records that the signed-in person left the dashboard's onboarding flow
|
|
1258
|
+
* through one of its exits, so both `onboarding_completed` (the account) and
|
|
1259
|
+
* `user_onboarding_completed` (this person) on GET /v1/account read true
|
|
1260
|
+
* from then on. Idempotent: a repeat call keeps the first timestamps and still
|
|
1175
1261
|
* answers 200. Requires an active membership (admin or member).
|
|
1176
1262
|
*/
|
|
1177
1263
|
post: operations["completeOnboarding"];
|
|
@@ -1461,6 +1547,14 @@ export interface components {
|
|
|
1461
1547
|
details?: unknown;
|
|
1462
1548
|
};
|
|
1463
1549
|
};
|
|
1550
|
+
/** @description The vendor-masked `503` body of `POST /v1/search`. */
|
|
1551
|
+
CreateSearchResponse503: {
|
|
1552
|
+
/**
|
|
1553
|
+
* @description Fixed vendor-masked error code. Always `search_provider_error`; the upstream provider's identity and failure detail are withheld by design.
|
|
1554
|
+
* @enum {string}
|
|
1555
|
+
*/
|
|
1556
|
+
error: "search_provider_error";
|
|
1557
|
+
};
|
|
1464
1558
|
/**
|
|
1465
1559
|
* @description Item-local terminal artifact failure. The item's stable id remains usable for paginated recovery, but the requested stored content or signed reference could not be produced. Wherever this code is raised the URL field it describes is `null`; a private object-storage URL is never returned as a substitute for it. Endpoints that do not raise this code document their own fallback — see `image_url` on `GET /v1/bulk/{id}/screenshots`.
|
|
1466
1560
|
*
|
|
@@ -1645,10 +1739,11 @@ export interface components {
|
|
|
1645
1739
|
BillingNode: {
|
|
1646
1740
|
/**
|
|
1647
1741
|
* @description The unmultiplied basis of the charge. For byte-billed endpoints this is
|
|
1648
|
-
* the upstream wire bytes actually transferred. For
|
|
1649
|
-
*
|
|
1650
|
-
*
|
|
1651
|
-
*
|
|
1742
|
+
* the upstream wire bytes actually transferred. For a page served by the
|
|
1743
|
+
* hosted-browser tier it is the browser's full measured transfer. For
|
|
1744
|
+
* screenshots and recordings it is the Phase 1 HTML fetch's wire bytes — the
|
|
1745
|
+
* only proxied traffic in the happy path — never the size of the returned
|
|
1746
|
+
* PNG/JPEG/MP4 artifact.
|
|
1652
1747
|
* @example 1024
|
|
1653
1748
|
*/
|
|
1654
1749
|
raw_bytes: number;
|
|
@@ -1671,11 +1766,19 @@ export interface components {
|
|
|
1671
1766
|
/** Format: uri */
|
|
1672
1767
|
url: string;
|
|
1673
1768
|
/**
|
|
1769
|
+
* @description What to return. Each entry is either a string format (`raw`, `markdown`, `links`
|
|
1770
|
+
* or `images`) or a `json` object entry that extracts structured data from the page.
|
|
1771
|
+
* The string `"json"` is not a format value; the `json` entry is an object, described
|
|
1772
|
+
* by `ScrapeRequestJsonFormat`. A list may hold at most one `json` entry, and a list
|
|
1773
|
+
* holding only the `json` entry still captures `raw`. The `json` entry exists on
|
|
1774
|
+
* `POST /v1/scrape` only: the bulk and monitor `formats` fields accept the string
|
|
1775
|
+
* formats alone. Its result is `formats.json` on the response, and its price is
|
|
1776
|
+
* described on `ScrapeRequestJsonFormat`.
|
|
1674
1777
|
* @default [
|
|
1675
1778
|
* "raw"
|
|
1676
1779
|
* ]
|
|
1677
1780
|
*/
|
|
1678
|
-
formats: ("
|
|
1781
|
+
formats: (components["schemas"]["ScrapeRequestFormatsItem"] | components["schemas"]["ScrapeRequestJsonFormat"])[];
|
|
1679
1782
|
/** @default US */
|
|
1680
1783
|
country: string;
|
|
1681
1784
|
/**
|
|
@@ -1683,10 +1786,10 @@ export interface components {
|
|
|
1683
1786
|
* @default 0
|
|
1684
1787
|
*/
|
|
1685
1788
|
delay_ms: number;
|
|
1686
|
-
/** @default
|
|
1789
|
+
/** @default 60000 */
|
|
1687
1790
|
timeout_ms: number;
|
|
1688
1791
|
/**
|
|
1689
|
-
* @description When true, the request returns 202 with a `ScrapeQueuedEnvelope` receipt immediately and the scrape runs in the background; poll `GET /v1/scrape/{id}` for the result.
|
|
1792
|
+
* @description When true, the request returns 202 with a `ScrapeQueuedEnvelope` receipt immediately and the scrape runs in the background; poll `GET /v1/scrape/{id}` for the result. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other. Asking for a receipt this way outranks every routing consequence: when neither is set (the default) a browser-path request is held to completion instead of being receipted. A 202 can still arrive without either, but only when the hold window expires.
|
|
1690
1793
|
* @default false
|
|
1691
1794
|
*/
|
|
1692
1795
|
async: boolean;
|
|
@@ -1791,6 +1894,47 @@ export interface components {
|
|
|
1791
1894
|
*/
|
|
1792
1895
|
x_internal_scrape_path?: "lean-forced";
|
|
1793
1896
|
};
|
|
1897
|
+
/**
|
|
1898
|
+
* @description A string entry of `ScrapeRequest.formats`.
|
|
1899
|
+
* @enum {string}
|
|
1900
|
+
*/
|
|
1901
|
+
ScrapeRequestFormatsItem: "raw" | "markdown" | "links" | "images";
|
|
1902
|
+
/**
|
|
1903
|
+
* @description The `json` entry of `ScrapeRequest.formats`: structured extraction over the scraped
|
|
1904
|
+
* page, using the same extractor as `POST /v1/schema`.
|
|
1905
|
+
*
|
|
1906
|
+
* **Price.** Each `json` entry costs 10 credits, charged only when the extraction
|
|
1907
|
+
* validates (`formats.json.validated` is `true`). The charge is on top of the scrape's
|
|
1908
|
+
* own charge and is never scaled by the scrape's factors. The 10 credits are reserved at
|
|
1909
|
+
* admission in every billing mode and released again when the extraction does not
|
|
1910
|
+
* validate. This price is provisional.
|
|
1911
|
+
*
|
|
1912
|
+
* **Errors.** A `schema` the extractor cannot take is refused with
|
|
1913
|
+
* `422 schema_incompatible`, and a deployment with no extraction provider refuses the
|
|
1914
|
+
* request with `503 provider_unavailable`. Both are refused before anything is drawn. Once
|
|
1915
|
+
* the page is scraped, an extraction that does not validate never fails the scrape: the
|
|
1916
|
+
* result carries `validated: false` and `data: null`, with an extraction warning in
|
|
1917
|
+
* `warnings`.
|
|
1918
|
+
*/
|
|
1919
|
+
ScrapeRequestJsonFormat: {
|
|
1920
|
+
/** @enum {string} */
|
|
1921
|
+
type: "json";
|
|
1922
|
+
/**
|
|
1923
|
+
* @description JSON Schema describing the desired output. It is held to the same guards as the
|
|
1924
|
+
* `schema` field of `POST /v1/schema`: serialized size at most 50 KB, nesting depth at
|
|
1925
|
+
* most 8, it must compile under Ajv, and it must be normalizable into the extractor's
|
|
1926
|
+
* strict subset (root `type: object`, and only the keyword allowlist given there).
|
|
1927
|
+
*/
|
|
1928
|
+
schema: Record<string, never>;
|
|
1929
|
+
/**
|
|
1930
|
+
* @description Extraction model.
|
|
1931
|
+
* @default openai/gpt-oss-20b
|
|
1932
|
+
* @enum {string}
|
|
1933
|
+
*/
|
|
1934
|
+
model: "openai/gpt-oss-20b" | "openai/gpt-oss-120b";
|
|
1935
|
+
/** @description Optional natural-language extraction hint. */
|
|
1936
|
+
prompt?: string;
|
|
1937
|
+
};
|
|
1794
1938
|
ScrapeScoredLink: {
|
|
1795
1939
|
/** Format: uri */
|
|
1796
1940
|
url: string;
|
|
@@ -1815,8 +1959,11 @@ export interface components {
|
|
|
1815
1959
|
cols: number;
|
|
1816
1960
|
};
|
|
1817
1961
|
ScrapeWarning: {
|
|
1818
|
-
/**
|
|
1819
|
-
|
|
1962
|
+
/**
|
|
1963
|
+
* @description Machine-readable warning code. `truncated` means the markdown was cut to fit the requested `tokenBudget`. `short_content` means a successful browser capture of an HTML page produced very little readable text (under 100 characters), which usually means the page needed an interaction such as scrolling or clicking that the capture did not perform; a genuinely short page can raise it too. `frames_skipped` means a browser capture left out one or more iframes (cross-origin ones, which the capture cannot read, or same-origin ones that failed or were still loading), so content inside them may be missing from the returned HTML. `short_content` and `frames_skipped` are advisory: they never change the response status, error code or billed bytes.
|
|
1964
|
+
* @enum {string}
|
|
1965
|
+
*/
|
|
1966
|
+
code: "lossy_table" | "complex_math" | "unsupported_element" | "extraction_fallback" | "truncated" | "query_no_match" | "mode_disabled_fallback" | "artifact_unavailable" | "llm_clean_unavailable" | "llm_clean_failed" | "low_quality_extraction" | "fragment_menu_stripped" | "extract_validation_failed" | "exhausted_retries" | "content_truncated" | "model_refusal" | "empty_extraction" | "short_content" | "frames_skipped";
|
|
1820
1967
|
message: string;
|
|
1821
1968
|
element: string | null;
|
|
1822
1969
|
};
|
|
@@ -1841,6 +1988,19 @@ export interface components {
|
|
|
1841
1988
|
links?: string[] | components["schemas"]["ScrapeScoredLink"][];
|
|
1842
1989
|
/** @description Plain URL strings by default. When markdownIncludeMedia=true, an array of ScrapeScoredImage objects. */
|
|
1843
1990
|
images?: string[] | components["schemas"]["ScrapeScoredImage"][];
|
|
1991
|
+
/**
|
|
1992
|
+
* @description The result of the request's `json` format entry. Present on every outcome of a
|
|
1993
|
+
* request that carried one. A failed extraction never fails the scrape: it sets
|
|
1994
|
+
* `validated` to `false` and adds an extraction warning code to `warnings`.
|
|
1995
|
+
*/
|
|
1996
|
+
json?: {
|
|
1997
|
+
/** @description The extracted object, or `null` whenever `validated` is `false`. */
|
|
1998
|
+
data: Record<string, never> | null;
|
|
1999
|
+
/** @description Whether the extraction produced output matching the schema. The `json` credits are charged only when `true`. */
|
|
2000
|
+
validated: boolean;
|
|
2001
|
+
/** @description The extraction model that ran. */
|
|
2002
|
+
model: string;
|
|
2003
|
+
};
|
|
1844
2004
|
};
|
|
1845
2005
|
ScrapeMetadata: {
|
|
1846
2006
|
title: string | null;
|
|
@@ -1952,6 +2112,8 @@ export interface components {
|
|
|
1952
2112
|
* @description Compressed wire bytes transferred for this request — the basis for
|
|
1953
2113
|
* bandwidth-billed plans. Reflects what crossed the network on your behalf
|
|
1954
2114
|
* (e.g. gzip/brotli-compressed size), not the decompressed content length.
|
|
2115
|
+
* A page served by the hosted-browser tier reports the browser's full
|
|
2116
|
+
* measured transfer instead: every response it loaded plus the requests it sent.
|
|
1955
2117
|
*/
|
|
1956
2118
|
content_length: number;
|
|
1957
2119
|
status_code: number | null;
|
|
@@ -2023,9 +2185,11 @@ export interface components {
|
|
|
2023
2185
|
id: string | null;
|
|
2024
2186
|
error: {
|
|
2025
2187
|
/** @enum {string} */
|
|
2026
|
-
code: "validation_error" | "invalid_url" | "request_too_large" | "payload_too_large" | "unsupported_content_type" | "rate_limited" | "upstream_error" | "blocked" | "timeout" | "internal_error";
|
|
2188
|
+
code: "validation_error" | "invalid_url" | "request_too_large" | "payload_too_large" | "unsupported_content_type" | "rate_limited" | "upstream_error" | "blocked" | "target_rate_limited" | "timeout" | "internal_error";
|
|
2027
2189
|
message: string;
|
|
2028
2190
|
http_status?: number;
|
|
2191
|
+
/** @description Whole seconds the target site asked us to wait before the next request. Present only with `code: target_rate_limited`, only on the inline `POST /v1/scrape` failure the fast path decides, and only when the target sent a usable `Retry-After` (delta-seconds, or an HTTP-date still in the future, converted to seconds; values above 2147483647 are reported as 2147483647). Informational: ByteKit never enforces it on your next request. A held render (`delay_ms > 0`), `GET /v1/scrape/{id}` and webhooks omit it, because the value is relative to the moment the target answered. */
|
|
2192
|
+
retry_after_seconds?: number;
|
|
2029
2193
|
/** Format: date-time */
|
|
2030
2194
|
failed_at: string;
|
|
2031
2195
|
};
|
|
@@ -2066,7 +2230,10 @@ export interface components {
|
|
|
2066
2230
|
FetchRequest: {
|
|
2067
2231
|
/** Format: uri */
|
|
2068
2232
|
url: string;
|
|
2069
|
-
/**
|
|
2233
|
+
/**
|
|
2234
|
+
* @description Two-letter country code. Either case is accepted; the value is upper-cased.
|
|
2235
|
+
* @default US
|
|
2236
|
+
*/
|
|
2070
2237
|
country: string;
|
|
2071
2238
|
/** @default 60000 */
|
|
2072
2239
|
timeout_ms: number;
|
|
@@ -2093,6 +2260,11 @@ export interface components {
|
|
|
2093
2260
|
device: "desktop" | "mobile";
|
|
2094
2261
|
/** @default null */
|
|
2095
2262
|
viewport: components["schemas"]["Viewport"] | null;
|
|
2263
|
+
/**
|
|
2264
|
+
* @description When true, the request returns 202 immediately and the screenshot is captured in the background; poll `GET /v1/screenshots/{id}`. The `?async=true` query parameter is a second spelling of this field: the request is async when either one says true, and `false` in one never cancels `true` in the other.
|
|
2265
|
+
* @default false
|
|
2266
|
+
*/
|
|
2267
|
+
async: boolean;
|
|
2096
2268
|
/** @default false */
|
|
2097
2269
|
full_page: boolean;
|
|
2098
2270
|
/**
|
|
@@ -2429,9 +2601,26 @@ export interface components {
|
|
|
2429
2601
|
captured_at: string;
|
|
2430
2602
|
};
|
|
2431
2603
|
SitemapRequest: {
|
|
2432
|
-
/**
|
|
2604
|
+
/**
|
|
2605
|
+
* Format: uri
|
|
2606
|
+
* @description The site to discover. Sitemap discovery is host-scoped (`robots.txt`
|
|
2607
|
+
* and `/sitemap.xml` live at the host root), so only the scheme and host
|
|
2608
|
+
* are used: a path, query string or fragment is accepted but ignored,
|
|
2609
|
+
* and the `202` response carries a `warnings` entry saying so. A bare
|
|
2610
|
+
* host, or a host with just a trailing `/`, produces no warning.
|
|
2611
|
+
*/
|
|
2433
2612
|
url: string;
|
|
2434
2613
|
/**
|
|
2614
|
+
* @description How much discovery work the job does.
|
|
2615
|
+
*
|
|
2616
|
+
* - `quick` — reads `robots.txt` and the XML sitemaps only. Every
|
|
2617
|
+
* result has `source: sitemap`.
|
|
2618
|
+
* - `standard` — the `quick` sources, then fills any remaining
|
|
2619
|
+
* `max_urls` budget with URLs from your account's completed scrapes of
|
|
2620
|
+
* the host in the last 90 days (`source: known`).
|
|
2621
|
+
* - `deep` — the `standard` sources, then crawls page links outward from
|
|
2622
|
+
* the URLs found so far, up to `max_depth` levels, until `max_urls` is
|
|
2623
|
+
* reached (`source: links`).
|
|
2435
2624
|
* @default standard
|
|
2436
2625
|
* @enum {string}
|
|
2437
2626
|
*/
|
|
@@ -2440,7 +2629,11 @@ export interface components {
|
|
|
2440
2629
|
max_depth: number;
|
|
2441
2630
|
/** @default 5000 */
|
|
2442
2631
|
max_urls: number;
|
|
2443
|
-
/**
|
|
2632
|
+
/**
|
|
2633
|
+
* @description Accepted, stored and echoed back on the job, but it has no effect: the
|
|
2634
|
+
* worker logs that the trigger is not implemented and ignores it.
|
|
2635
|
+
* @default null
|
|
2636
|
+
*/
|
|
2444
2637
|
process: {
|
|
2445
2638
|
action?: string;
|
|
2446
2639
|
options?: {
|
|
@@ -2469,6 +2662,17 @@ export interface components {
|
|
|
2469
2662
|
SitemapResponse: {
|
|
2470
2663
|
/** @example sm_01j9abc123 */
|
|
2471
2664
|
id: string;
|
|
2665
|
+
/**
|
|
2666
|
+
* @description On the `202` creation response, the submitted URL after ByteKit has
|
|
2667
|
+
* normalised it, when that URL carried a path, query string or fragment
|
|
2668
|
+
* (discovery still ran on the host only; see `warnings`). Normalisation
|
|
2669
|
+
* lowercases the scheme and host, puts an international host in
|
|
2670
|
+
* punycode, percent-encodes non-ASCII characters and trims surrounding
|
|
2671
|
+
* spaces, so the value can differ from the string you sent. In every
|
|
2672
|
+
* other case (a bare-host request, `GET /v1/sitemap/{id}` and the
|
|
2673
|
+
* webhook `data` object) it is the host the job is scoped to, as
|
|
2674
|
+
* `scheme://host`.
|
|
2675
|
+
*/
|
|
2472
2676
|
url: string;
|
|
2473
2677
|
strategy: string;
|
|
2474
2678
|
max_depth: number;
|
|
@@ -2507,17 +2711,42 @@ export interface components {
|
|
|
2507
2711
|
* for jobs that completed before the billing node was persisted.
|
|
2508
2712
|
*/
|
|
2509
2713
|
billing?: components["schemas"]["BillingNode"];
|
|
2714
|
+
/**
|
|
2715
|
+
* @description On the `202` creation response, a single entry naming the path, query
|
|
2716
|
+
* string or fragment of the submitted `url` that host-scoped discovery
|
|
2717
|
+
* ignored. It never fails the request. It is not stored with the job:
|
|
2718
|
+
* `GET /v1/sitemap/{id}` and the webhook `data` object report the
|
|
2719
|
+
* worker's own warnings, or `null`.
|
|
2720
|
+
*/
|
|
2510
2721
|
warnings: string[] | null;
|
|
2722
|
+
/**
|
|
2723
|
+
* @description Why a `failed` job failed; `null` otherwise. One of the values below. It is typed as
|
|
2724
|
+
* a free string so that a code added later does not break a client.
|
|
2725
|
+
*
|
|
2726
|
+
* - `job_timeout` — the job ran past its time limit.
|
|
2727
|
+
* - `blocked` — the host sits behind a WAF that blocks every discovery
|
|
2728
|
+
* phase, so the job did not run.
|
|
2729
|
+
* - `no_urls_found` — discovery finished with no URLs for the host.
|
|
2730
|
+
* - `internal_error` — an unexpected error while discovering.
|
|
2731
|
+
* - `worker_crash` — the job sat in `processing` far past the recovery
|
|
2732
|
+
* threshold, so it was failed as a worker crash.
|
|
2733
|
+
*/
|
|
2511
2734
|
error_code: string | null;
|
|
2512
2735
|
error_message: string | null;
|
|
2513
2736
|
compact: boolean;
|
|
2737
|
+
/** @description The `process` value from the request, echoed back. It has no effect. */
|
|
2514
2738
|
process: Record<string, never> | null;
|
|
2515
2739
|
metadata: Record<string, never> | null;
|
|
2516
2740
|
/** Format: date-time */
|
|
2517
2741
|
created_at: string;
|
|
2518
2742
|
/** Format: date-time */
|
|
2519
2743
|
completed_at: string | null;
|
|
2520
|
-
/**
|
|
2744
|
+
/**
|
|
2745
|
+
* Format: date-time
|
|
2746
|
+
* @description When the job and its results expire: 90 days after the job completes. `null` until the
|
|
2747
|
+
* job completes, and on a failed job. A `cache: hit` response keeps the expiry of the job
|
|
2748
|
+
* that answered it.
|
|
2749
|
+
*/
|
|
2521
2750
|
expires_at: string | null;
|
|
2522
2751
|
};
|
|
2523
2752
|
WebhookDeliveryResponse: {
|
|
@@ -2528,7 +2757,7 @@ export interface components {
|
|
|
2528
2757
|
* @example bulk.completed
|
|
2529
2758
|
* @enum {string}
|
|
2530
2759
|
*/
|
|
2531
|
-
event_type: "bulk.completed" | "scrape.completed" | "scrape.failed" | "monitor.change_detected" | "monitor.captured" | "sitemap.completed" | "sitemap.failed";
|
|
2760
|
+
event_type: "bulk.completed" | "scrape.completed" | "scrape.failed" | "monitor.change_detected" | "monitor.captured" | "monitor.suspended" | "sitemap.completed" | "sitemap.failed";
|
|
2532
2761
|
target_url: string;
|
|
2533
2762
|
/** @enum {string} */
|
|
2534
2763
|
status: "pending" | "delivered" | "failed" | "exhausted";
|
|
@@ -2727,7 +2956,7 @@ export interface components {
|
|
|
2727
2956
|
/** @description Whether the account admin wants an email when bandwidth reaches 100 % of the plan limit. */
|
|
2728
2957
|
bandwidth_100_enabled: boolean;
|
|
2729
2958
|
};
|
|
2730
|
-
/** @description The Terms of Service version
|
|
2959
|
+
/** @description The Terms of Service version the calling person has accepted. The record is per person, not per account: each member of an account accepts for themselves. An empty string means this person has never accepted the Terms; acceptance is recorded only by `POST /v1/account/accept-terms`, never by bootstrap (issues #5055, #5057). The dashboard diffs this against the published current version to decide whether to show the re-acceptance prompt. */
|
|
2731
2960
|
terms_version: string;
|
|
2732
2961
|
/** Format: date-time */
|
|
2733
2962
|
created_at: string;
|
|
@@ -2735,6 +2964,8 @@ export interface components {
|
|
|
2735
2964
|
has_activity: boolean;
|
|
2736
2965
|
/** @description True once a member of the account left onboarding through one of its exits (POST /v1/account/complete-onboarding). Never reset. With `has_activity` it gates the dashboard: the app shows the guided onboarding flow until either one is true, so a user whose first request failed can still reach the dashboard. */
|
|
2737
2966
|
onboarding_completed: boolean;
|
|
2967
|
+
/** @description True once the calling person left onboarding through one of its exits (POST /v1/account/complete-onboarding). Never reset. False sends this person through the guided onboarding flow even when the account itself is active or finished onboarding, so a teammate invited into an existing account still accepts the Terms and sees the API key once. */
|
|
2968
|
+
user_onboarding_completed: boolean;
|
|
2738
2969
|
/** @description True when the account has a Stripe subscription, keyed on the same `stripe_subscription_id` column that GET /v1/billing/change-plan's `no_subscription` guard tests — so a client can use it to decide whether that endpoint will answer at all. Stays TRUE while a subscription is mid-cancellation (cancelled but running to the period end): the subscription still exists and a booked plan change is still revocable. It is a boolean, not the bearer path's `subscription` object: this response has no role-dependent fields, so a non-admin member receives it too, and plan pricing does not belong there. */
|
|
2739
2970
|
has_subscription: boolean;
|
|
2740
2971
|
};
|
|
@@ -2765,7 +2996,7 @@ export interface components {
|
|
|
2765
2996
|
/** @description Whether the account admin wants an email when bandwidth reaches 100 % of the plan limit. */
|
|
2766
2997
|
bandwidth_100_enabled: boolean;
|
|
2767
2998
|
};
|
|
2768
|
-
/** @description The Terms of Service version
|
|
2999
|
+
/** @description The Terms of Service version the calling person has accepted. The record is per person, not per account: each member of an account accepts for themselves. An empty string means this person has never accepted the Terms; acceptance is recorded only by `POST /v1/account/accept-terms`, never by bootstrap (issues #5055, #5057). The dashboard diffs this against the published current version to decide whether to show the re-acceptance prompt. */
|
|
2769
3000
|
terms_version: string;
|
|
2770
3001
|
/** @description True when the account has a Stripe subscription, keyed on the same `stripe_subscription_id` column that GET /v1/billing/change-plan's `no_subscription` guard tests. */
|
|
2771
3002
|
has_subscription: boolean;
|
|
@@ -2883,6 +3114,45 @@ export interface components {
|
|
|
2883
3114
|
"application/json": components["schemas"]["Error"];
|
|
2884
3115
|
};
|
|
2885
3116
|
};
|
|
3117
|
+
/**
|
|
3118
|
+
* @description Unauthorized. The request carried no valid credential, and no work was
|
|
3119
|
+
* performed. The unified `Error` envelope carries one of the codes below
|
|
3120
|
+
* in `error.code`; match on the code, never on the prose.
|
|
3121
|
+
*
|
|
3122
|
+
* - `invalid_api_key` — a bearer API key was presented and rejected:
|
|
3123
|
+
* unknown, revoked, expired or malformed. The bearer-only operations
|
|
3124
|
+
* (`/v1/webhook-deliveries*` among them) also return it when no
|
|
3125
|
+
* `Authorization` header is sent. `GET /v1/account` is the exception
|
|
3126
|
+
* to "malformed": it returns `invalid_api_key` only for a key that
|
|
3127
|
+
* starts `sk_test_` or `sk_live_` and is unknown, revoked or expired.
|
|
3128
|
+
* - `unauthorized` — the `Authorization` header is absent or malformed on
|
|
3129
|
+
* an operation that also accepts a dashboard session (the dual-auth and
|
|
3130
|
+
* billing operations). `GET /v1/account` also returns it, for no
|
|
3131
|
+
* `Authorization` header and for any bearer value that does not start
|
|
3132
|
+
* `sk_test_` or `sk_live_` (that value is checked as a dashboard
|
|
3133
|
+
* session token).
|
|
3134
|
+
*
|
|
3135
|
+
* Not retryable as-is: supply a valid API key first.
|
|
3136
|
+
*/
|
|
3137
|
+
Unauthorized: {
|
|
3138
|
+
headers: {
|
|
3139
|
+
[name: string]: unknown;
|
|
3140
|
+
};
|
|
3141
|
+
content: {
|
|
3142
|
+
/**
|
|
3143
|
+
* @example {
|
|
3144
|
+
* "status": "failed",
|
|
3145
|
+
* "error": {
|
|
3146
|
+
* "code": "invalid_api_key",
|
|
3147
|
+
* "message": "Missing or invalid API key.",
|
|
3148
|
+
* "http_status": 401,
|
|
3149
|
+
* "failed_at": "2026-01-15T12:00:00Z"
|
|
3150
|
+
* }
|
|
3151
|
+
* }
|
|
3152
|
+
*/
|
|
3153
|
+
"application/json": components["schemas"]["Error"];
|
|
3154
|
+
};
|
|
3155
|
+
};
|
|
2886
3156
|
};
|
|
2887
3157
|
parameters: {
|
|
2888
3158
|
/**
|
|
@@ -2902,7 +3172,16 @@ export interface components {
|
|
|
2902
3172
|
*/
|
|
2903
3173
|
ClientSurfaceMarker: string;
|
|
2904
3174
|
FetchUrl: string;
|
|
3175
|
+
/** @description Two-letter country code. Either case is accepted; the value is upper-cased. */
|
|
2905
3176
|
FetchCountry: string;
|
|
3177
|
+
/**
|
|
3178
|
+
* @description A JSON-encoded object, URL-encoded in the query string. It is echoed back base64-encoded in
|
|
3179
|
+
* the `X-Fetch-Custom` response header so callers can correlate the response to caller-side
|
|
3180
|
+
* state. Capped at 4096 UTF-8 bytes after JSON serialization, and not part of the cache key.
|
|
3181
|
+
* A value that is not valid JSON answers `422 validation_error` ("custom must be a
|
|
3182
|
+
* JSON-encoded object"); valid JSON that is not an object is also rejected with `422`.
|
|
3183
|
+
*/
|
|
3184
|
+
FetchCustom: string;
|
|
2906
3185
|
FetchTimeoutMs: number;
|
|
2907
3186
|
/** @description How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message. */
|
|
2908
3187
|
FetchCacheTtl: string | 0;
|
|
@@ -2941,9 +3220,10 @@ export interface components {
|
|
|
2941
3220
|
XFetchURL: string;
|
|
2942
3221
|
/**
|
|
2943
3222
|
* @description Byte length of the response body served on this request (integer as string) — NOT the
|
|
2944
|
-
* billing basis.
|
|
2945
|
-
*
|
|
2946
|
-
*
|
|
3223
|
+
* billing basis. When `X-Fetch-Fast-Path` is `true` the body is the upstream response
|
|
3224
|
+
* bytes, so this equals the upstream wire byte count. When it is `false` the body is the
|
|
3225
|
+
* rendered page, and this is that page's compressed size. Billing always reads the
|
|
3226
|
+
* compressed wire bytes from `X-Raw-Bytes` / `X-Billable-Bytes`, on every path.
|
|
2947
3227
|
*/
|
|
2948
3228
|
XFetchContentLength: string;
|
|
2949
3229
|
XFetchCreditsCharged: string;
|
|
@@ -3034,6 +3314,7 @@ export interface operations {
|
|
|
3034
3314
|
"application/json": components["schemas"]["AccountBearerResponse"] | components["schemas"]["AccountSessionResponse"];
|
|
3035
3315
|
};
|
|
3036
3316
|
};
|
|
3317
|
+
401: components["responses"]["Unauthorized"];
|
|
3037
3318
|
/** @description Rate limit exceeded (`rate_limited`). Only reachable when authenticated via Clerk session (the 60-request/60-second per-user window) — the bearer and in-process auth branches are not rate-limited at this endpoint. Carries a `Retry-After` header derived from the same clock as the window reset. */
|
|
3038
3319
|
429: {
|
|
3039
3320
|
headers: {
|
|
@@ -3386,6 +3667,7 @@ export interface operations {
|
|
|
3386
3667
|
createScreenshot: {
|
|
3387
3668
|
parameters: {
|
|
3388
3669
|
query?: {
|
|
3670
|
+
/** @description Query-string spelling of the body `async` field. `true` returns the 202 immediately; any other value is ignored. */
|
|
3389
3671
|
async?: boolean;
|
|
3390
3672
|
};
|
|
3391
3673
|
header?: never;
|
|
@@ -3491,7 +3773,25 @@ export interface operations {
|
|
|
3491
3773
|
"application/json": components["schemas"]["Error"];
|
|
3492
3774
|
};
|
|
3493
3775
|
};
|
|
3776
|
+
401: components["responses"]["Unauthorized"];
|
|
3494
3777
|
402: components["responses"]["PaymentRequired"];
|
|
3778
|
+
/**
|
|
3779
|
+
* @description The target is on ByteKit's blocklist. Nothing is captured and nothing is billed.
|
|
3780
|
+
* The unified `Error` envelope carries one of two codes:
|
|
3781
|
+
*
|
|
3782
|
+
* - `host_forbidden` — a blocked domain, any `.gov` host, or a blocked port.
|
|
3783
|
+
* `details` is `{ host }`.
|
|
3784
|
+
* - `path_forbidden` — an authentication-style path such as a login page.
|
|
3785
|
+
* `details` is `{ path }`.
|
|
3786
|
+
*/
|
|
3787
|
+
403: {
|
|
3788
|
+
headers: {
|
|
3789
|
+
[name: string]: unknown;
|
|
3790
|
+
};
|
|
3791
|
+
content: {
|
|
3792
|
+
"application/json": components["schemas"]["Error"];
|
|
3793
|
+
};
|
|
3794
|
+
};
|
|
3495
3795
|
/**
|
|
3496
3796
|
* @description Validation error, or a screenshot that failed inside the sync hold.
|
|
3497
3797
|
* The two carry DIFFERENT bodies (issue #2679):
|
|
@@ -3580,6 +3880,7 @@ export interface operations {
|
|
|
3580
3880
|
"application/json": components["schemas"]["ScreenshotResponse"];
|
|
3581
3881
|
};
|
|
3582
3882
|
};
|
|
3883
|
+
401: components["responses"]["Unauthorized"];
|
|
3583
3884
|
/** @description Resource not found. */
|
|
3584
3885
|
404: {
|
|
3585
3886
|
headers: {
|
|
@@ -3593,7 +3894,10 @@ export interface operations {
|
|
|
3593
3894
|
};
|
|
3594
3895
|
createScrape: {
|
|
3595
3896
|
parameters: {
|
|
3596
|
-
query?:
|
|
3897
|
+
query?: {
|
|
3898
|
+
/** @description Query-string spelling of the body `async` field. `true` returns the 202 receipt immediately; any other value is ignored. Either spelling turns async on, and `false` in one never cancels `true` in the other. */
|
|
3899
|
+
async?: boolean;
|
|
3900
|
+
};
|
|
3597
3901
|
header?: never;
|
|
3598
3902
|
path?: never;
|
|
3599
3903
|
cookie?: never;
|
|
@@ -3624,7 +3928,7 @@ export interface operations {
|
|
|
3624
3928
|
};
|
|
3625
3929
|
};
|
|
3626
3930
|
responses: {
|
|
3627
|
-
/** @description Scrape reached a terminal state and the body is that terminal envelope: `success` carrying content, or `failed` carrying the error envelope. Returned by the fast HTTP path in one round trip, and by a browser-path request without `async: true` once its render reaches a terminal state inside the hold window. A held render that ends in failure answers 200 with the same `failed` envelope `GET /v1/scrape/{id}` returns — narrow on `status` before reading the body. A definitive upstream outcome is a result, not a transport error: an unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all answer 200 with the `failed` envelope, never a 5xx. An inline failure is recorded as a failed job, so its envelope normally carries that job's `id` and polling it returns the same envelope; `id` is `null` only when recording the failed job itself failed. `error.http_status` is present only when a real upstream HTTP status is known. */
|
|
3931
|
+
/** @description Scrape reached a terminal state and the body is that terminal envelope: `success` carrying content, or `failed` carrying the error envelope. Returned by the fast HTTP path in one round trip, and by a browser-path request without `async: true` or `?async=true` once its render reaches a terminal state inside the hold window. A held render that ends in failure answers 200 with the same `failed` envelope `GET /v1/scrape/{id}` returns — narrow on `status` before reading the body. A definitive upstream outcome is a result, not a transport error: an unreachable host, a refused connection, or a target whose bot protection defeats every proxy tier all answer 200 with the `failed` envelope, never a 5xx. An inline failure is recorded as a failed job, so its envelope normally carries that job's `id` and polling it returns the same envelope; `id` is `null` only when recording the failed job itself failed. `error.http_status` is present only when a real upstream HTTP status is known. */
|
|
3628
3932
|
200: {
|
|
3629
3933
|
headers: {
|
|
3630
3934
|
/** @description Stable scrape identifier (also present on the envelope as `id`). */
|
|
@@ -3647,7 +3951,7 @@ export interface operations {
|
|
|
3647
3951
|
"X-Scrape-Status-Code"?: number;
|
|
3648
3952
|
/** @description Compressed wire bytes — the basis for bandwidth billing. */
|
|
3649
3953
|
"X-Scrape-Content-Length"?: number;
|
|
3650
|
-
/** @description
|
|
3954
|
+
/** @description Compressed wire byte count of the body, measured before any billing multiplication. It is not the decompressed size. */
|
|
3651
3955
|
"X-Raw-Bytes"?: number;
|
|
3652
3956
|
/** @description Chargeable bytes after applying the billing multiplier. Equals round(X-Raw-Bytes × X-Billing-Multiplier). */
|
|
3653
3957
|
"X-Billable-Bytes"?: number;
|
|
@@ -3675,9 +3979,9 @@ export interface operations {
|
|
|
3675
3979
|
"X-Scrape-Markdown-URL"?: string;
|
|
3676
3980
|
/** @description Byte length of the markdown artifact. Present only on fast-path responses when formats includes markdown. */
|
|
3677
3981
|
"X-Scrape-Markdown-Length"?: number;
|
|
3678
|
-
/** @description Legacy numeric form of the tier that served: 1 datacenter, 2 residential, 3 mobile. Omitted for the lean-browser
|
|
3982
|
+
/** @description Legacy numeric form of the tier that served: 1 datacenter, 2 residential, 3 mobile. Omitted for the lean-browser and hosted-browser tiers, which have no numeric form. Deprecated — use X-Scrape-Proxy-Tier-Label. */
|
|
3679
3983
|
"X-Scrape-Proxy-Tier"?: number;
|
|
3680
|
-
/** @description The proxy tier that actually served this request's fetch, after any escalation — never the tier first attempted. One of datacenter, residential, mobile, lean. Diagnostic only: it is never an input to routing, billing, caching or escalation. Present on sync fast-path responses. Omitted on a cache hit, which replayed stored bytes and ran no tier; and on responses the fast path did not serve. A third omission — a response replayed from stored bytes after this request's own cache lookup missed, which reports X-Scrape-Cache: miss and likewise ran no tier — exists only as an internal deploy-skew safeguard and is not reachable through this API. */
|
|
3984
|
+
/** @description The proxy tier that actually served this request's fetch, after any escalation — never the tier first attempted. One of datacenter, residential, mobile, lean, hosted_browser. Diagnostic only: it is never an input to routing, billing, caching or escalation. Present on sync fast-path responses. Omitted on a cache hit, which replayed stored bytes and ran no tier; and on responses the fast path did not serve. A third omission — a response replayed from stored bytes after this request's own cache lookup missed, which reports X-Scrape-Cache: miss and likewise ran no tier — exists only as an internal deploy-skew safeguard and is not reachable through this API. */
|
|
3681
3985
|
"X-Scrape-Proxy-Tier-Label"?: string;
|
|
3682
3986
|
/** @description WAF vendor detected on the target, if any (diagnostic). May be "suspected" when a low-confidence fail-open block marker was served. Omitted when no WAF is detected. */
|
|
3683
3987
|
"X-Scrape-Waf"?: string;
|
|
@@ -3691,7 +3995,7 @@ export interface operations {
|
|
|
3691
3995
|
"application/json": components["schemas"]["ScrapeSuccessEnvelope"] | components["schemas"]["ScrapeErrorEnvelope"];
|
|
3692
3996
|
};
|
|
3693
3997
|
};
|
|
3694
|
-
/** @description Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` was requested, or when a browser-path request's hold window expired before the render finished. Poll `GET /v1/scrape/{id}` for the result. */
|
|
3998
|
+
/** @description Scrape accepted for background processing; the body is a receipt, not content. Returned when `async: true` or `?async=true` was requested, or when a browser-path request's hold window expired before the render finished. Poll `GET /v1/scrape/{id}` for the result. */
|
|
3695
3999
|
202: {
|
|
3696
4000
|
headers: {
|
|
3697
4001
|
/** @description Stable scrape identifier for the queued job. */
|
|
@@ -3727,8 +4031,12 @@ export interface operations {
|
|
|
3727
4031
|
"application/json": components["schemas"]["Error"];
|
|
3728
4032
|
};
|
|
3729
4033
|
};
|
|
4034
|
+
401: components["responses"]["Unauthorized"];
|
|
3730
4035
|
402: components["responses"]["PaymentRequired"];
|
|
3731
|
-
/**
|
|
4036
|
+
/**
|
|
4037
|
+
* @description Validation error. A `json` format entry whose `schema` the extractor cannot take is
|
|
4038
|
+
* refused with `schema_incompatible`, before anything is drawn.
|
|
4039
|
+
*/
|
|
3732
4040
|
422: {
|
|
3733
4041
|
headers: {
|
|
3734
4042
|
[name: string]: unknown;
|
|
@@ -3755,6 +4063,19 @@ export interface operations {
|
|
|
3755
4063
|
"application/json": components["schemas"]["Error"];
|
|
3756
4064
|
};
|
|
3757
4065
|
};
|
|
4066
|
+
/**
|
|
4067
|
+
* @description The request carried a `json` format entry and JSON extraction is unavailable on this
|
|
4068
|
+
* deployment (`provider_unavailable`). It is refused before anything is drawn. A
|
|
4069
|
+
* terminal upstream failure is never a `503`: it is a `200` result, described above.
|
|
4070
|
+
*/
|
|
4071
|
+
503: {
|
|
4072
|
+
headers: {
|
|
4073
|
+
[name: string]: unknown;
|
|
4074
|
+
};
|
|
4075
|
+
content: {
|
|
4076
|
+
"application/json": components["schemas"]["Error"];
|
|
4077
|
+
};
|
|
4078
|
+
};
|
|
3758
4079
|
};
|
|
3759
4080
|
};
|
|
3760
4081
|
getScrape: {
|
|
@@ -3771,12 +4092,47 @@ export interface operations {
|
|
|
3771
4092
|
/** @description Scrape state (queued, success, or failed). */
|
|
3772
4093
|
200: {
|
|
3773
4094
|
headers: {
|
|
4095
|
+
/** @description Stable scrape identifier (also present on the envelope as `id`). Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4096
|
+
"X-Scrape-ID"?: string;
|
|
4097
|
+
/** @description Envelope status discriminator, mirrored as a header for streaming consumers. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4098
|
+
"X-Scrape-Status"?: "success" | "failed" | "queued";
|
|
4099
|
+
/** @description The originally requested URL, before any redirects. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4100
|
+
"X-Scrape-URL"?: string;
|
|
4101
|
+
/** @description Content-Type of the scraped response body. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4102
|
+
"X-Scrape-Content-Type"?: string;
|
|
4103
|
+
/** @description Compressed wire bytes — the basis for bandwidth billing. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4104
|
+
"X-Scrape-Content-Length"?: number;
|
|
4105
|
+
/** @description Credits charged for this scrape (multiplier applied to base 1.0 per format). Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4106
|
+
"X-Scrape-Credits-Charged"?: number;
|
|
4107
|
+
/** @description Handler elapsed time in milliseconds. X-Scrape-Elapsed-Ms emits the same value on gateway slow-path responses. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4108
|
+
"X-Scrape-Duration-Ms"?: number;
|
|
4109
|
+
/** @description End-to-end elapsed time in milliseconds. Alias for X-Scrape-Duration-Ms; both are emitted on gateway slow-path responses. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4110
|
+
"X-Scrape-Elapsed-Ms"?: number;
|
|
4111
|
+
/** @description Timestamp when the scrape row was created. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4112
|
+
"X-Scrape-Created-At"?: string;
|
|
4113
|
+
/** @description Timestamp when the scrape completed. Omitted if not yet completed. Present on a completed or failed scrape whose row records a completion time; absent while it is still queued or processing. */
|
|
4114
|
+
"X-Scrape-Completed-At"?: string;
|
|
4115
|
+
/** @description Expiry timestamp for the scrape artifact. Omitted if no retention applies. Present on a completed or failed scrape whose row records an expiry; absent while it is still queued or processing. */
|
|
4116
|
+
"X-Scrape-Expires-At"?: string;
|
|
4117
|
+
/** @description The URL after following redirects. Present on a completed or failed scrape whose row records a final URL; absent while it is still queued or processing. */
|
|
4118
|
+
"X-Scrape-Final-URL"?: string;
|
|
4119
|
+
/** @description HTTP status code returned by the target site. Present on a completed or failed scrape whose row records a target status code; absent while it is still queued or processing. */
|
|
4120
|
+
"X-Scrape-Status-Code"?: number;
|
|
4121
|
+
/** @description Cache outcome — `hit` = served from cache, `miss` = freshly fetched, `bypass` = `cache_ttl=0` requested. On GET present only on a failed scrape whose stored cache disposition is hit, miss or bypass; a completed scrape does not carry it, nor does a queued or processing one. */
|
|
4122
|
+
"X-Scrape-Cache"?: "hit" | "miss" | "bypass";
|
|
4123
|
+
/** @description Compressed wire byte count of the body, measured before any billing multiplication. It is not the decompressed size. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4124
|
+
"X-Raw-Bytes"?: number;
|
|
4125
|
+
/** @description Chargeable bytes after applying the billing multiplier. Equals round(X-Raw-Bytes × X-Billing-Multiplier). Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4126
|
+
"X-Billable-Bytes"?: number;
|
|
4127
|
+
/** @description Bandwidth cost multiplier (e.g. 1.0 for a `raw`-only scrape, 1.5 when `markdown` is also requested). Cache hits compose the endpoint format factor, which is a separate number from this one: 0.5 for an unprocessed-source scrape, 0.75 with markdown. Excludes the `clean_markdown` surcharge: when `clean_markdown: true` and the clean succeeded, the settled usage is 3× this header's value, so this header does not predict the amount you are billed. The response body's `billing` node is the authoritative surface — it DOES carry the `clean_markdown` factor, so its `multiplier` and `billed_bytes` are what you are charged. Where the two disagree, the node is correct. Present on a completed or failed scrape; absent while it is still queued or processing. */
|
|
4128
|
+
"X-Billing-Multiplier"?: number;
|
|
3774
4129
|
[name: string]: unknown;
|
|
3775
4130
|
};
|
|
3776
4131
|
content: {
|
|
3777
4132
|
"application/json": components["schemas"]["ScrapeEnvelope"];
|
|
3778
4133
|
};
|
|
3779
4134
|
};
|
|
4135
|
+
401: components["responses"]["Unauthorized"];
|
|
3780
4136
|
/** @description Resource not found. */
|
|
3781
4137
|
404: {
|
|
3782
4138
|
headers: {
|
|
@@ -3967,7 +4323,38 @@ export interface operations {
|
|
|
3967
4323
|
"application/json": components["schemas"]["Error"];
|
|
3968
4324
|
};
|
|
3969
4325
|
};
|
|
4326
|
+
401: components["responses"]["Unauthorized"];
|
|
3970
4327
|
402: components["responses"]["PaymentRequired"];
|
|
4328
|
+
/**
|
|
4329
|
+
* @description One or more URLs in the request are on ByteKit's blocklist. The whole request is
|
|
4330
|
+
* rejected before anything is queued or billed. This body is NOT the unified `Error`
|
|
4331
|
+
* envelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every
|
|
4332
|
+
* offending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the
|
|
4333
|
+
* code that rule maps to (`host_forbidden` for the first three, `path_forbidden` for
|
|
4334
|
+
* `path`).
|
|
4335
|
+
*/
|
|
4336
|
+
403: {
|
|
4337
|
+
headers: {
|
|
4338
|
+
[name: string]: unknown;
|
|
4339
|
+
};
|
|
4340
|
+
content: {
|
|
4341
|
+
"application/json": {
|
|
4342
|
+
error: {
|
|
4343
|
+
/** @enum {string} */
|
|
4344
|
+
code: "url_forbidden";
|
|
4345
|
+
/** @example One or more URLs in this bulk request are blocked. */
|
|
4346
|
+
message: string;
|
|
4347
|
+
};
|
|
4348
|
+
blocked: {
|
|
4349
|
+
url: string;
|
|
4350
|
+
/** @enum {string} */
|
|
4351
|
+
rule_type: "domain" | "tld" | "port" | "path";
|
|
4352
|
+
/** @enum {string} */
|
|
4353
|
+
error_code: "host_forbidden" | "path_forbidden";
|
|
4354
|
+
}[];
|
|
4355
|
+
};
|
|
4356
|
+
};
|
|
4357
|
+
};
|
|
3971
4358
|
/**
|
|
3972
4359
|
* @description Validation error. `bulk_too_large` is returned when the item count
|
|
3973
4360
|
* exceeds the account plan's `max_bulk_size` cap (also surfaced as
|
|
@@ -4089,6 +4476,7 @@ export interface operations {
|
|
|
4089
4476
|
};
|
|
4090
4477
|
};
|
|
4091
4478
|
};
|
|
4479
|
+
401: components["responses"]["Unauthorized"];
|
|
4092
4480
|
/** @description Resource not found. */
|
|
4093
4481
|
404: {
|
|
4094
4482
|
headers: {
|
|
@@ -4104,10 +4492,19 @@ export interface operations {
|
|
|
4104
4492
|
parameters: {
|
|
4105
4493
|
query: {
|
|
4106
4494
|
url: components["parameters"]["FetchUrl"];
|
|
4495
|
+
/** @description Two-letter country code. Either case is accepted; the value is upper-cased. */
|
|
4107
4496
|
country?: components["parameters"]["FetchCountry"];
|
|
4108
4497
|
timeout_ms?: components["parameters"]["FetchTimeoutMs"];
|
|
4109
4498
|
/** @description How long a freshly fetched URL may be served from cache. `0` skips the cache read; cache-eligible fresh results are still written with the default 7-day TTL so later non-zero-TTL callers can HIT. Safety-classified WAF husks remain live-only and are not written. Accepts `Nh` (hours, up to 168h), `Nd` (days, up to 7d), or the integer `0`. Examples: `0`, `48h`, `2d`. Invalid values receive a 422 validation_error with an actionable message. */
|
|
4110
4499
|
cache_ttl?: components["parameters"]["FetchCacheTtl"];
|
|
4500
|
+
/**
|
|
4501
|
+
* @description A JSON-encoded object, URL-encoded in the query string. It is echoed back base64-encoded in
|
|
4502
|
+
* the `X-Fetch-Custom` response header so callers can correlate the response to caller-side
|
|
4503
|
+
* state. Capped at 4096 UTF-8 bytes after JSON serialization, and not part of the cache key.
|
|
4504
|
+
* A value that is not valid JSON answers `422 validation_error` ("custom must be a
|
|
4505
|
+
* JSON-encoded object"); valid JSON that is not an object is also rejected with `422`.
|
|
4506
|
+
*/
|
|
4507
|
+
custom?: components["parameters"]["FetchCustom"];
|
|
4111
4508
|
};
|
|
4112
4509
|
header?: never;
|
|
4113
4510
|
path?: never;
|
|
@@ -4133,7 +4530,7 @@ export interface operations {
|
|
|
4133
4530
|
"X-Fetch-Waf-Vendor": components["headers"]["XFetchWafVendor"];
|
|
4134
4531
|
"X-Fetch-Content-Type": components["headers"]["XFetchContentType"];
|
|
4135
4532
|
"X-Fetch-Custom": components["headers"]["XFetchCustom"];
|
|
4136
|
-
/** @description
|
|
4533
|
+
/** @description Compressed wire byte count of the body, measured before any billing multiplication. It is not the decompressed size. */
|
|
4137
4534
|
"X-Raw-Bytes"?: number;
|
|
4138
4535
|
/** @description Chargeable bytes after applying the billing multiplier. Equals round(X-Raw-Bytes × X-Billing-Multiplier). */
|
|
4139
4536
|
"X-Billable-Bytes"?: number;
|
|
@@ -4160,6 +4557,7 @@ export interface operations {
|
|
|
4160
4557
|
"application/json": components["schemas"]["Error"];
|
|
4161
4558
|
};
|
|
4162
4559
|
};
|
|
4560
|
+
401: components["responses"]["Unauthorized"];
|
|
4163
4561
|
402: components["responses"]["PaymentRequired"];
|
|
4164
4562
|
/**
|
|
4165
4563
|
* @description Validation error (e.g. slow-path-only field), or a fetch that failed for a
|
|
@@ -4174,9 +4572,10 @@ export interface operations {
|
|
|
4174
4572
|
* failure, such as a host that does not resolve. This is a result about the URL,
|
|
4175
4573
|
* not an outage of this API, so it is a `4xx` rather than `502` or `503`. No
|
|
4176
4574
|
* upstream HTTP status was received, so `error.http_status` reports `422`,
|
|
4177
|
-
* mirroring what was served — unlike the relayed `upstream_error` under `
|
|
4178
|
-
* below, whose
|
|
4179
|
-
*
|
|
4575
|
+
* mirroring what was served — unlike the relayed `upstream_error` under `503`
|
|
4576
|
+
* below, whose `error.http_status` is the target's own. A target `502` or `504`
|
|
4577
|
+
* ends here too whenever it does not meet the condition for `503` below. The
|
|
4578
|
+
* request transfers no billable bytes and is charged nothing (#4669).
|
|
4180
4579
|
*/
|
|
4181
4580
|
422: {
|
|
4182
4581
|
headers: {
|
|
@@ -4206,7 +4605,12 @@ export interface operations {
|
|
|
4206
4605
|
* `error.http_status` reports. Read `error.code` to tell them apart.
|
|
4207
4606
|
*
|
|
4208
4607
|
* - **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as
|
|
4209
|
-
* `503`.
|
|
4608
|
+
* `503`. This happens only when the escalation ladder ended on that answer, or when a
|
|
4609
|
+
* cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first
|
|
4610
|
+
* retries it through its proxy tiers and the browser fallback; if the ladder ends any
|
|
4611
|
+
* other way, or a bot-protection vendor was seen on the way, the request answers
|
|
4612
|
+
* `422` (`upstream_error` or `blocked`) instead.
|
|
4613
|
+
* Cloudflare fronts this API and replaces a clean origin 502 or 504 with its
|
|
4210
4614
|
* own generic `text/plain` error page, discarding the envelope before it reaches
|
|
4211
4615
|
* you, while a 503 is passed through unchanged. The body's `error.http_status`
|
|
4212
4616
|
* still reports the **true upstream status**, `502` or `504` — not `503` — and is
|
|
@@ -4268,7 +4672,7 @@ export interface operations {
|
|
|
4268
4672
|
"X-Fetch-Waf-Vendor": components["headers"]["XFetchWafVendor"];
|
|
4269
4673
|
"X-Fetch-Content-Type": components["headers"]["XFetchContentType"];
|
|
4270
4674
|
"X-Fetch-Custom": components["headers"]["XFetchCustom"];
|
|
4271
|
-
/** @description
|
|
4675
|
+
/** @description Compressed wire byte count of the body, measured before any billing multiplication. It is not the decompressed size. */
|
|
4272
4676
|
"X-Raw-Bytes"?: number;
|
|
4273
4677
|
/** @description Chargeable bytes after applying the billing multiplier. Equals round(X-Raw-Bytes × X-Billing-Multiplier). */
|
|
4274
4678
|
"X-Billable-Bytes"?: number;
|
|
@@ -4295,6 +4699,7 @@ export interface operations {
|
|
|
4295
4699
|
"application/json": components["schemas"]["Error"];
|
|
4296
4700
|
};
|
|
4297
4701
|
};
|
|
4702
|
+
401: components["responses"]["Unauthorized"];
|
|
4298
4703
|
402: components["responses"]["PaymentRequired"];
|
|
4299
4704
|
/**
|
|
4300
4705
|
* @description Validation error (e.g. malformed JSON, unsupported fetch format, or slow-path-only
|
|
@@ -4309,9 +4714,10 @@ export interface operations {
|
|
|
4309
4714
|
* failure, such as a host that does not resolve. This is a result about the URL,
|
|
4310
4715
|
* not an outage of this API, so it is a `4xx` rather than `502` or `503`. No
|
|
4311
4716
|
* upstream HTTP status was received, so `error.http_status` reports `422`,
|
|
4312
|
-
* mirroring what was served — unlike the relayed `upstream_error` under `
|
|
4313
|
-
* below, whose
|
|
4314
|
-
*
|
|
4717
|
+
* mirroring what was served — unlike the relayed `upstream_error` under `503`
|
|
4718
|
+
* below, whose `error.http_status` is the target's own. A target `502` or `504`
|
|
4719
|
+
* ends here too whenever it does not meet the condition for `503` below. The
|
|
4720
|
+
* request transfers no billable bytes and is charged nothing (#4669).
|
|
4315
4721
|
*/
|
|
4316
4722
|
422: {
|
|
4317
4723
|
headers: {
|
|
@@ -4341,7 +4747,12 @@ export interface operations {
|
|
|
4341
4747
|
* `error.http_status` reports. Read `error.code` to tell them apart.
|
|
4342
4748
|
*
|
|
4343
4749
|
* - **`upstream_error`** — the target returned HTTP `502` or `504`, relayed here as
|
|
4344
|
-
* `503`.
|
|
4750
|
+
* `503`. This happens only when the escalation ladder ended on that answer, or when a
|
|
4751
|
+
* cached copy of it is served. A `502` or `504` is not terminal, so ByteKit first
|
|
4752
|
+
* retries it through its proxy tiers and the browser fallback; if the ladder ends any
|
|
4753
|
+
* other way, or a bot-protection vendor was seen on the way, the request answers
|
|
4754
|
+
* `422` (`upstream_error` or `blocked`) instead.
|
|
4755
|
+
* Cloudflare fronts this API and replaces a clean origin 502 or 504 with its
|
|
4345
4756
|
* own generic `text/plain` error page, discarding the envelope before it reaches
|
|
4346
4757
|
* you, while a 503 is passed through unchanged. The body's `error.http_status`
|
|
4347
4758
|
* still reports the **true upstream status**, `502` or `504` — not `503` — and is
|
|
@@ -4456,7 +4867,38 @@ export interface operations {
|
|
|
4456
4867
|
"application/json": components["schemas"]["Error"];
|
|
4457
4868
|
};
|
|
4458
4869
|
};
|
|
4870
|
+
401: components["responses"]["Unauthorized"];
|
|
4459
4871
|
402: components["responses"]["PaymentRequired"];
|
|
4872
|
+
/**
|
|
4873
|
+
* @description One or more URLs in the request are on ByteKit's blocklist. The whole request is
|
|
4874
|
+
* rejected before anything is queued or billed. This body is NOT the unified `Error`
|
|
4875
|
+
* envelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every
|
|
4876
|
+
* offending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the
|
|
4877
|
+
* code that rule maps to (`host_forbidden` for the first three, `path_forbidden` for
|
|
4878
|
+
* `path`).
|
|
4879
|
+
*/
|
|
4880
|
+
403: {
|
|
4881
|
+
headers: {
|
|
4882
|
+
[name: string]: unknown;
|
|
4883
|
+
};
|
|
4884
|
+
content: {
|
|
4885
|
+
"application/json": {
|
|
4886
|
+
error: {
|
|
4887
|
+
/** @enum {string} */
|
|
4888
|
+
code: "url_forbidden";
|
|
4889
|
+
/** @example One or more URLs in this bulk request are blocked. */
|
|
4890
|
+
message: string;
|
|
4891
|
+
};
|
|
4892
|
+
blocked: {
|
|
4893
|
+
url: string;
|
|
4894
|
+
/** @enum {string} */
|
|
4895
|
+
rule_type: "domain" | "tld" | "port" | "path";
|
|
4896
|
+
/** @enum {string} */
|
|
4897
|
+
error_code: "host_forbidden" | "path_forbidden";
|
|
4898
|
+
}[];
|
|
4899
|
+
};
|
|
4900
|
+
};
|
|
4901
|
+
};
|
|
4460
4902
|
/**
|
|
4461
4903
|
* @description Validation error. `bulk_too_large` is returned when the item count
|
|
4462
4904
|
* exceeds the account plan's `max_bulk_size` cap (also surfaced as
|
|
@@ -4674,6 +5116,7 @@ export interface operations {
|
|
|
4674
5116
|
};
|
|
4675
5117
|
};
|
|
4676
5118
|
};
|
|
5119
|
+
401: components["responses"]["Unauthorized"];
|
|
4677
5120
|
/** @description Resource not found. */
|
|
4678
5121
|
404: {
|
|
4679
5122
|
headers: {
|
|
@@ -4735,6 +5178,7 @@ export interface operations {
|
|
|
4735
5178
|
};
|
|
4736
5179
|
};
|
|
4737
5180
|
};
|
|
5181
|
+
401: components["responses"]["Unauthorized"];
|
|
4738
5182
|
/** @description Validation error. Returned when `status` is not one of the documented values, or when `cursor` is not a cursor this endpoint issued. */
|
|
4739
5183
|
422: {
|
|
4740
5184
|
headers: {
|
|
@@ -4970,7 +5414,38 @@ export interface operations {
|
|
|
4970
5414
|
"application/json": components["schemas"]["Error"];
|
|
4971
5415
|
};
|
|
4972
5416
|
};
|
|
5417
|
+
401: components["responses"]["Unauthorized"];
|
|
4973
5418
|
402: components["responses"]["PaymentRequired"];
|
|
5419
|
+
/**
|
|
5420
|
+
* @description One or more URLs in the request are on ByteKit's blocklist. The whole request is
|
|
5421
|
+
* rejected before anything is queued or billed. This body is NOT the unified `Error`
|
|
5422
|
+
* envelope: it carries no `status`, `http_status` or `failed_at`. `blocked` lists every
|
|
5423
|
+
* offending URL with the rule that matched (`domain`, `tld`, `port` or `path`) and the
|
|
5424
|
+
* code that rule maps to (`host_forbidden` for the first three, `path_forbidden` for
|
|
5425
|
+
* `path`).
|
|
5426
|
+
*/
|
|
5427
|
+
403: {
|
|
5428
|
+
headers: {
|
|
5429
|
+
[name: string]: unknown;
|
|
5430
|
+
};
|
|
5431
|
+
content: {
|
|
5432
|
+
"application/json": {
|
|
5433
|
+
error: {
|
|
5434
|
+
/** @enum {string} */
|
|
5435
|
+
code: "url_forbidden";
|
|
5436
|
+
/** @example One or more URLs in this bulk request are blocked. */
|
|
5437
|
+
message: string;
|
|
5438
|
+
};
|
|
5439
|
+
blocked: {
|
|
5440
|
+
url: string;
|
|
5441
|
+
/** @enum {string} */
|
|
5442
|
+
rule_type: "domain" | "tld" | "port" | "path";
|
|
5443
|
+
/** @enum {string} */
|
|
5444
|
+
error_code: "host_forbidden" | "path_forbidden";
|
|
5445
|
+
}[];
|
|
5446
|
+
};
|
|
5447
|
+
};
|
|
5448
|
+
};
|
|
4974
5449
|
/**
|
|
4975
5450
|
* @description Validation error. `bulk_too_large` is returned when the item count
|
|
4976
5451
|
* exceeds the account plan's `max_bulk_size` cap (also surfaced as
|
|
@@ -5076,6 +5551,7 @@ export interface operations {
|
|
|
5076
5551
|
};
|
|
5077
5552
|
};
|
|
5078
5553
|
};
|
|
5554
|
+
401: components["responses"]["Unauthorized"];
|
|
5079
5555
|
/** @description Resource not found. */
|
|
5080
5556
|
404: {
|
|
5081
5557
|
headers: {
|
|
@@ -5130,6 +5606,7 @@ export interface operations {
|
|
|
5130
5606
|
};
|
|
5131
5607
|
};
|
|
5132
5608
|
};
|
|
5609
|
+
401: components["responses"]["Unauthorized"];
|
|
5133
5610
|
/** @description Resource not found. */
|
|
5134
5611
|
404: {
|
|
5135
5612
|
headers: {
|
|
@@ -5251,6 +5728,7 @@ export interface operations {
|
|
|
5251
5728
|
};
|
|
5252
5729
|
};
|
|
5253
5730
|
};
|
|
5731
|
+
401: components["responses"]["Unauthorized"];
|
|
5254
5732
|
};
|
|
5255
5733
|
};
|
|
5256
5734
|
listMonitors: {
|
|
@@ -5280,6 +5758,7 @@ export interface operations {
|
|
|
5280
5758
|
};
|
|
5281
5759
|
};
|
|
5282
5760
|
};
|
|
5761
|
+
401: components["responses"]["Unauthorized"];
|
|
5283
5762
|
};
|
|
5284
5763
|
};
|
|
5285
5764
|
createMonitor: {
|
|
@@ -5324,6 +5803,7 @@ export interface operations {
|
|
|
5324
5803
|
"application/json": components["schemas"]["Error"];
|
|
5325
5804
|
};
|
|
5326
5805
|
};
|
|
5806
|
+
401: components["responses"]["Unauthorized"];
|
|
5327
5807
|
/** @description Duplicate monitor for this URL. */
|
|
5328
5808
|
409: {
|
|
5329
5809
|
headers: {
|
|
@@ -5364,6 +5844,7 @@ export interface operations {
|
|
|
5364
5844
|
"application/json": components["schemas"]["MonitorResponse"];
|
|
5365
5845
|
};
|
|
5366
5846
|
};
|
|
5847
|
+
401: components["responses"]["Unauthorized"];
|
|
5367
5848
|
/** @description Resource not found. */
|
|
5368
5849
|
404: {
|
|
5369
5850
|
headers: {
|
|
@@ -5393,6 +5874,7 @@ export interface operations {
|
|
|
5393
5874
|
};
|
|
5394
5875
|
content?: never;
|
|
5395
5876
|
};
|
|
5877
|
+
401: components["responses"]["Unauthorized"];
|
|
5396
5878
|
/** @description Resource not found. */
|
|
5397
5879
|
404: {
|
|
5398
5880
|
headers: {
|
|
@@ -5448,6 +5930,7 @@ export interface operations {
|
|
|
5448
5930
|
"application/json": components["schemas"]["Error"];
|
|
5449
5931
|
};
|
|
5450
5932
|
};
|
|
5933
|
+
401: components["responses"]["Unauthorized"];
|
|
5451
5934
|
/** @description Resource not found. */
|
|
5452
5935
|
404: {
|
|
5453
5936
|
headers: {
|
|
@@ -5505,6 +5988,7 @@ export interface operations {
|
|
|
5505
5988
|
};
|
|
5506
5989
|
};
|
|
5507
5990
|
};
|
|
5991
|
+
401: components["responses"]["Unauthorized"];
|
|
5508
5992
|
};
|
|
5509
5993
|
};
|
|
5510
5994
|
createSitemap: {
|
|
@@ -5548,7 +6032,25 @@ export interface operations {
|
|
|
5548
6032
|
"application/json": components["schemas"]["Error"];
|
|
5549
6033
|
};
|
|
5550
6034
|
};
|
|
6035
|
+
401: components["responses"]["Unauthorized"];
|
|
5551
6036
|
402: components["responses"]["PaymentRequired"];
|
|
6037
|
+
/**
|
|
6038
|
+
* @description The target is on ByteKit's blocklist. Nothing is queued and nothing is billed.
|
|
6039
|
+
* The unified `Error` envelope carries one of two codes:
|
|
6040
|
+
*
|
|
6041
|
+
* - `host_forbidden` — a blocked domain, any `.gov` host, or a blocked port.
|
|
6042
|
+
* `details` is `{ host }`.
|
|
6043
|
+
* - `path_forbidden` — an authentication-style path such as a login page.
|
|
6044
|
+
* `details` is `{ path }`.
|
|
6045
|
+
*/
|
|
6046
|
+
403: {
|
|
6047
|
+
headers: {
|
|
6048
|
+
[name: string]: unknown;
|
|
6049
|
+
};
|
|
6050
|
+
content: {
|
|
6051
|
+
"application/json": components["schemas"]["Error"];
|
|
6052
|
+
};
|
|
6053
|
+
};
|
|
5552
6054
|
/** @description Validation error. */
|
|
5553
6055
|
422: {
|
|
5554
6056
|
headers: {
|
|
@@ -5597,6 +6099,7 @@ export interface operations {
|
|
|
5597
6099
|
"application/json": components["schemas"]["SitemapResponse"];
|
|
5598
6100
|
};
|
|
5599
6101
|
};
|
|
6102
|
+
401: components["responses"]["Unauthorized"];
|
|
5600
6103
|
/** @description Resource not found. */
|
|
5601
6104
|
404: {
|
|
5602
6105
|
headers: {
|
|
@@ -5636,7 +6139,7 @@ export interface operations {
|
|
|
5636
6139
|
* }
|
|
5637
6140
|
*/
|
|
5638
6141
|
"application/json": {
|
|
5639
|
-
/** @description The search query. */
|
|
6142
|
+
/** @description The search query, up to 2048 characters. */
|
|
5640
6143
|
query: string;
|
|
5641
6144
|
/**
|
|
5642
6145
|
* @description Which search index to query. `web` (default) returns ranked organic results; `news` returns news articles in the same `results` array, additionally populating `source` and `image` on each item; `images` returns image results, populating `source`, `domain`, and a fuller `image` object (full-image dimensions plus a thumbnail URL and dimensions) while omitting `snippet` and `date`. Billing is identical for all three.
|
|
@@ -5753,6 +6256,7 @@ export interface operations {
|
|
|
5753
6256
|
"application/json": components["schemas"]["Error"];
|
|
5754
6257
|
};
|
|
5755
6258
|
};
|
|
6259
|
+
401: components["responses"]["Unauthorized"];
|
|
5756
6260
|
402: components["responses"]["PaymentRequired"];
|
|
5757
6261
|
/** @description Rate limit exceeded (`rate_limited`). Carries the `X-RateLimit-Limit`/`X-RateLimit-Remaining`/`X-RateLimit-Reset` triplet and a `Retry-After` header. The window is per-second for a bearer API key, or the 60-request/60-second Clerk session window when authenticated via `resolveDualAuth` — `Retry-After` reflects whichever window applies to the request. */
|
|
5758
6262
|
429: {
|
|
@@ -5777,25 +6281,28 @@ export interface operations {
|
|
|
5777
6281
|
};
|
|
5778
6282
|
};
|
|
5779
6283
|
/**
|
|
5780
|
-
* @description
|
|
5781
|
-
*
|
|
5782
|
-
*
|
|
5783
|
-
*
|
|
5784
|
-
*
|
|
5785
|
-
*
|
|
6284
|
+
* @description Two different bodies travel under this status. Tell them apart by the
|
|
6285
|
+
* type of the top-level `error` key: a string is the first, an object
|
|
6286
|
+
* is the second.
|
|
6287
|
+
*
|
|
6288
|
+
* - **Upstream search provider error**, answered at `503` rather than
|
|
6289
|
+
* `502` because Cloudflare replaces an origin 502 body with its own
|
|
6290
|
+
* page (#4891). The body is a fixed, vendor-masked shape —
|
|
6291
|
+
* deliberately NOT the unified `Error` envelope. The upstream
|
|
6292
|
+
* provider's identity and message are never surfaced, so the
|
|
6293
|
+
* response carries only the constant `error` code
|
|
6294
|
+
* `search_provider_error`.
|
|
6295
|
+
* - **Billing entitlement unavailable** (`billing_entitlement_missing`),
|
|
6296
|
+
* raised before any search runs, when the account has a Stripe
|
|
6297
|
+
* subscription but its plan could not be resolved. This one is the
|
|
6298
|
+
* unified `Error` envelope. No search is run and nothing is charged.
|
|
5786
6299
|
*/
|
|
5787
6300
|
503: {
|
|
5788
6301
|
headers: {
|
|
5789
6302
|
[name: string]: unknown;
|
|
5790
6303
|
};
|
|
5791
6304
|
content: {
|
|
5792
|
-
"application/json":
|
|
5793
|
-
/**
|
|
5794
|
-
* @description Fixed vendor-masked error code. Always `search_provider_error`; the upstream provider's identity and failure detail are withheld by design.
|
|
5795
|
-
* @enum {string}
|
|
5796
|
-
*/
|
|
5797
|
-
error: "search_provider_error";
|
|
5798
|
-
};
|
|
6305
|
+
"application/json": components["schemas"]["CreateSearchResponse503"] | components["schemas"]["Error"];
|
|
5799
6306
|
};
|
|
5800
6307
|
};
|
|
5801
6308
|
};
|
|
@@ -5833,7 +6340,7 @@ export interface operations {
|
|
|
5833
6340
|
* @description Target page URL (HTTP/HTTPS, SSRF-blocked, fast-path only).
|
|
5834
6341
|
*/
|
|
5835
6342
|
url: string;
|
|
5836
|
-
/** @description JSON Schema (draft 2020-12) describing the desired output. Serialized size ≤ 50 KB, nesting depth ≤ 8, must compile under Ajv, and must be normalizable into Groq's strict-mode subset
|
|
6343
|
+
/** @description JSON Schema (draft 2020-12) describing the desired output. Serialized size ≤ 50 KB, nesting depth ≤ 8, must compile under Ajv, and must be normalizable into Groq's strict-mode subset: root `type: object`, and only an allowlist of keywords at any depth — `type`, `properties`, `required`, `additionalProperties`, `items`, `enum`, `$defs`, `$ref`, `description`, `title` and `default` (`$ref` limited to `#/$defs`). Every other keyword, such as `pattern`, `format`, `minimum`, `maxLength`, `const`, `oneOf`, `anyOf`, `allOf` or `if`/`then`/`else`, returns `422 schema_incompatible`. */
|
|
5837
6344
|
schema: Record<string, never>;
|
|
5838
6345
|
/** @description Optional natural-language extraction hint. */
|
|
5839
6346
|
prompt?: string;
|
|
@@ -5857,7 +6364,10 @@ export interface operations {
|
|
|
5857
6364
|
* @default US
|
|
5858
6365
|
*/
|
|
5859
6366
|
country?: string | null;
|
|
5860
|
-
/**
|
|
6367
|
+
/**
|
|
6368
|
+
* @description Accepted and forwarded to the extraction service, which does not read it: it currently has no effect.
|
|
6369
|
+
* @default null
|
|
6370
|
+
*/
|
|
5861
6371
|
language?: string | null;
|
|
5862
6372
|
};
|
|
5863
6373
|
};
|
|
@@ -5890,7 +6400,7 @@ export interface operations {
|
|
|
5890
6400
|
status_code: number | null;
|
|
5891
6401
|
/** @description Upstream wire bytes — the bandwidth billing basis. */
|
|
5892
6402
|
content_length: number;
|
|
5893
|
-
/** @description True when markdown exceeded the
|
|
6403
|
+
/** @description True when the page sent to the LLM, the structured metadata (JSON-LD and meta tags) plus the markdown, exceeded the token budget and was cut to fit. */
|
|
5894
6404
|
truncated: boolean;
|
|
5895
6405
|
};
|
|
5896
6406
|
/** @description Additive warning codes, e.g. `content_truncated`, `extract_validation_failed`, `exhausted_retries`, `model_refusal`, `empty_extraction`. */
|
|
@@ -5907,8 +6417,15 @@ export interface operations {
|
|
|
5907
6417
|
"application/json": components["schemas"]["Error"];
|
|
5908
6418
|
};
|
|
5909
6419
|
};
|
|
5910
|
-
|
|
5911
|
-
|
|
6420
|
+
401: components["responses"]["Unauthorized"];
|
|
6421
|
+
402: components["responses"]["PaymentRequired"];
|
|
6422
|
+
/**
|
|
6423
|
+
* @description Validation error (`validation_error`), non-normalizable schema (`schema_incompatible`),
|
|
6424
|
+
* or the fetched page's HTML could not be converted for extraction — over the size cap or
|
|
6425
|
+
* past the conversion deadline (`content_too_large`). On `content_too_large` the page's
|
|
6426
|
+
* bandwidth is billed and the credits are refunded.
|
|
6427
|
+
*/
|
|
6428
|
+
422: {
|
|
5912
6429
|
headers: {
|
|
5913
6430
|
[name: string]: unknown;
|
|
5914
6431
|
};
|
|
@@ -5916,9 +6433,8 @@ export interface operations {
|
|
|
5916
6433
|
"application/json": components["schemas"]["Error"];
|
|
5917
6434
|
};
|
|
5918
6435
|
};
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
422: {
|
|
6436
|
+
/** @description Per-account rate limit (`rate_limited`) or upstream provider rate limit (`provider_rate_limited`); a `Retry-After` header may be present. */
|
|
6437
|
+
429: {
|
|
5922
6438
|
headers: {
|
|
5923
6439
|
[name: string]: unknown;
|
|
5924
6440
|
};
|
|
@@ -5926,8 +6442,11 @@ export interface operations {
|
|
|
5926
6442
|
"application/json": components["schemas"]["Error"];
|
|
5927
6443
|
};
|
|
5928
6444
|
};
|
|
5929
|
-
/**
|
|
5930
|
-
|
|
6445
|
+
/**
|
|
6446
|
+
* @description Internal error (`internal_error`): the request could not be recorded, or its
|
|
6447
|
+
* bandwidth charge could not be reserved. The credits held for it are refunded.
|
|
6448
|
+
*/
|
|
6449
|
+
500: {
|
|
5931
6450
|
headers: {
|
|
5932
6451
|
[name: string]: unknown;
|
|
5933
6452
|
};
|
|
@@ -6029,6 +6548,7 @@ export interface operations {
|
|
|
6029
6548
|
};
|
|
6030
6549
|
};
|
|
6031
6550
|
};
|
|
6551
|
+
401: components["responses"]["Unauthorized"];
|
|
6032
6552
|
};
|
|
6033
6553
|
};
|
|
6034
6554
|
getUsageDaily: {
|
|
@@ -6097,6 +6617,7 @@ export interface operations {
|
|
|
6097
6617
|
};
|
|
6098
6618
|
};
|
|
6099
6619
|
};
|
|
6620
|
+
401: components["responses"]["Unauthorized"];
|
|
6100
6621
|
};
|
|
6101
6622
|
};
|
|
6102
6623
|
getUsageByEndpoint: {
|
|
@@ -6144,6 +6665,7 @@ export interface operations {
|
|
|
6144
6665
|
};
|
|
6145
6666
|
};
|
|
6146
6667
|
};
|
|
6668
|
+
401: components["responses"]["Unauthorized"];
|
|
6147
6669
|
};
|
|
6148
6670
|
};
|
|
6149
6671
|
getLogs: {
|
|
@@ -6227,6 +6749,7 @@ export interface operations {
|
|
|
6227
6749
|
};
|
|
6228
6750
|
};
|
|
6229
6751
|
};
|
|
6752
|
+
401: components["responses"]["Unauthorized"];
|
|
6230
6753
|
};
|
|
6231
6754
|
};
|
|
6232
6755
|
createCheckout: {
|
|
@@ -6241,23 +6764,23 @@ export interface operations {
|
|
|
6241
6764
|
"application/json": {
|
|
6242
6765
|
/** @enum {string} */
|
|
6243
6766
|
plan: "starter" | "growth" | "scale";
|
|
6244
|
-
/**
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6767
|
+
/**
|
|
6768
|
+
* Format: uri
|
|
6769
|
+
* @description Where Stripe sends the user back if their bank requires leaving the page to authenticate the payment.
|
|
6770
|
+
*/
|
|
6771
|
+
return_url: string;
|
|
6248
6772
|
};
|
|
6249
6773
|
};
|
|
6250
6774
|
};
|
|
6251
6775
|
responses: {
|
|
6252
|
-
/** @description
|
|
6776
|
+
/** @description Checkout session created; pay it in-page with its client secret. */
|
|
6253
6777
|
200: {
|
|
6254
6778
|
headers: {
|
|
6255
6779
|
[name: string]: unknown;
|
|
6256
6780
|
};
|
|
6257
6781
|
content: {
|
|
6258
6782
|
"application/json": {
|
|
6259
|
-
|
|
6260
|
-
checkout_url: string;
|
|
6783
|
+
client_secret: string;
|
|
6261
6784
|
session_id: string;
|
|
6262
6785
|
};
|
|
6263
6786
|
};
|
|
@@ -6271,9 +6794,52 @@ export interface operations {
|
|
|
6271
6794
|
"application/json": components["schemas"]["Error"];
|
|
6272
6795
|
};
|
|
6273
6796
|
};
|
|
6797
|
+
401: components["responses"]["Unauthorized"];
|
|
6274
6798
|
};
|
|
6275
6799
|
};
|
|
6276
6800
|
createPortal: {
|
|
6801
|
+
parameters: {
|
|
6802
|
+
query?: never;
|
|
6803
|
+
header?: never;
|
|
6804
|
+
path?: never;
|
|
6805
|
+
cookie?: never;
|
|
6806
|
+
};
|
|
6807
|
+
requestBody?: never;
|
|
6808
|
+
responses: {
|
|
6809
|
+
401: components["responses"]["Unauthorized"];
|
|
6810
|
+
/** @description The portal is retired; manage billing at /settings/billing. */
|
|
6811
|
+
410: {
|
|
6812
|
+
headers: {
|
|
6813
|
+
[name: string]: unknown;
|
|
6814
|
+
};
|
|
6815
|
+
content: {
|
|
6816
|
+
"application/json": components["schemas"]["Error"];
|
|
6817
|
+
};
|
|
6818
|
+
};
|
|
6819
|
+
};
|
|
6820
|
+
};
|
|
6821
|
+
registerPayg: {
|
|
6822
|
+
parameters: {
|
|
6823
|
+
query?: never;
|
|
6824
|
+
header?: never;
|
|
6825
|
+
path?: never;
|
|
6826
|
+
cookie?: never;
|
|
6827
|
+
};
|
|
6828
|
+
requestBody?: never;
|
|
6829
|
+
responses: {
|
|
6830
|
+
401: components["responses"]["Unauthorized"];
|
|
6831
|
+
/** @description Card setup moved to POST /v1/billing/payment-methods/setup. */
|
|
6832
|
+
410: {
|
|
6833
|
+
headers: {
|
|
6834
|
+
[name: string]: unknown;
|
|
6835
|
+
};
|
|
6836
|
+
content: {
|
|
6837
|
+
"application/json": components["schemas"]["Error"];
|
|
6838
|
+
};
|
|
6839
|
+
};
|
|
6840
|
+
};
|
|
6841
|
+
};
|
|
6842
|
+
createTopup: {
|
|
6277
6843
|
parameters: {
|
|
6278
6844
|
query?: never;
|
|
6279
6845
|
header?: never;
|
|
@@ -6283,27 +6849,33 @@ export interface operations {
|
|
|
6283
6849
|
requestBody: {
|
|
6284
6850
|
content: {
|
|
6285
6851
|
"application/json": {
|
|
6286
|
-
/**
|
|
6287
|
-
|
|
6288
|
-
|
|
6852
|
+
/**
|
|
6853
|
+
* @description Amount to deposit, in US cents. Allowed amounts — $10, $25, $50, $100, $500. Charged exactly; the plan rate prices usage, not the deposit.
|
|
6854
|
+
* @enum {integer}
|
|
6855
|
+
*/
|
|
6856
|
+
amount_cents: 1000 | 2500 | 5000 | 10000 | 50000;
|
|
6857
|
+
/**
|
|
6858
|
+
* Format: uri
|
|
6859
|
+
* @description Where Stripe sends the user back if their bank requires leaving the page to authenticate the payment.
|
|
6860
|
+
*/
|
|
6289
6861
|
return_url: string;
|
|
6290
6862
|
};
|
|
6291
6863
|
};
|
|
6292
6864
|
};
|
|
6293
6865
|
responses: {
|
|
6294
|
-
/** @description
|
|
6866
|
+
/** @description Checkout session created; pay it in-page with its client secret. */
|
|
6295
6867
|
200: {
|
|
6296
6868
|
headers: {
|
|
6297
6869
|
[name: string]: unknown;
|
|
6298
6870
|
};
|
|
6299
6871
|
content: {
|
|
6300
6872
|
"application/json": {
|
|
6301
|
-
|
|
6302
|
-
|
|
6873
|
+
client_secret: string;
|
|
6874
|
+
session_id: string;
|
|
6303
6875
|
};
|
|
6304
6876
|
};
|
|
6305
6877
|
};
|
|
6306
|
-
/** @description No
|
|
6878
|
+
/** @description No customer or free plan. */
|
|
6307
6879
|
400: {
|
|
6308
6880
|
headers: {
|
|
6309
6881
|
[name: string]: unknown;
|
|
@@ -6312,8 +6884,18 @@ export interface operations {
|
|
|
6312
6884
|
"application/json": components["schemas"]["Error"];
|
|
6313
6885
|
};
|
|
6314
6886
|
};
|
|
6315
|
-
|
|
6316
|
-
|
|
6887
|
+
401: components["responses"]["Unauthorized"];
|
|
6888
|
+
/** @description Validation error (missing/invalid fields). */
|
|
6889
|
+
422: {
|
|
6890
|
+
headers: {
|
|
6891
|
+
[name: string]: unknown;
|
|
6892
|
+
};
|
|
6893
|
+
content: {
|
|
6894
|
+
"application/json": components["schemas"]["Error"];
|
|
6895
|
+
};
|
|
6896
|
+
};
|
|
6897
|
+
/** @description Stripe error creating the Checkout session (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
|
|
6898
|
+
503: {
|
|
6317
6899
|
headers: {
|
|
6318
6900
|
[name: string]: unknown;
|
|
6319
6901
|
};
|
|
@@ -6323,21 +6905,14 @@ export interface operations {
|
|
|
6323
6905
|
};
|
|
6324
6906
|
};
|
|
6325
6907
|
};
|
|
6326
|
-
|
|
6908
|
+
getCancellation: {
|
|
6327
6909
|
parameters: {
|
|
6328
6910
|
query?: never;
|
|
6329
6911
|
header?: never;
|
|
6330
6912
|
path?: never;
|
|
6331
6913
|
cookie?: never;
|
|
6332
6914
|
};
|
|
6333
|
-
requestBody
|
|
6334
|
-
content: {
|
|
6335
|
-
"application/json": {
|
|
6336
|
-
/** Format: uri */
|
|
6337
|
-
return_url: string;
|
|
6338
|
-
};
|
|
6339
|
-
};
|
|
6340
|
-
};
|
|
6915
|
+
requestBody?: never;
|
|
6341
6916
|
responses: {
|
|
6342
6917
|
/** @description Successful response. */
|
|
6343
6918
|
200: {
|
|
@@ -6346,13 +6921,17 @@ export interface operations {
|
|
|
6346
6921
|
};
|
|
6347
6922
|
content: {
|
|
6348
6923
|
"application/json": {
|
|
6349
|
-
/**
|
|
6350
|
-
|
|
6351
|
-
|
|
6924
|
+
/** @description Whether the plan ends at the period end instead of renewing. */
|
|
6925
|
+
cancel_at_period_end: boolean;
|
|
6926
|
+
/**
|
|
6927
|
+
* Format: date-time
|
|
6928
|
+
* @description When the paid period ends, read from the plan's subscription item.
|
|
6929
|
+
*/
|
|
6930
|
+
current_period_end: string | null;
|
|
6352
6931
|
};
|
|
6353
6932
|
};
|
|
6354
6933
|
};
|
|
6355
|
-
/** @description
|
|
6934
|
+
/** @description No subscription (`no_subscription`). */
|
|
6356
6935
|
400: {
|
|
6357
6936
|
headers: {
|
|
6358
6937
|
[name: string]: unknown;
|
|
@@ -6361,51 +6940,54 @@ export interface operations {
|
|
|
6361
6940
|
"application/json": components["schemas"]["Error"];
|
|
6362
6941
|
};
|
|
6363
6942
|
};
|
|
6943
|
+
401: components["responses"]["Unauthorized"];
|
|
6944
|
+
/** @description The caller is not an account admin (`forbidden`). */
|
|
6945
|
+
403: {
|
|
6946
|
+
headers: {
|
|
6947
|
+
[name: string]: unknown;
|
|
6948
|
+
};
|
|
6949
|
+
content: {
|
|
6950
|
+
"application/json": components["schemas"]["Error"];
|
|
6951
|
+
};
|
|
6952
|
+
};
|
|
6953
|
+
/** @description The Stripe subscription could not be read (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
|
|
6954
|
+
503: {
|
|
6955
|
+
headers: {
|
|
6956
|
+
[name: string]: unknown;
|
|
6957
|
+
};
|
|
6958
|
+
content: {
|
|
6959
|
+
"application/json": components["schemas"]["Error"];
|
|
6960
|
+
};
|
|
6961
|
+
};
|
|
6364
6962
|
};
|
|
6365
6963
|
};
|
|
6366
|
-
|
|
6964
|
+
cancelSubscription: {
|
|
6367
6965
|
parameters: {
|
|
6368
6966
|
query?: never;
|
|
6369
6967
|
header?: never;
|
|
6370
6968
|
path?: never;
|
|
6371
6969
|
cookie?: never;
|
|
6372
6970
|
};
|
|
6373
|
-
requestBody
|
|
6374
|
-
content: {
|
|
6375
|
-
"application/json": {
|
|
6376
|
-
/**
|
|
6377
|
-
* @description Amount to deposit, in US cents. Allowed amounts — $10, $25, $50, $100, $500. Charged exactly; the plan rate prices usage, not the deposit.
|
|
6378
|
-
* @enum {integer}
|
|
6379
|
-
*/
|
|
6380
|
-
amount_cents: 1000 | 2500 | 5000 | 10000 | 50000;
|
|
6381
|
-
/**
|
|
6382
|
-
* Format: uri
|
|
6383
|
-
* @description Redirect target after a completed Checkout.
|
|
6384
|
-
*/
|
|
6385
|
-
success_url: string;
|
|
6386
|
-
/**
|
|
6387
|
-
* Format: uri
|
|
6388
|
-
* @description Redirect target when the user abandons Checkout.
|
|
6389
|
-
*/
|
|
6390
|
-
cancel_url: string;
|
|
6391
|
-
};
|
|
6392
|
-
};
|
|
6393
|
-
};
|
|
6971
|
+
requestBody?: never;
|
|
6394
6972
|
responses: {
|
|
6395
|
-
/** @description
|
|
6973
|
+
/** @description The plan now ends at the period end. */
|
|
6396
6974
|
200: {
|
|
6397
6975
|
headers: {
|
|
6398
6976
|
[name: string]: unknown;
|
|
6399
6977
|
};
|
|
6400
6978
|
content: {
|
|
6401
6979
|
"application/json": {
|
|
6402
|
-
/**
|
|
6403
|
-
|
|
6404
|
-
|
|
6980
|
+
/** @description Whether the plan ends at the period end instead of renewing. */
|
|
6981
|
+
cancel_at_period_end: boolean;
|
|
6982
|
+
/**
|
|
6983
|
+
* Format: date-time
|
|
6984
|
+
* @description When the paid period ends, read from the plan's subscription item.
|
|
6985
|
+
*/
|
|
6986
|
+
current_period_end: string | null;
|
|
6405
6987
|
};
|
|
6406
6988
|
};
|
|
6407
6989
|
};
|
|
6408
|
-
/** @description No
|
|
6990
|
+
/** @description No subscription (`no_subscription`). */
|
|
6409
6991
|
400: {
|
|
6410
6992
|
headers: {
|
|
6411
6993
|
[name: string]: unknown;
|
|
@@ -6414,8 +6996,9 @@ export interface operations {
|
|
|
6414
6996
|
"application/json": components["schemas"]["Error"];
|
|
6415
6997
|
};
|
|
6416
6998
|
};
|
|
6417
|
-
|
|
6418
|
-
|
|
6999
|
+
401: components["responses"]["Unauthorized"];
|
|
7000
|
+
/** @description The caller is not an account admin (`forbidden`). */
|
|
7001
|
+
403: {
|
|
6419
7002
|
headers: {
|
|
6420
7003
|
[name: string]: unknown;
|
|
6421
7004
|
};
|
|
@@ -6423,7 +7006,16 @@ export interface operations {
|
|
|
6423
7006
|
"application/json": components["schemas"]["Error"];
|
|
6424
7007
|
};
|
|
6425
7008
|
};
|
|
6426
|
-
/** @description
|
|
7009
|
+
/** @description Cancellation disclosure revision is absent or stale (`billing_disclosure_stale`). The current revision is in the `Billing-Disclosure-Revision` response header. */
|
|
7010
|
+
409: {
|
|
7011
|
+
headers: {
|
|
7012
|
+
[name: string]: unknown;
|
|
7013
|
+
};
|
|
7014
|
+
content: {
|
|
7015
|
+
"application/json": components["schemas"]["Error"];
|
|
7016
|
+
};
|
|
7017
|
+
};
|
|
7018
|
+
/** @description Stripe refused or failed the cancellation (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
|
|
6427
7019
|
503: {
|
|
6428
7020
|
headers: {
|
|
6429
7021
|
[name: string]: unknown;
|
|
@@ -6434,23 +7026,53 @@ export interface operations {
|
|
|
6434
7026
|
};
|
|
6435
7027
|
};
|
|
6436
7028
|
};
|
|
6437
|
-
|
|
7029
|
+
keepSubscription: {
|
|
6438
7030
|
parameters: {
|
|
6439
7031
|
query?: never;
|
|
6440
7032
|
header?: never;
|
|
6441
7033
|
path?: never;
|
|
6442
7034
|
cookie?: never;
|
|
6443
7035
|
};
|
|
6444
|
-
requestBody
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
7036
|
+
requestBody?: never;
|
|
7037
|
+
responses: {
|
|
7038
|
+
/** @description The plan renews at the period end. */
|
|
7039
|
+
200: {
|
|
7040
|
+
headers: {
|
|
7041
|
+
[name: string]: unknown;
|
|
7042
|
+
};
|
|
7043
|
+
content: {
|
|
7044
|
+
"application/json": {
|
|
7045
|
+
/** @description Whether the plan ends at the period end instead of renewing. */
|
|
7046
|
+
cancel_at_period_end: boolean;
|
|
7047
|
+
/**
|
|
7048
|
+
* Format: date-time
|
|
7049
|
+
* @description When the paid period ends, read from the plan's subscription item.
|
|
7050
|
+
*/
|
|
7051
|
+
current_period_end: string | null;
|
|
7052
|
+
};
|
|
6448
7053
|
};
|
|
6449
7054
|
};
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
7055
|
+
/** @description No subscription (`no_subscription`). */
|
|
7056
|
+
400: {
|
|
7057
|
+
headers: {
|
|
7058
|
+
[name: string]: unknown;
|
|
7059
|
+
};
|
|
7060
|
+
content: {
|
|
7061
|
+
"application/json": components["schemas"]["Error"];
|
|
7062
|
+
};
|
|
7063
|
+
};
|
|
7064
|
+
401: components["responses"]["Unauthorized"];
|
|
7065
|
+
/** @description The caller is not an account admin (`forbidden`). */
|
|
7066
|
+
403: {
|
|
7067
|
+
headers: {
|
|
7068
|
+
[name: string]: unknown;
|
|
7069
|
+
};
|
|
7070
|
+
content: {
|
|
7071
|
+
"application/json": components["schemas"]["Error"];
|
|
7072
|
+
};
|
|
7073
|
+
};
|
|
7074
|
+
/** @description Stripe refused or failed the change (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
|
|
7075
|
+
503: {
|
|
6454
7076
|
headers: {
|
|
6455
7077
|
[name: string]: unknown;
|
|
6456
7078
|
};
|
|
@@ -6495,6 +7117,7 @@ export interface operations {
|
|
|
6495
7117
|
"application/json": components["schemas"]["Error"];
|
|
6496
7118
|
};
|
|
6497
7119
|
};
|
|
7120
|
+
401: components["responses"]["Unauthorized"];
|
|
6498
7121
|
/** @description The Stripe subscription schedule could not be read (`stripe_error`). Answered at `503`, not `502`, because Cloudflare replaces an origin 502 body with its own page (#4891). */
|
|
6499
7122
|
503: {
|
|
6500
7123
|
headers: {
|
|
@@ -6555,6 +7178,7 @@ export interface operations {
|
|
|
6555
7178
|
"application/json": components["schemas"]["Error"];
|
|
6556
7179
|
};
|
|
6557
7180
|
};
|
|
7181
|
+
401: components["responses"]["Unauthorized"];
|
|
6558
7182
|
};
|
|
6559
7183
|
};
|
|
6560
7184
|
revokePlanChange: {
|
|
@@ -6589,6 +7213,7 @@ export interface operations {
|
|
|
6589
7213
|
"application/json": components["schemas"]["Error"];
|
|
6590
7214
|
};
|
|
6591
7215
|
};
|
|
7216
|
+
401: components["responses"]["Unauthorized"];
|
|
6592
7217
|
};
|
|
6593
7218
|
};
|
|
6594
7219
|
listInvoices: {
|
|
@@ -6623,6 +7248,7 @@ export interface operations {
|
|
|
6623
7248
|
invoice_pdf: string | null;
|
|
6624
7249
|
hosted_invoice_url: string | null;
|
|
6625
7250
|
}[];
|
|
7251
|
+
/** @description True when older invoices exist after this page. */
|
|
6626
7252
|
has_more: boolean;
|
|
6627
7253
|
};
|
|
6628
7254
|
};
|
|
@@ -6636,6 +7262,7 @@ export interface operations {
|
|
|
6636
7262
|
"application/json": components["schemas"]["Error"];
|
|
6637
7263
|
};
|
|
6638
7264
|
};
|
|
7265
|
+
401: components["responses"]["Unauthorized"];
|
|
6639
7266
|
};
|
|
6640
7267
|
};
|
|
6641
7268
|
getTopupBalance: {
|
|
@@ -6691,6 +7318,7 @@ export interface operations {
|
|
|
6691
7318
|
};
|
|
6692
7319
|
};
|
|
6693
7320
|
};
|
|
7321
|
+
401: components["responses"]["Unauthorized"];
|
|
6694
7322
|
};
|
|
6695
7323
|
};
|
|
6696
7324
|
updateAutoTopup: {
|
|
@@ -6737,6 +7365,7 @@ export interface operations {
|
|
|
6737
7365
|
"application/json": components["schemas"]["Error"];
|
|
6738
7366
|
};
|
|
6739
7367
|
};
|
|
7368
|
+
401: components["responses"]["Unauthorized"];
|
|
6740
7369
|
};
|
|
6741
7370
|
};
|
|
6742
7371
|
createPaymentMethodSetup: {
|
|
@@ -6766,6 +7395,7 @@ export interface operations {
|
|
|
6766
7395
|
"application/json": components["schemas"]["Error"];
|
|
6767
7396
|
};
|
|
6768
7397
|
};
|
|
7398
|
+
401: components["responses"]["Unauthorized"];
|
|
6769
7399
|
};
|
|
6770
7400
|
};
|
|
6771
7401
|
listPaymentMethods: {
|
|
@@ -6797,6 +7427,7 @@ export interface operations {
|
|
|
6797
7427
|
"application/json": components["schemas"]["Error"];
|
|
6798
7428
|
};
|
|
6799
7429
|
};
|
|
7430
|
+
401: components["responses"]["Unauthorized"];
|
|
6800
7431
|
};
|
|
6801
7432
|
};
|
|
6802
7433
|
setDefaultPaymentMethod: {
|
|
@@ -6828,6 +7459,7 @@ export interface operations {
|
|
|
6828
7459
|
"application/json": components["schemas"]["Error"];
|
|
6829
7460
|
};
|
|
6830
7461
|
};
|
|
7462
|
+
401: components["responses"]["Unauthorized"];
|
|
6831
7463
|
/** @description Payment method not found. */
|
|
6832
7464
|
404: {
|
|
6833
7465
|
headers: {
|
|
@@ -6877,6 +7509,7 @@ export interface operations {
|
|
|
6877
7509
|
"application/json": components["schemas"]["Error"];
|
|
6878
7510
|
};
|
|
6879
7511
|
};
|
|
7512
|
+
401: components["responses"]["Unauthorized"];
|
|
6880
7513
|
/** @description Payment method not found. */
|
|
6881
7514
|
404: {
|
|
6882
7515
|
headers: {
|
|
@@ -6972,6 +7605,7 @@ export interface operations {
|
|
|
6972
7605
|
};
|
|
6973
7606
|
};
|
|
6974
7607
|
};
|
|
7608
|
+
401: components["responses"]["Unauthorized"];
|
|
6975
7609
|
};
|
|
6976
7610
|
};
|
|
6977
7611
|
retryWebhookDelivery: {
|
|
@@ -7006,6 +7640,7 @@ export interface operations {
|
|
|
7006
7640
|
"application/json": components["schemas"]["Error"];
|
|
7007
7641
|
};
|
|
7008
7642
|
};
|
|
7643
|
+
401: components["responses"]["Unauthorized"];
|
|
7009
7644
|
/** @description Delivery not found or not in a retryable state. */
|
|
7010
7645
|
404: {
|
|
7011
7646
|
headers: {
|