forked from input-output-hk/nami
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkoios-docs.yml
More file actions
6754 lines (6682 loc) · 263 KB
/
koios-docs.yml
File metadata and controls
6754 lines (6682 loc) · 263 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: Koios API
contact:
name: Koios Core Team
url: https://t.me/CardanoKoios
email: general@koios.rest
license:
name: Creative Commons Attribution 4.0 International
url: https://github.com/cardano-community/koios-artifacts/blob/main/LICENSE
version: v1.3.2
description: |
Koios is best described as a Decentralized and Elastic RESTful query layer for exploring data on Cardano blockchain to consume within applications/wallets/explorers/etc. This page not only provides an OpenAPI Spec for live implementation, but also ability to execute live demo from client browser against each endpoint with pre-filled examples.
# API Usage
The endpoints served by Koios can be browsed from the left side bar of this site. You will find that almost each endpoint has an example that you can `Try` and will help you get an example in shell using cURL. For public queries, you do not need to register yourself - you can simply use them as per the examples provided on individual endpoints. But in addition, the [PostgREST API](https://postgrest.org/en/stable/api.html) used underneath provides a handful of features that can be quite handy for you to improve your queries to directly grab very specific information pertinent to your calls, reducing data you download and process.
## Vertical Filtering
Instead of returning entire row, you can elect which rows you would like to fetch from the endpoint by using the `select` parameter with corresponding columns separated by commas. See example below (first is complete information for tip, while second command gives us 3 columns we are interested in):<br><br>
``` bash
curl "https://api.koios.rest/api/v1/tip"
# [{"hash":"4d44c8a453e677f933c3df42ebcf2fe45987c41268b9cfc9b42ae305e8c3d99a","epoch_no":317,"abs_slot":51700871,"epoch_slot":120071,"block_height":6806994,"block_time":1643267162}]
curl "https://api.koios.rest/api/v1/blocks?select=epoch_no,epoch_slot,block_height"
# [{"epoch_no":317,"epoch_slot":120071,"block_height":6806994}]
```
## Horizontal Filtering
You can filter the returned output based on specific conditions using operators against a column within returned result. Consider an example where you would want to query blocks minted in first 3 minutes of epoch 250 (i.e. epoch_slot was less than 180). To do so your query would look like below:<br><br>
``` bash
curl "https://api.koios.rest/api/v1/blocks?epoch_no=eq.250&epoch_slot=lt.180"
# [{"hash":"8fad2808ac6b37064a0fa69f6fe065807703d5235a57442647bbcdba1c02faf8","epoch_no":250,"abs_slot":22636942,"epoch_slot":142,"block_height":5385757,"block_time":1614203233,"tx_count":65,"vrf_key":"vrf_vk14y9pjprzlsjvjt66mv5u7w7292sxp3kn4ewhss45ayjga5vurgaqhqknuu","pool":null,"op_cert_counter":2},
# {"hash":"9d33b02badaedc0dedd0d59f3e0411e5fb4ac94217fb5ee86719e8463c570e16","epoch_no":250,"abs_slot":22636800,"epoch_slot":0,"block_height":5385756,"block_time":1614203091,"tx_count":10,"vrf_key":"vrf_vk1dkfsejw3h2k7tnguwrauqfwnxa7wj3nkp3yw2yw3400c4nlkluwqzwvka6","pool":null,"op_cert_counter":2}]
```
Here, we made use of `eq.` operator to denote a filter of "value equal to" against `epoch_no` column. Similarly, we added a filter using `lt.` operator to denote a filter of "values lower than" against `epoch_slot` column. You can find a complete list of operators supported in PostgREST documentation (commonly used ones extracted below):
|Abbreviation|In PostgreSQL|Meaning |
|------------|-------------|-------------------------------------------|
|eq |`=` |equals |
|gt |`>` |greater than |
|gte |`>=` |greater than or equal |
|lt |`<` |less than |
|lte |`<=` |less than or equal |
|neq |`<>` or `!=` |not equal |
|like |`LIKE` |LIKE operator (use * in place of %) |
|in |`IN` |one of a list of values, e.g. `?a=in.("hi,there","yes,you")`|
|is |`IS` |checking for exact equality (null,true,false,unknown)|
|cs |`@>` |contains e.g. `?tags=cs.{example, new}` |
|cd |`<@` |contained in e.g. `?values=cd.{1,2,3}` |
|not |`NOT` |negates another operator |
|or |`OR` |logical `OR` operator |
|and |`AND` |logical `AND` operator |
## Pagination (offset/limit)
When you query any endpoint in PostgREST, the number of observations returned will be limited to a maximum of 1000 rows (set via `max-rows` config option in the `grest.conf` file. This - however - is a result of a paginated call, wherein the [ up to ] 1000 records you see without any parameters is the first page. If you want to see the next 1000 results, you can always append `offset=1000` to view the next set of results. But what if 1000 is too high for your use-case and you want smaller page? Well, you can specify a smaller limit using parameter `limit`, which will see shortly in an example below. The obvious question at this point that would cross your mind is - how do I know if I need to offset and what range I am querying? This is where headers come in to your aid.
The default headers returned by PostgREST will include a `Content-Range` field giving a range of observations returned. For large tables, this range could include a wildcard `*` as it is expensive to query exact count of observations from endpoint. But if you would like to get an estimate count without overloading servers, PostgREST can utilise Postgres's own maintenance thread results (which maintain stats for each table) to provide you a count, by specifying a header `"Prefer: count=estimated"`.
Sounds confusing? Let's see this in practice, to hopefully make it easier.
Consider a simple case where I want query `blocks` endpoint for `block_height` column and focus on `content-range` header to monitor the rows we discussed above.<br><br>
``` bash
curl -s "https://api.koios.rest/api/v1/blocks?select=block_height" -I | grep -i content-range
# content-range: 0-999/*
```
As we can see above, the number of observations returned was 1000 (range being 0-999), but the total size was not queried to avoid wait times. Now, let's modify this default behaviour to query rows beyond the first 999, but this time - also add another clause to limit results by 500. We can do this using `offset=1000` and `limit=500` as below:<br><br>
``` bash
curl -s "https://api.koios.rest/api/v1/blocks?select=block_height&offset=1000&limit=500" -I | grep -i content-range
# content-range: 1000-1499/*
```
The above methods for pagination are very useful to keep some of the queries light as well as process the output in smaller pages, making better use of your resources and respecting server timeouts for response times.
However, note that due to the complex nature of some queries that require pre-processing before being subjected to paginations, these may not always be helpful to avoid server timeouts.
## Ordering
You can set a sorting order for returned queries against specific column(s).
Consider example where you want to check `epoch_no` and `epoch_slot` for the first 5 blocks created by a particular pool, i.e. you can set order to ascending based on block_height column and add horizontal filter for that pool ID as below:<br><br>
``` bash
curl -s "https://api.koios.rest/api/v1/blocks?pool=eq.pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc&order=block_height.asc&limit=5"
# [{"hash":"610b4c7bbebeeb212bd002885048cc33154ba29f39919d62a3d96de05d315706","epoch_no":236,"abs_slot":16594295,"epoch_slot":5495,"block_height":5086774,"block_time":1608160586,"tx_count":1,"vrf_key":"vrf_vk18x0e7dx8j37gdxftnn8ru6jcxs7n6acdazc4ykeda2ygjwg9a7ls7ns699","pool":"pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc","op_cert_counter":1},
# {"hash":"d93d1db5275329ab695d30c06a35124038d8d9af64fc2b0aa082b8aa43da4164","epoch_no":236,"abs_slot":16597729,"epoch_slot":8929,"block_height":5086944,"block_time":1608164020,"tx_count":7,"vrf_key":"vrf_vk18x0e7dx8j37gdxftnn8ru6jcxs7n6acdazc4ykeda2ygjwg9a7ls7ns699","pool":"pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc","op_cert_counter":1},
# {"hash":"dc9496eae64294b46f07eb20499ae6dae4d81fdc67c63c354397db91bda1ee55","epoch_no":236,"abs_slot":16598058,"epoch_slot":9258,"block_height":5086962,"block_time":1608164349,"tx_count":1,"vrf_key":"vrf_vk18x0e7dx8j37gdxftnn8ru6jcxs7n6acdazc4ykeda2ygjwg9a7ls7ns699","pool":"pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc","op_cert_counter":1},
# {"hash":"6ebc7b734c513bc19290d96ca573a09cac9503c5a349dd9892b9ab43f917f9bd","epoch_no":236,"abs_slot":16601491,"epoch_slot":12691,"block_height":5087097,"block_time":1608167782,"tx_count":0,"vrf_key":"vrf_vk18x0e7dx8j37gdxftnn8ru6jcxs7n6acdazc4ykeda2ygjwg9a7ls7ns699","pool":"pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc","op_cert_counter":1},
# {"hash":"2eac97548829fc312858bc56a40f7ce3bf9b0ca27ee8530283ccebb3963de1c0","epoch_no":236,"abs_slot":16602308,"epoch_slot":13508,"block_height":5087136,"block_time":1608168599,"tx_count":1,"vrf_key":"vrf_vk18x0e7dx8j37gdxftnn8ru6jcxs7n6acdazc4ykeda2ygjwg9a7ls7ns699","pool":"pool155efqn9xpcf73pphkk88cmlkdwx4ulkg606tne970qswczg3asc","op_cert_counter":1}]
```
## Response Formats
You can get the results from the PostgREST endpoints in CSV or JSON formats. The default response format will always be JSON, but if you'd like to switch, you can do so by specifying header `'Accept: text/csv'` or `'Accept: application/json'`.
Below is an example of JSON/CSV output making use of above to print first in JSON (default), and then override response format to CSV.<br><br>
``` bash
curl -s "https://api.koios.rest/api/v1/blocks?select=epoch_no,epoch_slot,block_time&limit=3"
# [{"epoch_no":318,"epoch_slot":27867,"block_time":1643606958},
# {"epoch_no":318,"epoch_slot":27841,"block_time":1643606932},
# {"epoch_no":318,"epoch_slot":27839,"block_time":1643606930}]
curl -s "https://api.koios.rest/api/v1/blocks?select=epoch_no,epoch_slot,block_time&limit=3" -H "Accept: text/csv"
# epoch_no,epoch_slot,block_time
# 318,28491,1643607582
# 318,28479,1643607570
# 318,28406,1643607497
```
## Limits
While use of Koios is completely free and there are no registration requirements to the usage, the monitoring layer will only restrict spam requests that can potentially cause high amount of load to backends. The emphasis is on using list of objects first, and then [bulk where available] query specific objects to drill down where possible - which forms higher performance results to consumer as well as instance provider. Some basic protection against patterns that could cause unexpected resource spikes are protected as per below:
- Burst Limit: A single IP can query an endpoint up to 100 times within 10 seconds (that's about 8.64 million requests within a day). The sleep time if a limit is crossed is minimal (60 seconds) for that IP - during which, the monitoring layer will return HTTP Status `429 - Too many requests`.
- Pagination/Limits: Any query results fetched will be paginated by 1000 records (you can reduce limit and or control pagination offsets on URL itself, see API > Pagination section for more details).
- Query timeout: If a query from server takes more than 30 seconds, it will return a HTTP Status of `504 - Gateway timeout`. This is because we would want to ensure you're using the queries optimally, and more often than not - it would indicate that particular endpoint is not optimised (or the network connectivity is not optimal between servers).
- Payload size limit: Koios supports sending bulk objects to reduce networking costs as well as number of calls users spent. However, this can also become an easy attack surface. Thus, we've had to add a strict limit for request body size to be limited to 1kb for public and 5kb for registered tiers.
Yet, there may be cases where the above restrictions may need exceptions (for example, an explorer or a wallet might need more connections than above - going beyond the Burst Limit). For such cases, it is best to approach the team and we can work towards a solution.
# Authentication
While Koios public tier remains unauthenticated and allows queries without any authentication, it has low limits to prevent actions against an erroraneous query/loop from a consumer. There is also a Free tier which requires setting up Bearer Auth token that is linked to the owner's wallet account (which can be connected to via [Koios website](https://koios.rest/pricing/Pricing.html) ).
The examples across this API site already [supports authentication](/#auth), for you to use in the queries.
# Community projects
A big thank you to the following projects who are already starting to use Koios from early days. A list of tools, libraries and projects utilising Koios (atleast those who'd like to be named) can be found [here](https://www.koios.rest/community.html)
x-logo:
url: "https://api.koios.rest/images/koios.png"
servers:
- url: https://api.koios.rest/api/v1
description: Mainnet
- url: https://guild.koios.rest/api/v1
description: Guildnet
- url: https://preview.koios.rest/api/v1
description: Preview Network
- url: https://preprod.koios.rest/api/v1
description: Preprod Network
- url: https://sancho.koios.rest/api/v1
description: Sanchonet Network
paths:
/tip: #RPC
get:
tags:
- Network
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tip"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Query Chain Tip
description: Get the tip info about the latest block seen by chain
operationId: tip
/genesis: #RPC
get:
tags:
- Network
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/genesis"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Get Genesis info
description: Get the Genesis parameters used to start specific era on chain
operationId: genesis
/totals: #RPC
get:
tags:
- Network
parameters:
- $ref: "#/components/parameters/_epoch_no"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/totals"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Get historical tokenomic stats
description: >-
Get the circulating utxo, treasury, rewards, supply and reserves in
lovelace for specified epoch, all epochs if empty
operationId: totals
/param_updates: #RPC
get:
tags:
- Network
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/param_updates"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Param Update Proposals
description: Get all parameter update proposals submitted to the chain starting Shelley era
operationId: param_updates
/cli_protocol_params: #RPC
get:
tags:
- Network
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/cli_protocol_params"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: CLI Protocol Parameters
description: >-
Get Current Protocol Parameters as published by cardano-cli. Note that
the output schema of this command is unfortunately fluid on cardano-node
and may vary between CLI versions/era. Accordingly, the returned output for
this endpoint is left as raw JSON (single row) and any filtering to output should
be done on client-side
operationId: cli_protocol_params
/reserve_withdrawals: #RPC
get:
tags:
- Network
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/reserve_withdrawals"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Reserve Withdrawals
description: List of all withdrawals from reserves against stake accounts
operationId: reserve_withdrawals
/treasury_withdrawals: #RPC
get:
tags:
- Network
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/reserve_withdrawals"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Treasury Withdrawals
description: List of all withdrawals from treasury against stake accounts
operationId: treasury_withdrawals
/epoch_info: #RPC
get:
tags:
- Epoch
parameters:
- $ref: "#/components/parameters/_epoch_no"
- $ref: "#/components/parameters/_include_next_epoch"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/epoch_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Epoch Information
description: Get the epoch information, all epochs if no epoch specified
operationId: epoch_info
/epoch_params: #RPC
get:
tags:
- Epoch
parameters:
- $ref: "#/components/parameters/_epoch_no"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/epoch_params"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Epoch's Protocol Parameters
description: >-
Get the protocol parameters for specific epoch, returns information
about all epochs if no epoch specified
operationId: epoch_params
/epoch_block_protocols: #RPC
get:
tags:
- Epoch
parameters:
- $ref: "#/components/parameters/_epoch_no"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/epoch_block_protocols"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Epoch's Block Protocols
description: >-
Get the information about block protocol distribution in epoch
operationId: epoch_block_protocols
/blocks: #RPC
get:
tags:
- Block
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/blocks"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Block List
description: Get summarised details about all blocks (paginated - latest first)
operationId: blocks
/block_info: #RPC
post:
tags:
- Block
requestBody:
$ref: "#/components/requestBodies/block_hashes"
responses:
"200":
description: Success
content:
application/json:
schema:
$ref: "#/components/schemas/block_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Block Information
description: Get detailed information about a specific block
operationId: block_info
/block_txs: #RPC
post:
tags:
- Block
requestBody:
$ref: "#/components/requestBodies/block_hashes"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/block_txs"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Block Transactions
description: Get a list of all transactions included in provided blocks
operationId: block_txs
/block_tx_cbor: #RPC
post:
tags:
- Block
requestBody:
$ref: "#/components/requestBodies/block_hashes"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/block_tx_cbor"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Block Transactions (Raw CBOR)
description: Get raw CBOR data for all transaction(s) within requested blocks
operationId: block_tx_cbor
/block_tx_info: #RPC
post:
deprecated: true
tags:
- Block
requestBody:
$ref: "#/components/requestBodies/block_tx_info"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/block_tx_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Block Transactions (Detailed Info)
description: Get detailed information about transaction(s) for requested blocks
operationId: block_tx_info
x-badges:
- color: red
label: "Deprecated"
/utxo_info: #RPC
post:
tags:
- Transactions
requestBody:
$ref: "#/components/requestBodies/utxo_refs_with_extended"
responses:
"200":
description: Success!
content:
application/json:
schema:
$ref: "#/components/schemas/utxo_infos"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: UTxO Info
description: Get UTxO set for requested UTxO references
operationId: utxo_info
/tx_cbor: #RPC
post:
tags:
- Transactions
requestBody:
$ref: "#/components/requestBodies/tx_ids"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tx_cbor"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Raw Transaction (CBOR)
description: Get raw transaction(s) in CBOR format
operationId: tx_cbor
/tx_info: #RPC
post:
tags:
- Transactions
requestBody:
$ref: "#/components/requestBodies/tx_info"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tx_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Transaction Information
description: Get detailed information about transaction(s)
operationId: tx_info
/tx_metadata: #RPC
post:
tags:
- Transactions
requestBody:
$ref: "#/components/requestBodies/tx_ids"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tx_metadata"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Transaction Metadata
description: Get metadata information (if any) for given transaction(s)
operationId: tx_metadata
/tx_metalabels: #RPC
get:
tags:
- Transactions
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tx_metalabels"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Transaction Metadata Labels
description: Get a list of all transaction metalabels
operationId: tx_metalabels
/submittx: #submit-api
post:
tags:
- Transactions
requestBody:
$ref: "#/components/requestBodies/txbin"
x-code-samples:
- lang: "Shell"
source: |
# Assuming ${data} is a raw binary serialized transaction on the file-system.
# If using a CLI-generated tx file, please ensure to deserialise (using `xxd -p -r <<< $(jq .cborHex ${tx.signed}) > ${data}`) first before submitting.
curl -X POST \
--header "Content-Type: application/cbor" \
--data-binary @${data} https://api.koios.rest/api/v1/submittx
responses:
"202":
description: OK
content:
application/json:
schema:
description: The transaction id.
type: string
format: hex
minLength: 64
maxLength: 64
example: 92bcd06b25dfbd89b578d536b4d3b7dd269b7c2aa206ed518012cffe0444d67f
"400":
description: An error occured while submitting transaction.
summary: Submit Transaction
description: Submit an already serialized transaction to the network.
operationId: submittx
/tx_status: #RPC
post:
tags:
- Transactions
requestBody:
$ref: "#/components/requestBodies/tx_ids"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tx_status"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Transaction Status
description: Get the number of block confirmations for a given transaction hash list
operationId: tx_status
/tx_outs_epoch: #RPC
get:
tags:
- Transactions
parameters:
- $ref: "#/components/parameters/_epoch_no"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tx_outs_epoch"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Transaction outputs by epoch
description: Get a list of all transaction outputs for requested epoch
operationId: tx_outs_epoch
/tx_utxos: #RPC
post:
tags:
- Transactions
deprecated: true
requestBody:
$ref: "#/components/requestBodies/tx_ids"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/tx_utxos"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Transaction UTxOs
description: Get UTxO set (inputs/outputs) of transactions [DEPRECATED - Use /utxo_info instead].
operationId: tx_utxos
x-badges:
- color: red
label: "Deprecated"
/address_info: #RPC
post:
tags:
- Address
requestBody:
$ref: "#/components/requestBodies/payment_addresses"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/address_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Address Information
description: Get address info - balance, associated stake address (if any) and UTxO set for given addresses
operationId: address_info
/address_utxos: #RPC
post:
tags:
- Address
requestBody:
$ref: "#/components/requestBodies/payment_addresses_with_extended"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/utxo_infos"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Address UTXOs
description: Get UTxO set for given addresses
operationId: address_utxos
/address_outputs: #RPC
post:
tags:
- Address
requestBody:
$ref: "#/components/requestBodies/address_txs"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/address_outputs"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Address Outputs
description: Basic transaction output info for given addresses
operationId: address_outputs
/credential_utxos: #RPC
post:
tags:
- Address
requestBody:
$ref: "#/components/requestBodies/credential_utxos"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/utxo_infos"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: UTxOs from payment credentials
description: Get UTxO details for requested payment credentials
operationId: credential_utxos
/address_txs: #RPC
post:
tags:
- Address
requestBody:
$ref: "#/components/requestBodies/address_txs"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/address_txs"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Address Transactions
description: Get the transaction hash list of input address array, optionally filtering after specified block height (inclusive)
operationId: address_txs
/credential_txs: #RPC
post:
tags:
- Address
requestBody:
$ref: "#/components/requestBodies/credential_txs"
responses:
"200":
description: Array of transaction hashes for given credential(s)
content:
application/json:
schema:
$ref: "#/components/schemas/address_txs"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Transactions from payment credentials
description: Get the transaction hash list of input payment credential array, optionally filtering after specified block height (inclusive)
operationId: credential_txs
/address_assets: #RPC
post:
tags:
- Address
requestBody:
$ref: "#/components/requestBodies/payment_addresses"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/address_assets"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Address Assets
description: Get the list of all the assets (policy, name and quantity) for given addresses
operationId: address_assets
/account_list: #RPC
get:
tags:
- Stake Account
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/account_list"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Account List
description: Get a list of all stake addresses that have atleast 1 transaction
operationId: account_list
/account_info: #RPC
post:
tags:
- Stake Account
requestBody:
$ref: "#/components/requestBodies/stake_addresses"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/account_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Account Information
description: Get the account information for given stake addresses
operationId: account_info
/account_info_cached: #RPC
post:
tags:
- Stake Account
requestBody:
$ref: "#/components/requestBodies/stake_addresses"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/account_info"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Account Information (Cached)
description: Get the cached account information for given stake addresses (effective for performance query against registered accounts)
operationId: account_info_cached
/account_utxos: #RPC
post:
tags:
- Stake Account
requestBody:
$ref: "#/components/requestBodies/stake_addresses_with_extended"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/utxo_infos"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: UTxOs for stake addresses (accounts)
description: Get a list of all UTxOs for given stake addresses (account)s
operationId: account_utxos
/account_txs: #RPC
get:
tags:
- Stake Account
parameters:
- $ref: "#/components/parameters/_stake_address"
- $ref: "#/components/parameters/_after_block_height"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/address_txs"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Account Txs
description: Get a list of all Txs for a given stake address (account)
operationId: account_txs
/account_rewards: #RPC
post:
deprecated: true
tags:
- Stake Account
requestBody:
$ref: "#/components/requestBodies/stake_addresses_with_epoch_no"
responses:
"200":
description: Success!!
content:
application/json:
schema:
$ref: "#/components/schemas/account_rewards"
"400":
$ref: "#/components/responses/BadRequest"
"401":
$ref: "#/components/responses/Unauthorized"
"404":
$ref: "#/components/responses/NotFound"
summary: Account Rewards
description: >-
Get the full rewards history (including MIR) for given stake addresses
operationId: account_rewards
x-badges:
- color: red
label: "Deprecated"
/account_reward_history: #RPC
post:
tags:
- Stake Account
requestBody:
$ref: "#/components/requestBodies/stake_addresses_with_epoch_no"