-
Notifications
You must be signed in to change notification settings - Fork 107
/
openapi.yaml
3943 lines (3805 loc) · 132 KB
/
openapi.yaml
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.0.2
servers:
- url: https://api.mainnet.hiro.so/
description: Mainnet
- url: https://api.nakamoto.testnet.hiro.so/
description: Nakamoto Testnet
- url: https://api.testnet.hiro.so/
description: Testnet
- url: http://localhost:3999/
description: Local
info:
title: Stacks Blockchain API
version: 'STACKS_API_VERSION'
description: |
Welcome to the API reference overview for the [Stacks Blockchain API](https://docs.hiro.so/stacks-blockchain-api).
[Download Postman collection](https://hirosystems.github.io/stacks-blockchain-api/collection.json)
tags:
- name: Accounts
description: Read-only endpoints to obtain Stacks account details
externalDocs:
description: Stacks Documentation - Accounts
url: https://docs.stacks.co/understand-stacks/accounts
- name: Blocks
description: Read-only endpoints to obtain Stacks block details
- name: Burn Blocks
description: Read-only endpoints to obtain burn block details
- name: Faucets
description: Endpoints to request STX or BTC tokens (not possible on Mainnet)
- name: Fees
description: Read-only endpoints to obtain fee details
- name: Info
description: Read-only endpoints to obtain network, Proof-of-Transfer, Stacking, STX token, and node information
- name: Microblocks
description: Read-only endpoints to obtain microblocks details
externalDocs:
description: Stacks Documentation - Microblocks
url: https://docs.stacks.co/understand-stacks/microblocks
- name: Names
description: Read-only endpoints realted to the Blockchain Naming System on Stacks
externalDocs:
description: Stacks Documentation - Blockchain Naming System
url: https://docs.stacks.co/build-apps/references/bns
- name: Non-Fungible Tokens
description: Read-only endpoints to obtain non-fungible token details
externalDocs:
description: Stacks Documentation - Tokens
url: https://docs.stacks.co/write-smart-contracts/tokens
- name: Rosetta
description: Endpoints to support the Rosetta API open blockchain standard
externalDocs:
description: Hiro Documentation - Rosetta Support
url: https://docs.hiro.so/get-started/stacks-blockchain-api#rosetta-support
- name: Search
description: Read-only endpoints to search for accounts, blocks, smart contracts, and transactions
- name: Smart Contracts
description: Read-only endpoints to obtain Clarity smart contract details
externalDocs:
description: Stacks Documentation - Clarity Smart Contracts
url: https://docs.stacks.co/write-smart-contracts/overview
- name: Stacking Rewards
description: Read-only endpoints to obtain Stacking reward details
externalDocs:
description: Stacks Documentation - Stacking
url: https://docs.stacks.co/understand-stacks/stacking
- name: Transactions
description: Endpoints to obtain transaction details and to broadcast transactions to the network
externalDocs:
description: Hiro Documentation - Transactions
url: https://docs.hiro.so/get-started/transactions
- name: Mempool
description: Endpoints to obtain Mempool information
- name: Proof of Transfer
description: Endpoints to get information about the Proof of Transfer consensus mechanism
paths:
/extended/v1/faucets/stx:
parameters:
- name: address
in: query
description: A valid testnet STX address
required: true
schema:
type: string
example: ST3M7N9Q9HDRM7RVP1Q26P0EE69358PZZAZD7KMXQ
- name: stacking
in: query
description: Request the amount of STX tokens needed for individual address stacking
required: false
schema:
type: boolean
default: false
post:
summary: Get STX testnet tokens
description: |
Add 500 STX tokens to the specified testnet address. Testnet STX addresses begin with `ST`. If the `stacking`
parameter is set to `true`, the faucet will add the required number of tokens for individual stacking to the
specified testnet address.
The endpoint returns the transaction ID, which you can use to view the transaction in the
[Stacks Explorer](https://explorer.hiro.so/?chain=testnet). The tokens are delivered once the transaction has
been included in an anchor block.
A common reason for failed faucet transactions is that the faucet has run out of tokens. If you are experiencing
failed faucet transactions to a testnet address, you can get help in [Discord](https://stacks.chat).
**Note:** This is a testnet only endpoint. This endpoint will not work on the mainnet.
tags:
- Faucets
operationId: run_faucet_stx
responses:
200:
description: Success
content:
application/json:
schema:
$ref: ./api/faucet/run-faucet.schema.json
example:
$ref: ./api/faucet/run-faucet.example.json
500:
description: Faucet call failed
/extended/v1/faucets/btc:
parameters:
- name: address
in: query
description: A valid testnet BTC address
required: true
schema:
type: string
example: "2N4M94S1ZPt8HfxydXzL2P7qyzgVq7MHWts"
post:
summary: Add testnet BTC tokens to address
description: |
Add 1 BTC token to the specified testnet BTC address.
The endpoint returns the transaction ID, which you can use to view the transaction in a testnet Bitcoin block
explorer. The tokens are delivered once the transaction has been included in a block.
**Note:** This is a testnet only endpoint. This endpoint will not work on the mainnet.
tags:
- Faucets
operationId: run_faucet_btc
requestBody:
content:
application/json:
schema:
type: object
properties:
address:
description: BTC testnet address
type: string
example:
address: 2N4M94S1ZPt8HfxydXzL2P7qyzgVq7MHWts
responses:
200:
description: Success
content:
application/json:
schema:
$ref: ./api/faucet/run-faucet.schema.json
example:
$ref: ./api/faucet/run-faucet.example.json
403:
description: BTC Faucet not fully configured
content:
application/json:
schema:
type: object
properties:
error:
type: string
success:
type: boolean
example:
error: BTC Faucet not fully configured
success: false
500:
description: Faucet call failed
/extended/v1/tx:
get:
summary: Get recent transactions
tags:
- Transactions
operationId: get_transaction_list
description: |
Retrieves all recently mined transactions
If using TypeScript, import typings for this response from our types package:
`import type { TransactionResults } from '@stacks/stacks-blockchain-api-types';`
parameters:
- name: limit
in: query
description: max number of transactions to fetch
required: false
schema:
type: integer
default: 96
maximum: 200
example: 100
- name: offset
in: query
description: index of first transaction to fetch
required: false
schema:
type: integer
example: 42000
- name: type
in: query
description: Filter by transaction type
required: false
style: form
explode: true
schema:
type: array
example: coinbase
items:
type: string
enum: [coinbase, token_transfer, smart_contract, contract_call, poison_microblock, tenure_change]
- name: from_address
in: query
description: Option to filter results by sender address
required: false
schema:
type: string
- name: to_address
in: query
description: Option to filter results by recipient address
required: false
schema:
type: string
- name: sort_by
in: query
description: Option to sort results by block height, timestamp, or fee
required: false
schema:
type: string
enum: [block_height, burn_block_time, fee]
example: burn_block_time
default: block_height
- name: start_time
in: query
description: Filter by transactions after this timestamp (unix timestamp in seconds)
required: false
schema:
type: integer
example: 1704067200
- name: end_time
in: query
description: Filter by transactions before this timestamp (unix timestamp in seconds)
required: false
schema:
type: integer
example: 1706745599
- name: contract_id
in: query
description: Filter by contract call transactions involving this contract ID
required: false
schema:
type: string
example: "SP000000000000000000002Q6VF78.pox-4"
- name: function_name
in: query
description: Filter by contract call transactions involving this function name
required: false
schema:
type: string
example: "delegate-stx"
- name: nonce
in: query
description: Filter by transactions with this nonce
required: false
schema:
type: integer
example: 123
- name: order
in: query
description: Option to sort results in ascending or descending order
required: false
schema:
type: string
enum: [asc, desc]
example: desc
default: desc
- name: unanchored
in: query
description: Include transaction data from unanchored (i.e. unconfirmed) microblocks
required: false
schema:
type: boolean
example: true
default: false
responses:
200:
description: List of transactions
content:
application/json:
schema:
$ref: ./api/transaction/get-transactions.schema.json
example:
$ref: ./api/transaction/get-transactions.example.json
/extended/v1/tx/mempool:
get:
summary: Get mempool transactions
tags:
- Transactions
operationId: get_mempool_transaction_list
description: |
Retrieves all transactions that have been recently broadcast to the mempool. These are pending transactions awaiting confirmation.
If you need to monitor new transactions, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates.
parameters:
- name: sender_address
in: query
description: Filter to only return transactions with this sender address.
required: false
schema:
type: string
example: "SP1GPBP8NBRXDRJBFQBV7KMAZX1Z7W2RFWJEH0V10"
- name: recipient_address
in: query
description: Filter to only return transactions with this recipient address (only applicable for STX transfer tx types).
required: false
schema:
type: string
- name: address
in: query
description: Filter to only return transactions with this address as the sender or recipient (recipient only applicable for STX transfer tx types).
required: false
schema:
type: string
- name: order_by
in: query
description: Option to sort results by transaction age, size, or fee rate.
required: false
schema:
type: string
enum: [age, size, fee]
example: fee
- name: order
in: query
description: Option to sort results in ascending or descending order.
required: false
schema:
type: string
enum: [asc, desc]
example: asc
- name: limit
in: query
description: max number of mempool transactions to fetch
required: false
schema:
type: integer
default: 20
maximum: 50
example: 20
- name: offset
in: query
description: index of first mempool transaction to fetch
required: false
schema:
type: integer
example: 42000
- name: unanchored
in: query
description: Include transaction data from unanchored (i.e. unconfirmed) microblocks
required: false
schema:
type: boolean
example: true
default: false
responses:
200:
description: List of mempool transactions
content:
application/json:
schema:
$ref: ./api/transaction/get-mempool-transactions.schema.json
example:
$ref: ./api/transaction/get-mempool-transactions.example.json
/extended/v2/mempool/fees:
get:
summary: Get mempool transaction fee priorities
tags:
- Mempool
operationId: get_mempool_fee_priorities
description: |
Returns estimated fee priorities (in micro-STX) for all transactions that are currently in the mempool. Also returns priorities separated by transaction type.
responses:
200:
description: Mempool fee priorities
content:
application/json:
schema:
$ref: ./api/mempool/get-fee-priorities.schema.json
example:
$ref: ./api/mempool/get-fee-priorities.example.json
/extended/v1/tx/mempool/dropped:
get:
summary: Get dropped mempool transactions
tags:
- Transactions
operationId: get_dropped_mempool_transaction_list
description: |
Retrieves all recently-broadcast transactions that have been dropped from the mempool.
Transactions are dropped from the mempool if:
* they were stale and awaiting garbage collection or,
* were expensive, or
* were replaced with a new fee
parameters:
- name: limit
in: query
description: max number of mempool transactions to fetch
required: false
schema:
type: integer
default: 96
maximum: 200
- name: offset
in: query
description: index of first mempool transaction to fetch
required: false
schema:
type: integer
example: 42000
responses:
200:
description: List of dropped mempool transactions
content:
application/json:
schema:
$ref: ./api/transaction/get-mempool-transactions.schema.json
example:
$ref: ./api/transaction/get-mempool-transactions.example.json
/extended/v1/tx/mempool/stats:
get:
summary: Get statistics for mempool transactions
tags:
- Transactions
operationId: get_mempool_transaction_stats
description: |
Queries for transactions counts, age (by block height), fees (simple average), and size.
All results broken down by transaction type and percentiles (p25, p50, p75, p95).
responses:
200:
description: Statistics for mempool transactions
content:
application/json:
schema:
$ref: ./api/transaction/get-mempool-stats.schema.json
example:
$ref: ./api/transaction/get-mempool-stats.example.json
/extended/v1/tx/multiple:
parameters:
- name: tx_id
in: query
description: Array of transaction ids
required: true
style: form
explode: true
schema:
type: array
example: [
"0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0",
"0xfbe6412b46e9db87df991a0d043ff47eb58019f770208cf48e2380337cc31785",
"0x178b77678a758d9f29a147d6399315c83d0f1baf114431fbe4d3587aa5fbba6f"
]
items:
type: string
- name: event_offset
in: query
schema:
type: integer
default: 0
description: The number of events to skip
- name: event_limit
in: query
schema:
type: integer
default: 96
description: The numbers of events to return
- name: unanchored
in: query
description: Include transaction data from unanchored (i.e. unconfirmed) microblocks
required: false
schema:
type: boolean
example: true
default: false
get:
summary: Get list of details for transactions
tags:
- Transactions
operationId: get_tx_list_details
description: |
Retrieves a list of transactions for a given list of transaction IDs
If using TypeScript, import typings for this response from our types package:
`import type { Transaction } from '@stacks/stacks-blockchain-api-types';`
responses:
200:
description: Returns list of transactions with their details for corresponding requested tx_ids.
content:
application/json:
schema:
$ref: ./entities/transactions/transaction-list.schema.json
example:
$ref: ./entities/transactions/transactions-list-detail.example.json
404:
description: Could not find any transaction by ID
/extended/v1/tx/{tx_id}:
parameters:
- name: tx_id
in: path
description: Hash of transaction
required: true
schema:
type: string
example: "0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0"
- name: event_offset
in: query
schema:
type: integer
default: 0
description: The number of events to skip
- name: event_limit
in: query
schema:
type: integer
default: 96
description: The numbers of events to return
- name: unanchored
in: query
description: Include transaction data from unanchored (i.e. unconfirmed) microblocks
required: false
schema:
type: boolean
example: true
default: false
get:
summary: Get transaction
tags:
- Transactions
operationId: get_transaction_by_id
description: |
Retrieves transaction details for a given transaction ID
`import type { Transaction } from '@stacks/stacks-blockchain-api-types';`
responses:
200:
description: Transaction
content:
application/json:
schema:
$ref: ./entities/transactions/transaction.schema.json
example:
$ref: ./entities/transactions/transaction-4-coinbase.example.json
404:
description: Cannot find transaction for given ID
/extended/v1/tx/{tx_id}/raw:
parameters:
- name: tx_id
in: path
description: Hash of transaction
required: true
schema:
type: string
example: "0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0"
get:
summary: Get Raw Transaction
tags:
- Transactions
operationId: get_raw_transaction_by_id
description: |
Retrieves a hex encoded serialized transaction for a given ID
responses:
200:
description: Hex encoded serialized transaction
content:
application/json:
schema:
$ref: ./api/transaction/get-raw-transaction.schema.json
example:
$ref: ./api/transaction/get-raw-transaction.example.json
404:
description: Cannot find transaction for given ID
/v2/transactions:
post:
summary: Broadcast raw transaction
tags:
- Transactions
description: Broadcasts raw transactions on the network. You can use the [@stacks/transactions](https://github.com/blockstack/stacks.js) project to generate a raw transaction payload.
operationId: post_core_node_transactions
requestBody:
content:
application/octet-stream:
schema:
type: string
format: binary
example: binary format of 00000000010400bed38c2aadffa348931bcb542880ff79d607afec000000000000000000000000000000c800012b0b1fff6cccd0974966dcd665835838f0985be508e1322e09fb3d751eca132c492bda720f9ef1768d14fdabed6127560ba52d5e3ac470dcb60b784e97dc88c9030200000000000516df0ba3e79792be7be5e50a370289accfc8c9e032000000000000303974657374206d656d6f00000000000000000000000000000000000000000000000000
responses:
200:
description: Transaction id of successful post of a raw tx to the node's mempool
content:
text/plain:
schema:
type: string
example: "e161978626f216b2141b156ade10501207ae535fa365a13ef5d7a7c9310a09f2"
400:
description: Rejections result in a 400 error
content:
application/json:
schema:
$ref: ./api/transaction/post-core-node-transactions-error.schema.json
example:
$ref: ./api/transaction/post-core-node-transactions-error.example.json
/extended/v1/microblock:
get:
summary: Get recent microblocks
tags:
- Microblocks
operationId: get_microblock_list
description: |
Retrieves a list of microblocks.
If you need to actively monitor new microblocks, we highly recommend subscribing to [WebSockets or Socket.io](https://github.com/hirosystems/stacks-blockchain-api/tree/master/client) for real-time updates.
parameters:
- name: limit
in: query
description: Max number of microblocks to fetch
required: false
schema:
type: integer
default: 20
maximum: 200
example: 100
- name: offset
in: query
description: Index of the first microblock to fetch
required: false
schema:
type: integer
example: 42000
responses:
200:
description: List of microblocks
content:
application/json:
schema:
$ref: ./api/microblocks/get-microblocks.schema.json
/extended/v1/microblock/{hash}:
parameters:
- name: hash
in: path
description: Hash of the microblock
required: true
schema:
type: string
example: "0x3bfcdf84b3012adb544cf0f6df4835f93418c2269a3881885e27b3d58eb82d47"
get:
summary: Get microblock
description: Retrieves a specific microblock by `hash`
tags:
- Microblocks
operationId: get_microblock_by_hash
responses:
200:
description: Microblock
content:
application/json:
schema:
$ref: ./entities/microblocks/microblock.schema.json
404:
description: Cannot find microblock with given hash
content:
application/json:
example:
$ref: ./api/errors/microblock-not-found.example.json
/extended/v1/microblock/unanchored/txs:
get:
summary: Get the list of current transactions that belong to unanchored microblocks
description: Retrieves transactions that have been streamed in microblocks but not yet accepted or rejected in an anchor block
tags:
- Microblocks
operationId: get_unanchored_txs
responses:
200:
description: Transactions
content:
application/json:
schema:
$ref: ./api/microblocks/get-unanchored-txs.schema.json
/extended/v2/burn-blocks:
get:
summary: Get burn blocks
description: |
Retrieves a list of recent burn blocks
tags:
- Burn Blocks
operationId: get_burn_blocks
parameters:
- name: limit
in: query
description: max number of burn blocks to fetch
required: false
schema:
type: integer
default: 20
maximum: 30
- name: offset
in: query
description: index of first burn block to fetch
required: false
schema:
type: integer
example: 42000
responses:
200:
description: List of burn blocks
content:
application/json:
schema:
$ref: ./api/blocks/get-burn-blocks.schema.json
example:
$ref: ./api/blocks/get-burn-blocks.example.json
/extended/v2/burn-blocks/{height_or_hash}:
get:
summary: Get burn block
description: Retrieves a single burn block
tags:
- Burn Blocks
operationId: get_burn_block
parameters:
- name: height_or_hash
in: path
description: filter by burn block height, hash, or the constant `latest` to filter for the most recent burn block
required: true
schema:
oneOf:
- type: integer
example: 42000
- type: string
example: "0x4839a8b01cfb39ffcc0d07d3db31e848d5adf5279d529ed5062300b9f353ff79"
responses:
200:
description: Burn block
content:
application/json:
schema:
$ref: ./entities/blocks/burn-block.schema.json
example:
$ref: ./entities/blocks/burn-block.example.json
/extended/v2/burn-blocks/{height_or_hash}/blocks:
get:
summary: Get blocks by burn block
description: |
Retrieves a list of blocks confirmed by a specific burn block
tags:
- Blocks
operationId: get_blocks_by_burn_block
parameters:
- name: height_or_hash
in: path
description: filter by burn block height, hash, or the constant `latest` to filter for the most recent burn block
required: true
schema:
oneOf:
- type: integer
example: 42000
- type: string
example: "0x4839a8b01cfb39ffcc0d07d3db31e848d5adf5279d529ed5062300b9f353ff79"
- name: limit
in: query
description: max number of blocks to fetch
required: false
schema:
type: integer
example: 20
- name: offset
in: query
description: index of first burn block to fetch
required: false
schema:
type: integer
example: 0
responses:
200:
description: List of blocks
content:
application/json:
schema:
$ref: ./api/blocks/get-nakamoto-blocks.schema.json
example:
$ref: ./api/blocks/get-nakamoto-blocks.example.json
/extended/v2/blocks:
get:
summary: Get blocks
description: |
Retrieves a list of recently mined blocks
tags:
- Blocks
operationId: get_blocks
parameters:
- name: limit
in: query
description: max number of blocks to fetch
required: false
schema:
type: integer
example: 20
- name: offset
in: query
description: index of first burn block to fetch
required: false
schema:
type: integer
example: 0
responses:
200:
description: List of blocks
content:
application/json:
schema:
$ref: ./api/blocks/get-nakamoto-blocks.schema.json
example:
$ref: ./api/blocks/get-nakamoto-blocks.example.json
/extended/v2/blocks/average-times:
get:
summary: Get average block times
description: |
Retrieves average block times (in seconds)
tags:
- Blocks
operationId: get_average_block_times
responses:
200:
description: Average block times (in seconds)
content:
application/json:
schema:
$ref: ./api/blocks/get-average-times.schema.json
example:
$ref: ./api/blocks/get-average-times.example.json
/extended/v2/blocks/{height_or_hash}:
get:
summary: Get block
description: |
Retrieves a single block
tags:
- Blocks
operationId: get_block
parameters:
- name: height_or_hash
in: path
description: filter by block height, hash, index block hash or the constant `latest` to filter for the most recent block
required: true
schema:
oneOf:
- type: integer
example: 42000
- type: string
example: "0x4839a8b01cfb39ffcc0d07d3db31e848d5adf5279d529ed5062300b9f353ff79"
responses:
200:
description: Block
content:
application/json:
schema:
$ref: ./entities/blocks/nakamoto-block.schema.json
example:
$ref: ./entities/blocks/nakamoto-block.example.json
/extended/v2/blocks/{height_or_hash}/transactions:
get:
summary: Get transactions by block
description: |
Retrieves transactions confirmed in a single block
tags:
- Transactions
operationId: get_transactions_by_block
parameters:
- name: height_or_hash
in: path
description: filter by block height, hash, index block hash or the constant `latest` to filter for the most recent block
required: true
schema:
oneOf:
- type: integer
example: 42000
- type: string
example: "0x4839a8b01cfb39ffcc0d07d3db31e848d5adf5279d529ed5062300b9f353ff79"
responses:
200:
description: List of transactions
content:
application/json:
schema:
$ref: ./api/transaction/get-transactions.schema.json
example:
$ref: ./api/transaction/get-transactions.example.json
/extended/v2/addresses/{address}/transactions:
get:
summary: Get address transactions
description: |
Retrieves a paginated list of confirmed transactions sent or received by a STX address or Smart Contract ID, alongside the total amount of STX sent or received and the number of STX, FT and NFT transfers contained within each transaction.
More information on Transaction types can be found [here](https://docs.stacks.co/understand-stacks/transactions#types).
tags:
- Transactions
operationId: get_address_transactions
parameters:
- name: address
in: path
description: STX address or Smart Contract ID
required: true
schema:
type: string
example: "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"
- name: limit
in: query
description: Number of transactions to fetch
required: false
schema:
type: integer
example: 20
- name: offset
in: query
description: Index of first transaction to fetch
required: false
schema:
type: integer
example: 10
responses:
200:
description: Success
content:
application/json:
schema:
$ref: ./api/address/get-v2-address-transactions.schema.json
example:
$ref: ./api/address/get-v2-address-transactions.example.json
/extended/v2/addresses/{address}/transactions/{tx_id}/events:
get:
summary: Get events for an address transaction
description: |
Retrieves a paginated list of all STX, FT and NFT events concerning a STX address or Smart Contract ID within a specific transaction.
tags:
- Transactions
operationId: get_address_transaction_events
parameters:
- name: address
in: path
description: STX address or Smart Contract ID
required: true
schema:
type: string
example: "SP31DA6FTSJX2WGTZ69SFY11BH51NZMB0ZW97B5P0"
- name: tx_id
in: path
description: Transaction ID
required: true
schema:
type: string
example: "0x0a411719e3bfde95f9e227a2d7f8fac3d6c646b1e6cc186db0e2838a2c6cd9c0"
- name: limit
in: query
description: Number of events to fetch
required: false
schema:
type: integer
example: 20
- name: offset
in: query
description: Index of first event to fetch
required: false
schema: