Repository navigation
Expand file tree
/
Copy pathopenapi.yaml
More file actions
3286 lines (3265 loc) · 116 KB
/
Copy pathopenapi.yaml
File metadata and controls
3286 lines (3265 loc) · 116 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.1.0
info:
title: CleanedWeb public API
version: 0.1.0
summary: Run maintained web data APIs, read their records and recover safely.
description: |
CleanedWeb turns collections of public websites into maintained REST APIs. This document describes
the customer-facing surface only: the published catalog, runs, schedules, the source APIs of your
own workspace and the routes that build an API from a URL. Admin, control and pipeline routes are not part of it.
See `FINDINGS.md` for every
place where the documentation, the engine and the live service disagree.
## Origins
| Origin | Serves |
| --- | --- |
| `https://api.cleanedweb.com` | Every `/v1/` route below: catalog reads, runs, results, schedules and source APIs. This is the one origin an SDK needs. |
| `https://app.cleanedweb.com` | The console's no-key catalog reads under `/api/catalog/` (same data as the catalog routes on the API origin), and the build-an-API routes under `/api/builder/`, which take a key with the creation scopes. |
| `https://cleanedweb.com` | Static machine files of the catalog site (`/catalog/index.json`, `/catalog/{slug}/contract.json`). |
`https://broker.cleanedweb.com` is the acquisition broker, not the customer API. It has no `/v1/runs` or
`/v1/catalog/public` routes and refuses scoped customer keys (see `FINDINGS.md`, finding 1).
## Authentication and scopes
Send an account API key as `Authorization: Bearer <key>`. A key has scopes:
| Scope | Permits |
| --- | --- |
| `read` | Source connection details, versions and contracts, schedules (list, get), catalog result recovery and filters. |
| `run` | Start runs, read runs, items and abort, create, pause, resume and delete schedules, read a catalog run's result by key. |
| `results` | Read run results (`/v1/runs/{run_id}/result`, `/v1/sources/{source_id}/runs/{run_id}`) and run lists. |
| `discover` | Creation scope: start and read previews (`/api/builder/previews`). Needed with `build` to start a build. |
| `build` | Creation scope: read build jobs and their results (`/api/builder/builds`), and, with `discover`, start the build of a preview. |
The creation scopes belong to a key made with the console's "Create APIs" option, which can also carry `run` to
run what it builds. A key without the scope a build-an-API route needs answers `403` `api_key_scope_required`;
`detail` names `required_scopes` and `granted_scopes`. An operation that needs every listed scope says so in
`x-scopes-all-of`.
Each operation lists the scopes that open it in `x-scopes-any-of`. A key without the scope answers `403`.
Catalog reads (list, get, contract) need no key.
## Idempotency and runs
Every run needs an `Idempotency-Key` (1 to 200 characters: letters, numbers, `.`, `_`, `:`, `-`). Save the
key before you send. The same key and request returns the same run: `202` while it runs, the final body
when it ended, the saved error when it failed (for seven days). Never send the POST again to wait: read
the result with the same key. A failed run is final for its key; use a new key to run again.
## Errors
Every error body is `{"detail": ...}`. `detail` is a string, an object with a `code`, or a list of
validation issues. An error that marks a failed run carries `run_id`, `error_code`
(`run_failed` or `failed_run_replayed`) and `replayed` in `detail`, plus a `Location` header. An error
without that marker (a timeout, a gateway error, a `503`) does not show whether the run failed: keep the
key and read the result.
termsOfService: https://cleanedweb.com/legal/terms/
contact:
name: CleanedWeb
url: https://cleanedweb.com/contact/?utm_source=github&utm_medium=cleanedweb-openapi
license:
name: MIT
identifier: MIT
x-private-preview: true
servers:
- url: https://api.cleanedweb.com
description: CleanedWeb API (catalog, runs, schedules, source APIs)
tags:
- name: Catalog
description: Published APIs. Reading needs no key.
- name: Catalog runs
description: Run a published API and read its result.
- name: Runs
description: Read, list and abort any run you started.
- name: Source APIs
description: The private APIs of your own workspace.
- name: Schedules
description: Recurring catalog or source runs.
- name: Build an API
description: Turn a public URL into an API of your own (previews, builds). Served by the console origin; needs a key with the creation scopes.
- name: Catalog site
description: Static machine files of the catalog site, no key.
security:
- bearerAuth: []
paths:
/v1/catalog/public/apis:
get:
operationId: listCatalogApis
tags: [Catalog]
summary: List published APIs
description: |
The published catalog, newest first. Needs no key. Offset paging reflects current content and is not a
snapshot across requests. The same list is served by `GET /api/catalog/apis` on the app origin.
security: []
parameters:
- $ref: '#/components/parameters/Limit'
- $ref: '#/components/parameters/Offset'
- $ref: '#/components/parameters/Query'
- $ref: '#/components/parameters/Category'
- $ref: '#/components/parameters/Sort'
responses:
'200':
description: One page of published APIs.
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
$ref: '#/components/schemas/CatalogApiList'
example:
items:
- api_id: generated_047a8ebb25911ccf62f4a212
name: GitHub Topics Repositories
short_description: Public GitHub repositories listed under a topic, with name, description, owner, stars and forks.
category: uncategorized
record_types: []
countries: []
languages: []
tags: []
limitations: []
site:
name: GitHub Topics Repositories
domain: github.com
endpoints:
- endpoint_id: generated_047a8ebb25911ccf62f4a212_search
name: Extract records
description: Return records within the accepted scope.
status: available
acquisition: http
health: unknown
last_verified_at: null
'422':
$ref: '#/components/responses/UnprocessableEntity'
/v1/catalog/public/apis/{api_id}:
get:
operationId: getCatalogApi
tags: [Catalog]
summary: Get one published API
description: Adds each endpoint's `active_version`, `version`, `versions` and `changelog`. Needs no key.
security: []
parameters:
- $ref: '#/components/parameters/ApiId'
responses:
'200':
description: The API.
content:
application/json:
schema:
$ref: '#/components/schemas/CatalogApi'
'404':
$ref: '#/components/responses/NotFound'
/v1/catalog/public/apis/{api_id}/endpoints/{endpoint_id}/contract:
get:
operationId: getCatalogEndpointContract
tags: [Catalog]
summary: Read an endpoint's contract
description: |
The contract is generated from the exact saved definition that runs: `input_schema`, `output_schema`,
saved samples and the run request (`method`, `path`). Pass `version` to read a pinned major. Needs no key.
security: []
parameters:
- $ref: '#/components/parameters/ApiId'
- $ref: '#/components/parameters/EndpointId'
- $ref: '#/components/parameters/ContractVersion'
responses:
'200':
description: The contract.
content:
application/json:
schema:
$ref: '#/components/schemas/Contract'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/UnprocessableEntity'
/v1/catalog/public/apis/{api_id}/endpoints/{endpoint_id}/filters:
get:
operationId: describeCatalogEndpointFilters
tags: [Catalog]
summary: Describe an endpoint's category filters
description: |
For an endpoint that takes category `filters`: one live page read of the category vocabulary. Free (no
Units, nothing runs). `502` means the site did not serve the category page; retry. An endpoint without
category filters answers `404` with `category_filters_unavailable`, in a different envelope from every other
error: `{"error": {"code", "message", "details"}}` instead of `{"detail": ...}` (`FINDINGS.md`, finding 12).
The same envelope carries a `category` the site does not know (`404` `category_filters_unavailable`, reason
`filter_list_not_found`) and a `filters` value that is not a JSON object (`422` `filters_invalid`). A `200`
has `category` (`value`, `label`, `path`, `children` with `count`), `filters`, `total`, `as_of` and `source`.
Not described in the public docs.
x-scopes-any-of: [run, read]
parameters:
- $ref: '#/components/parameters/ApiId'
- $ref: '#/components/parameters/EndpointId'
- name: category
in: query
required: false
description: A category from an earlier describe.
schema:
type: string
- name: search
in: query
required: false
description: Words for what you want; alone, it suggests categories.
schema:
type: string
- name: filters
in: query
required: false
description: 'A JSON object text, such as `{"brand":"Leica"}`.'
schema:
type: string
responses:
'200':
description: Categories and filters with their allowed values.
content:
application/json:
schema:
type: object
additionalProperties: true
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'429':
$ref: '#/components/responses/RateLimited'
'502':
$ref: '#/components/responses/BadGateway'
/v1/catalog/public/apis/{api_id}/endpoints/{endpoint_id}/run:
post:
operationId: runCatalogEndpoint
tags: [Catalog runs]
summary: Run a catalog endpoint
description: |
Runs the endpoint's latest major, or the major the body pins with `version`. A run uses the Units of your
workspace: one per saved record, charged as pages are committed. You cannot choose the source or the owner.
Start with a small `max_items`.
`200` when the run ended within `wait_seconds` (default 90), `202` while it goes on. On `202` do not send the
POST again: read `getCatalogEndpointResult` with the same key after `Retry-After` seconds.
x-scopes-any-of: [run]
x-idempotent: true
parameters:
- $ref: '#/components/parameters/ApiId'
- $ref: '#/components/parameters/EndpointId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CatalogRunRequest'
example:
input:
sort: desc_stars
max_items: 25
timeout_seconds: 3600
wait_seconds: 90
responses:
'200':
description: The run ended within `wait_seconds`, or its result is final.
headers:
Location:
$ref: '#/components/headers/Location'
Deprecation:
$ref: '#/components/headers/Deprecation'
Sunset:
$ref: '#/components/headers/Sunset'
Link:
$ref: '#/components/headers/Link'
content:
application/json:
schema:
$ref: '#/components/schemas/RunResult'
example:
records:
- title: web-scraping-google-sheets
url: https://github.com/oxylabs/web-scraping-google-sheets
description: Guide to Using Google Sheets for Basic Web Scraping
summary:
source_id: generated_047a8ebb25911ccf62f4a212_search
definition_version: eec683b95f337dcc63a3fb5bf1e23729fb71f6f719f51ea771c19345b5893252
status: bounded
within_scope_passed: true
catalog_complete: false
records: 1
metadata:
definition_version: eec683b95f337dcc63a3fb5bf1e23729fb71f6f719f51ea771c19345b5893252
artifacts: []
traceId: null
run:
run_id: 0123456789abcdef0123456789abcdef
status: finished
stop_reason: max_items
units_charged: 1
delivery:
runId: 0123456789abcdef0123456789abcdef
chargeReceiptId: 0123456789abcdef0123456789abcdef
recordCount: 1
'202':
$ref: '#/components/responses/RunAccepted'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'429':
$ref: '#/components/responses/RateLimited'
'502':
$ref: '#/components/responses/BadGateway'
'503':
$ref: '#/components/responses/ServiceUnavailable'
'504':
$ref: '#/components/responses/GatewayTimeout'
/v1/catalog/public/apis/{api_id}/endpoints/{endpoint_id}/result:
get:
operationId: getCatalogEndpointResult
tags: [Catalog runs]
summary: Read a catalog run's result by its idempotency key
description: |
Finds the run a catalog request started by its `Idempotency-Key` and answers as the run did: `202` with the
run object while it goes on, `200` with the final body when it ended, or the run's error. Never collects the
website again. Works after the API is unpublished or its version changes. A key unknown for the endpoint
answers `404` (`catalog_delivery_not_found`); a key reused for another endpoint or version answers `409`
(`delivery_identity_conflict`).
x-scopes-any-of: [run, read]
parameters:
- $ref: '#/components/parameters/ApiId'
- $ref: '#/components/parameters/EndpointId'
- $ref: '#/components/parameters/IdempotencyKey'
- $ref: '#/components/parameters/Nulls'
responses:
'200':
description: The run ended.
headers:
Location:
$ref: '#/components/headers/Location'
Deprecation:
$ref: '#/components/headers/Deprecation'
Sunset:
$ref: '#/components/headers/Sunset'
Link:
$ref: '#/components/headers/Link'
content:
application/json:
schema:
$ref: '#/components/schemas/RunResult'
'202':
$ref: '#/components/responses/RunAccepted'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'429':
$ref: '#/components/responses/RateLimited'
'502':
$ref: '#/components/responses/BadGateway'
'503':
$ref: '#/components/responses/ServiceUnavailable'
'504':
$ref: '#/components/responses/GatewayTimeout'
/v1/runs:
get:
operationId: listRuns
tags: [Runs]
summary: List your runs
description: Your runs, newest first. Pass `next_cursor` as `cursor` to read the next page. An unknown or repeated query parameter answers `422` with `run_list_query_invalid`.
x-scopes-any-of: [run, results]
parameters:
- name: source_id
in: query
required: false
description: Only runs of this source or catalog endpoint source.
schema:
type: string
- name: status
in: query
required: false
schema:
$ref: '#/components/schemas/RunStatus'
- name: cursor
in: query
required: false
description: The opaque `next_cursor` of the previous page.
schema:
type: string
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
default: 50
responses:
'200':
description: One page of runs.
content:
application/json:
schema:
$ref: '#/components/schemas/RunList'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'429':
$ref: '#/components/responses/RateLimited'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/runs/{run_id}:
get:
operationId: getRun
tags: [Runs]
summary: Read a run
description: The run object. Reading a run never collects the website again. A foreign or missing run answers `404`.
x-scopes-any-of: [run, results]
parameters:
- $ref: '#/components/parameters/RunId'
responses:
'200':
description: The run.
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'429':
$ref: '#/components/responses/RateLimited'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/runs/{run_id}/items:
get:
operationId: listRunItems
tags: [Runs]
summary: Read the records committed so far
description: |
Items `[cursor, cursor + limit)`, readable while the run runs. `next_cursor` is null once the run ended and
every record was read. With `format=jsonl` each line is one record, and the answer carries `X-Run-Status` and,
while more can follow, `X-Next-Cursor` headers (the json format carries them too).
x-scopes-any-of: [run, results]
parameters:
- $ref: '#/components/parameters/RunId'
- name: cursor
in: query
required: false
description: Position of the first record to read. Starts at `0`. Pass the returned `next_cursor` to continue.
schema:
type: string
pattern: '^[0-9]+$'
default: '0'
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
default: 100
- name: format
in: query
required: false
schema:
type: string
enum: [json, jsonl]
default: json
- $ref: '#/components/parameters/Nulls'
responses:
'200':
description: One page of records.
headers:
X-Run-Status:
$ref: '#/components/headers/XRunStatus'
X-Next-Cursor:
$ref: '#/components/headers/XNextCursor'
content:
application/json:
schema:
$ref: '#/components/schemas/RunItemsPage'
example:
run_id: 0123456789abcdef0123456789abcdef
items:
- title: creeper
url: https://github.com/z7r1k3/creeper
count: 1
next_cursor: '1'
run_status: running
application/x-ndjson:
schema:
type: string
description: One JSON record per line.
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/runs/{run_id}/result:
get:
operationId: getRunResult
tags: [Runs]
summary: Read a run's result
description: |
`200` with the final body once the run ended, `202` with the run object while it goes on (header
`Retry-After`), or the run's error (a failed run carries the failed-run marker). Reading a result never
collects the website again. An aborted run answers `200` too: check `run.status` (`FINDINGS.md`, finding 16).
Needs the `run` or `results` scope (`FINDINGS.md`, finding 2).
x-scopes-any-of: [run, results]
parameters:
- $ref: '#/components/parameters/RunId'
- $ref: '#/components/parameters/Nulls'
responses:
'200':
description: The run ended.
content:
application/json:
schema:
$ref: '#/components/schemas/RunResult'
'202':
$ref: '#/components/responses/RunAccepted'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/runs/{run_id}/abort:
post:
operationId: abortRun
tags: [Runs]
summary: Abort a run
description: |
`202` with the run object while it stops, `200` if it had already ended. A run still `queued` stops at once:
`200` with `status: aborted`, nothing charged. Records committed so far stay readable and charged. The result
of an aborted run reads as `partial` with `within_scope_passed` false; before engine `65bdf2c894` is
released it reads `bounded` (`FINDINGS.md`, finding 16).
x-scopes-any-of: [run]
parameters:
- $ref: '#/components/parameters/RunId'
responses:
'200':
description: The run had already ended.
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
'202':
description: The run is stopping.
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/run:
post:
operationId: runSource
tags: [Source APIs]
summary: Run one of your source APIs
description: |
Executes an accepted source definition. A run that ends within `wait_seconds` (default 90) answers `200` with
its records; a longer run answers `202` with the run object: read `getRunResult` (`links.result`) after
`Retry-After` seconds. There is no keyed result route for source runs.
Send `expected_version` (the full 64-character definition version) to guard against a changed definition, or
`definition_version` to select an accepted revision. Do not send both.
Use the origin from your source's connection details. Today that is `https://api.cleanedweb.com`.
x-scopes-any-of: [run]
x-idempotent: true
parameters:
- $ref: '#/components/parameters/SourceId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SourceRunRequest'
example:
expected_version: eec683b95f337dcc63a3fb5bf1e23729fb71f6f719f51ea771c19345b5893252
input: {}
max_items: 25
responses:
'200':
description: The run ended within `wait_seconds`.
headers:
Location:
$ref: '#/components/headers/Location'
content:
application/json:
schema:
$ref: '#/components/schemas/RunResult'
'202':
$ref: '#/components/responses/RunAccepted'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'429':
$ref: '#/components/responses/RateLimited'
'502':
$ref: '#/components/responses/BadGateway'
'503':
$ref: '#/components/responses/ServiceUnavailable'
'504':
$ref: '#/components/responses/GatewayTimeout'
/v1/sources/{source_id}/runs:
post:
operationId: startSourceRun
tags: [Source APIs]
summary: Start a source run without waiting
description: |
Takes the same headers and body as `runSource`, with `wait_seconds` defaulting to `0`. Answers with the run
object and a `Location` header: usually `202`, or `200` when the run already ended (a failed run included). A
replayed key adds `Idempotent-Replayed: true`. Background runs share one queue lane; `/run`, `/stream` and MCP
calls share another.
x-scopes-any-of: [run]
x-idempotent: true
parameters:
- $ref: '#/components/parameters/SourceId'
- name: Idempotency-Key
in: header
required: false
description: Required for a customer workspace run (it answers `422` `idempotency_key_required` without one). Send it on every call so a lost response can be recovered.
schema:
$ref: '#/components/schemas/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SourceRunRequest'
responses:
'200':
description: The run already ended; the body is the run object, not the records.
headers:
Location:
$ref: '#/components/headers/Location'
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
'202':
description: The run is queued or running.
headers:
Location:
$ref: '#/components/headers/Location'
Idempotent-Replayed:
$ref: '#/components/headers/IdempotentReplayed'
content:
application/json:
schema:
$ref: '#/components/schemas/Run'
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'429':
$ref: '#/components/responses/RateLimited'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/stream:
post:
operationId: streamSourceRun
tags: [Source APIs]
summary: Stream a source run's records
description: |
Takes the same headers and body as `runSource` and answers newline-delimited JSON; every line has an
increasing `sequence`. First line `progress` (stage `running`, with the run, whose `status` is usually still
`queued`), then `records` lines as pages are
committed, a `progress` heartbeat after 10 seconds without records, and a final `done` or `error` line. The
stream has no fixed time limit. Closing it leaves the run running; read it with `getRun`.
x-scopes-any-of: [run]
x-idempotent: true
parameters:
- $ref: '#/components/parameters/SourceId'
- $ref: '#/components/parameters/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SourceRunRequest'
responses:
'200':
description: The event stream. A failed run ends it with an `error` line, not an HTTP error status.
headers:
Location:
$ref: '#/components/headers/Location'
content:
application/x-ndjson:
schema:
type: string
description: One `StreamEvent` JSON object per line.
example: |
{"type":"progress","stage":"running","run":{"run_id":"0123456789abcdef0123456789abcdef","status":"running"},"sequence":1}
{"type":"records","records":[{"title":"creeper"}],"definition_version":"eec683b9","sequence":2}
{"type":"done","summary":{"status":"completed"},"elapsedMs":4200,"sequence":3}
'401':
$ref: '#/components/responses/Unauthorized'
'402':
$ref: '#/components/responses/PaymentRequired'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'429':
$ref: '#/components/responses/RateLimited'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/runs/{run_id}:
get:
operationId: getSourceRun
tags: [Source APIs]
summary: Read a source run's recorded details
description: 'The run''s recorded details: `run`, `results`, `billing` and `recovery`. Needs the `run` or `results` scope.'
x-scopes-any-of: [run, results]
parameters:
- $ref: '#/components/parameters/SourceId'
- $ref: '#/components/parameters/RunId'
responses:
'200':
description: The run detail.
content:
application/json:
schema:
$ref: '#/components/schemas/SourceRunDetail'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/runs/{run_id}/result:
get:
operationId: getSourceRunResult
tags: [Source APIs]
summary: Read a source run's result
description: Same as `getRunResult` for a run of this source (a run of another source answers `404`). Needs the `run` or `results` scope.
x-scopes-any-of: [run, results]
parameters:
- $ref: '#/components/parameters/SourceId'
- $ref: '#/components/parameters/RunId'
- $ref: '#/components/parameters/Nulls'
responses:
'200':
description: The run ended.
content:
application/json:
schema:
$ref: '#/components/schemas/RunResult'
'202':
$ref: '#/components/responses/RunAccepted'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/versions:
get:
operationId: listSourceVersions
tags: [Source APIs]
summary: List a source's definition versions
description: Revision history, newest first, with the accepted jobs behind each version.
x-scopes-any-of: [read]
parameters:
- $ref: '#/components/parameters/SourceId'
- name: limit
in: query
required: false
schema:
type: integer
minimum: 1
maximum: 100
default: 20
- name: cursor
in: query
required: false
schema:
type: string
responses:
'200':
description: One page of versions.
content:
application/json:
schema:
$ref: '#/components/schemas/SourceVersionList'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/versions/{definition_version}/contract:
get:
operationId: getSourceVersionContract
tags: [Source APIs]
summary: Read the contract of one definition version
description: The published contract of an accepted immutable revision, with a ready-made run `request`.
x-scopes-any-of: [read]
parameters:
- $ref: '#/components/parameters/SourceId'
- name: definition_version
in: path
required: true
description: The full 64-character lowercase SHA-256 version.
schema:
type: string
pattern: '^[a-f0-9]{64}$'
responses:
'200':
description: The contract.
content:
application/json:
schema:
$ref: '#/components/schemas/SourceVersionContract'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'422':
$ref: '#/components/responses/UnprocessableEntity'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/connection:
get:
operationId: getSourceConnection
tags: [Source APIs]
summary: Read a source's connection details
description: |
The run request for the active definition: method, path, a body with `expected_version`, and fresh example
idempotency keys (fetching again creates new ones, so keep the one you use). The details carry paths only,
never an origin.
x-scopes-any-of: [read]
parameters:
- $ref: '#/components/parameters/SourceId'
responses:
'200':
description: The connection details.
headers:
Cache-Control:
$ref: '#/components/headers/CacheControl'
content:
application/json:
schema:
$ref: '#/components/schemas/SourceConnection'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/sources/{source_id}/health:
get:
operationId: getSourceHealth
tags: [Source APIs]
summary: Read a source's health
description: |
Monitoring evidence for the active definition of one of your workspace's sources. Needs the `read` scope
(`FINDINGS.md`, finding 5). A catalog API's source id, or one from another workspace, answers `404`
(`Unknown API`).
x-scopes-any-of: [read]
parameters:
- $ref: '#/components/parameters/SourceId'
responses:
'200':
description: The health report.
content:
application/json:
schema:
$ref: '#/components/schemas/ApiHealth'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'503':
$ref: '#/components/responses/ServiceUnavailable'
/v1/schedules:
post:
operationId: createSchedule
tags: [Schedules]
summary: Create a schedule
description: |
Runs a catalog endpoint (`api_id` and `endpoint_id`) or one of your sources (`source_id`) at a cadence of every
hour, day or week (UTC, at most once an hour). Each due slot starts an ordinary charged run. The creating key
stands behind it and must keep the `run` scope. A workspace holds at most 50 schedules.
The retry key is the `Idempotency-Key` header or the body's `idempotency_key`; send one. The same key and
arguments answer the same schedule (`200`, `Idempotent-Replayed: true`) and never create a second; another
request under the same key answers `409` `schedule_idempotency_conflict`. A deleted schedule is never revived.
Not described in the public docs, whose scheduling guide says there is no native endpoint.
x-scopes-any-of: [run]
x-idempotent: true
parameters:
- name: Idempotency-Key
in: header
required: false
description: The retry key. Send it here or as `idempotency_key` in the body; if both are present they must match.
schema:
$ref: '#/components/schemas/IdempotencyKey'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ScheduleCreate'
example:
api_id: generated_047a8ebb25911ccf62f4a212
endpoint_id: generated_047a8ebb25911ccf62f4a212_search
input: {}
max_items: 100
every: day
at_utc: '06:30'
name: Daily GitHub topics
idempotency_key: daily-github-topics-1
responses:
'200':
description: The key already made this schedule.