Skip to content

Commit 869664a

Browse files
authored
Peter/nft (#462)
* Adding NFT Beta * Shifting to nikilster and doing some fixes
1 parent bc1b2e7 commit 869664a

File tree

1 file changed

+147
-24
lines changed

1 file changed

+147
-24
lines changed

data/v1.yaml

+147-24
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ x-sandbox:
1313
value: token
1414
paths:
1515
####################################################
16-
# Token APIs
16+
# Multi-Chain Token APIs
1717
####################################################
1818
"/{apiKey}/assets/tokens/by-address":
1919
post:
@@ -55,7 +55,7 @@ paths:
5555
schema:
5656
$ref: "#/components/schemas/ErrorResponse"
5757
operationId: get-tokens-by-address
58-
"/{apiKey}/tokens/balances/by-address":
58+
"/{apiKey}/assets/tokens/balances/by-address":
5959
post:
6060
summary: Token Balances By Wallet
6161
description: >
@@ -96,6 +96,49 @@ paths:
9696
$ref: "#/components/schemas/ErrorResponse"
9797
operationId: get-token-balances-by-address
9898
####################################################
99+
# Multi-Chain NFT APIs
100+
####################################################
101+
"/{apiKey}/assets/nfts/by-address":
102+
post:
103+
summary: NFTs By Owner
104+
description: >
105+
Retrieves all NFTs currently owned by multiple addresses using network and address pairs. This endpoint is supported on Ethereum and many L2s, including Polygon, Arbitrum, Optimism, Base, World Chain and more. See the full list of supported networks [here](https://dashboard.alchemy.com/chains?service=token-api&utm_source=readme&utm_medium=link&utm_campaign=docs_method_chains_link_v1_tokens).
106+
tags: ["🆕 Multi-Chain NFT APIs (Beta)"]
107+
x-readme:
108+
samples-languages:
109+
- javascript
110+
- curl
111+
- python
112+
- go
113+
parameters:
114+
- $ref: '#/components/schemas/apiKey'
115+
requestBody:
116+
required: true
117+
content:
118+
application/json:
119+
schema:
120+
$ref: "#/components/schemas/ByAddressRequestWithNFTOptions"
121+
responses:
122+
"200":
123+
description: Successful response!
124+
content:
125+
application/json:
126+
schema:
127+
$ref: "#/components/schemas/NFTByOwnerResponse"
128+
"400":
129+
description: 'Bad Request: Invalid input (e.g., malformed JSON).'
130+
content:
131+
application/json:
132+
schema:
133+
$ref: "#/components/schemas/ErrorResponse"
134+
"429":
135+
description: 'Too Many Requests: Rate limit exceeded.'
136+
content:
137+
application/json:
138+
schema:
139+
$ref: "#/components/schemas/ErrorResponse"
140+
operationId: get-nfts-by-address
141+
####################################################
99142
# Transaction History API
100143
####################################################
101144
"/{apiKey}/transactions/history/by-address":
@@ -415,20 +458,18 @@ components:
415458
</style>
416459
For higher throughput, <span class="custom-style"><a href="https://alchemy.com/?a=docs-demo" target="_blank">create your own API key</a></span>
417460
required: true
418-
withMetadata:
419-
name: withMetadata
420-
description: 'Boolean - if set to `true`, returns metadata. Setting this to false will reduce payload size and may result in a faster API call. Defaults to `true`.'
421-
schema:
422-
type: boolean
423-
default: true
424-
in: query
425-
withPrices:
426-
name: withPrices
427-
description: 'Boolean - if set to `true`, returns token prices. Setting this to false will reduce payload size and may result in a faster API call. Defaults to `true`.'
428-
schema:
429-
type: boolean
430-
default: true
431-
in: query
461+
# TODO(peter): Annoyingly this doesn't work and defaults to string. Debug this eventually.
462+
#
463+
#withMetadataField:
464+
# description: 'Boolean - if set to `true`, returns metadata. Setting this to false will reduce payload size and may result in a faster API call. Defaults to `true`.'
465+
# type: boolean
466+
# default: true
467+
#withPrices:
468+
# name: withPrices
469+
# description: 'Boolean - if set to `true`, returns token prices. Setting this to false will reduce payload size and may result in a faster API call. Defaults to `true`.'
470+
# schema:
471+
# type: boolean
472+
# default: true
432473
networks:
433474
name: networks
434475
description: |
@@ -533,9 +574,32 @@ components:
533574
items:
534575
$ref: "#/components/schemas/AddressItem"
535576
withMetadata:
536-
- $ref: "#/components/schemas/withMetadata"
577+
description: 'Boolean - if set to `true`, returns metadata. Setting this to false will reduce payload size and may result in a faster API call. Defaults to `true`.'
578+
type: boolean
579+
default: true
537580
withPrices:
538-
- $ref: "#/components/schemas/withPrices"
581+
description: 'Boolean - if set to `true`, returns token prices. Setting this to false will reduce payload size and may result in a faster API call. Defaults to `true`.'
582+
type: boolean
583+
default: true
584+
required:
585+
- addresses
586+
587+
ByAddressRequestWithNFTOptions:
588+
type: object
589+
properties:
590+
addresses:
591+
type: array
592+
minItems: 1
593+
maxItems: 2
594+
description: >
595+
Array of address and networks pairs (limit 2 pairs, max 5 networks each). Networks should match network enums.
596+
items:
597+
$ref: "#/components/schemas/AddressItem"
598+
withMetadata:
599+
description: 'Boolean - if set to `true`, returns metadata. Setting this to false will reduce payload size and may result in a faster API call. Defaults to `true`.'
600+
type: boolean
601+
default: true
602+
# TODO: spamConfidenceLevel
539603
required:
540604
- addresses
541605

@@ -545,8 +609,8 @@ components:
545609
address:
546610
type: string
547611
description: Wallet address.
548-
example: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
549-
default: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
612+
example: "0x1E6E8695FAb3Eb382534915eA8d7Cc1D1994B152"
613+
default: "0x1E6E8695FAb3Eb382534915eA8d7Cc1D1994B152"
550614
networks:
551615
type: array
552616
minItems: 1
@@ -604,8 +668,8 @@ components:
604668
address:
605669
type: string
606670
description: Wallet address.
607-
example: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
608-
default: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
671+
example: "0x1E6E8695FAb3Eb382534915eA8d7Cc1D1994B152"
672+
default: "0x1E6E8695FAb3Eb382534915eA8d7Cc1D1994B152"
609673
networks:
610674
type: array
611675
minItems: 1
@@ -634,8 +698,8 @@ components:
634698
address:
635699
type: string
636700
description: Wallet address.
637-
example: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
638-
default: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
701+
example: "0x1E6E8695FAb3Eb382534915eA8d7Cc1D1994B152"
702+
default: "0x1E6E8695FAb3Eb382534915eA8d7Cc1D1994B152"
639703
networks:
640704
type: array
641705
minItems: 1
@@ -742,6 +806,65 @@ components:
742806
- tokenAddress
743807
- tokenBalance
744808

809+
####################################################
810+
# NFT APIs
811+
####################################################
812+
NFTByOwnerResponse:
813+
type: object
814+
properties:
815+
data:
816+
type: object
817+
description: List of nfts by address with appropriate metadata.
818+
# No validAt for the multi-chain version, for now.
819+
ownedNfts:
820+
type: array
821+
items:
822+
$ref: "#/components/schemas/NFTResponseItem"
823+
totalCount:
824+
$ref: '../nft/nfts.yaml#/components/schemas/totalNFTCount'
825+
pageKey:
826+
$ref: '../nft/nfts.yaml#/components/schemas/pageKey'
827+
required:
828+
- data
829+
830+
# Similar to ownedNFTv3, just with extra address and network identifiers.
831+
NFTResponseItem:
832+
type: object
833+
description: 'The object that represents an NFT and has all data corresponding to that NFT'
834+
properties:
835+
network:
836+
type: string
837+
description: Network identifier.
838+
address:
839+
type: string
840+
description: Wallet address.
841+
contract:
842+
$ref: '../nft/nfts.yaml#/components/schemas/contractv3'
843+
tokenId:
844+
$ref: '../nft/nfts.yaml#/components/schemas/tokenIdV3'
845+
tokenType:
846+
$ref: '../nft/nfts.yaml#/components/schemas/tokenType'
847+
name:
848+
type: string
849+
description: 'String - Name of the NFT asset.'
850+
description:
851+
type: string
852+
description: 'String - Brief human-readable description'
853+
image:
854+
$ref: '../nft/nfts.yaml#/components/schemas/imagev3'
855+
raw:
856+
$ref: '../nft/nfts.yaml#/components/schemas/rawv3'
857+
collection:
858+
$ref: '../nft/nfts.yaml#/components/schemas/collectionv3'
859+
tokenUri:
860+
type: string
861+
description: "String - Uri representing the location of the NFT's original metadata blob. This is a backup for you to parse when the metadata field is not automatically populated."
862+
timeLastUpdated:
863+
type: string
864+
description: 'String - ISO timestamp of the last cache refresh for the information returned in the metadata field.'
865+
acquiredAt:
866+
$ref: '../nft/nfts.yaml#/components/schemas/acquiredAt'
867+
745868
####################################################
746869
# Transaction History APIs
747870
####################################################

0 commit comments

Comments
 (0)