Skip to content

nft

Methods exposed through client.nft(network).

compute_rarity

Computes the rarity of each trait attribute for a specific NFT token within its collection.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
token_id str

Token ID in hex or decimal format.

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
ComputeRarityResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/compute_rarity.py
async def compute_rarity(
  self,
  *,
  contract_address: str,
  token_id: str,
  validate: bool | None = None
) -> ComputeRarityResponse:
  """Computes the rarity of each trait attribute for a specific NFT token within its collection.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    token_id: Token ID in hex or decimal format.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/compute-rarity-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
    'tokenId': token_id,
  }
  r = await self.request('GET', '/computeRarity', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_collection_metadata

Retrieves high-level collection metadata for an NFT collection by OpenSea slug.

Parameters:

Name Type Description Default
collection_slug str

OpenSea collection slug.

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
CollectionMetadataResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_collection_metadata.py
async def get_collection_metadata(
  self,
  *,
  collection_slug: str,
  validate: bool | None = None
) -> CollectionMetadataResponse:
  """Retrieves high-level collection metadata for an NFT collection by OpenSea slug.

  Args:
    collection_slug: OpenSea collection slug.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-collection-metadata-v-3)
    """
  params: dict = {
    'collectionSlug': collection_slug,
  }
  r = await self.request('GET', '/getCollectionMetadata', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_collections_for_owner

Returns all NFT collections held by a given wallet address, with collection-level metadata and floor prices.

Parameters:

Name Type Description Default
owner str

Wallet address. Supports ENS format on Eth Mainnet.

required
page_key str | None

Pagination cursor from previous response.

None
page_size int | None

Collections per page. Maximum 100. Defaults to 100.

None
with_metadata bool | None

Include NFT metadata. Defaults to true.

None
include_filters list[Literal['SPAM', 'AIRDROPS']] | None

Include only tokens matching SPAM or AIRDROPS.

None
exclude_filters list[Literal['SPAM', 'AIRDROPS']] | None

Exclude tokens matching SPAM or AIRDROPS.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
OwnerCollectionsResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_collections_for_owner.py
async def get_collections_for_owner(
  self,
  *,
  owner: str,
  page_key: str | None = None,
  page_size: int | None = None,
  with_metadata: bool | None = None,
  include_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  exclude_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  validate: bool | None = None
) -> OwnerCollectionsResponse:
  """Returns all NFT collections held by a given wallet address, with collection-level metadata and floor prices.

  Args:
    owner: Wallet address. Supports ENS format on Eth Mainnet.
    page_key: Pagination cursor from previous response.
    page_size: Collections per page. Maximum 100. Defaults to 100.
    with_metadata: Include NFT metadata. Defaults to true.
    include_filters: Include only tokens matching SPAM or AIRDROPS.
    exclude_filters: Exclude tokens matching SPAM or AIRDROPS.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/get-collections-for-owner-v-3)
    """
  params: dict = {
    'owner': owner,
  }
  if page_key is not None:
    params['pageKey'] = page_key
  if page_size is not None:
    params['pageSize'] = page_size
  if with_metadata is not None:
    params['withMetadata'] = with_metadata
  if include_filters is not None:
    params['includeFilters[]'] = include_filters
  if exclude_filters is not None:
    params['excludeFilters[]'] = exclude_filters
  r = await self.request('GET', '/getCollectionsForOwner', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_collections_for_owner_paged

Paged version of get_collections_for_owner.

Parameters:

Name Type Description Default
owner str

Wallet address. Supports ENS format on Eth Mainnet.

required
page_size int | None

Collections per page. Maximum 100. Defaults to 100.

None
with_metadata bool | None

Include NFT metadata. Defaults to true.

None
include_filters list[Literal['SPAM', 'AIRDROPS']] | None

Include only tokens matching SPAM or AIRDROPS.

None
exclude_filters list[Literal['SPAM', 'AIRDROPS']] | None

Exclude tokens matching SPAM or AIRDROPS.

None
validate bool | None

Validation override for each request.

None

Returns:

Type Description
PaginatedResponse[OwnerCollection, str]

An async iterable and awaitable paginated response over owner collections.

References
Source code in pkg/src/alchemy/api/nft/get_collections_for_owner.py
def get_collections_for_owner_paged(
  self,
  *,
  owner: str,
  page_size: int | None = None,
  with_metadata: bool | None = None,
  include_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  exclude_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  validate: bool | None = None,
) -> PaginatedResponse[OwnerCollection, str]:
  """Paged version of get_collections_for_owner.

  Args:
    owner: Wallet address. Supports ENS format on Eth Mainnet.
    page_size: Collections per page. Maximum 100. Defaults to 100.
    with_metadata: Include NFT metadata. Defaults to true.
    include_filters: Include only tokens matching SPAM or AIRDROPS.
    exclude_filters: Exclude tokens matching SPAM or AIRDROPS.
    validate: Validation override for each request.

  Returns:
    An async iterable and awaitable paginated response over owner collections.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/get-collections-for-owner-v-3)
    """
  async def next(state: str):
    response = await self.get_collections_for_owner(
      owner=owner, page_key=state or None, page_size=page_size,
      with_metadata=with_metadata, include_filters=include_filters,
      exclude_filters=exclude_filters, validate=validate,
    )
    return response.get('collections', []), response.get('pageKey')

  return PaginatedResponse('', next)

get_contract_metadata

Retrieves collection-level metadata for a given NFT contract address.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
ContractMetadataResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_contract_metadata.py
async def get_contract_metadata(
  self,
  *,
  contract_address: str,
  validate: bool | None = None
) -> ContractMetadataResponse:
  """Retrieves collection-level metadata for a given NFT contract address.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-contract-metadata-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
  }
  r = await self.request('GET', '/getContractMetadata', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_contract_metadata_batch

Fetches collection-level metadata for multiple NFT contracts in a single request.

Parameters:

Name Type Description Default
body ContractMetadataBatchRequest

List of contract addresses to fetch metadata for.

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
ContractMetadataBatchResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_contract_metadata_batch.py
async def get_contract_metadata_batch(
  self,
  body: ContractMetadataBatchRequest,
  *,
  validate: bool | None = None
) -> ContractMetadataBatchResponse:
  """Fetches collection-level metadata for multiple NFT contracts in a single request.

  Args:
    body: List of contract addresses to fetch metadata for.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-contract-metadata-batch-v-3)
    """
  r = await self.request('POST', '/getContractMetadataBatch', json=body)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_contracts_for_owner

Lists all NFT contracts (collections) for which a given wallet holds at least one token.

Parameters:

Name Type Description Default
owner str

Wallet address. Supports ENS format on Eth Mainnet.

required
page_key str | None

Pagination cursor from previous response.

None
page_size int | None

Contracts per page. Maximum 100. Defaults to 100.

None
with_metadata bool | None

Include contract metadata. Defaults to true.

None
include_filters list[Literal['SPAM', 'AIRDROPS']] | None

Include only tokens matching SPAM or AIRDROPS filters.

None
exclude_filters list[Literal['SPAM', 'AIRDROPS']] | None

Exclude tokens matching SPAM or AIRDROPS filters.

None
order_by Literal['transferTime'] | None

Sort order. 'transferTime' sorts by most recent transfer first.

None
spam_confidence_level Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None

Spam threshold (paid tier). One of: VERY_HIGH, HIGH, MEDIUM, LOW.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
OwnerContractsResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_contracts_for_owner.py
async def get_contracts_for_owner(
  self,
  *,
  owner: str,
  page_key: str | None = None,
  page_size: int | None = None,
  with_metadata: bool | None = None,
  include_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  exclude_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  order_by: Literal['transferTime'] | None = None,
  spam_confidence_level: Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None = None,
  validate: bool | None = None
) -> OwnerContractsResponse:
  """Lists all NFT contracts (collections) for which a given wallet holds at least one token.

  Args:
    owner: Wallet address. Supports ENS format on Eth Mainnet.
    page_key: Pagination cursor from previous response.
    page_size: Contracts per page. Maximum 100. Defaults to 100.
    with_metadata: Include contract metadata. Defaults to true.
    include_filters: Include only tokens matching SPAM or AIRDROPS filters.
    exclude_filters: Exclude tokens matching SPAM or AIRDROPS filters.
    order_by: Sort order. 'transferTime' sorts by most recent transfer first.
    spam_confidence_level: Spam threshold (paid tier). One of: VERY_HIGH, HIGH, MEDIUM, LOW.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/get-contracts-for-owner-v-3)
    """
  params: dict = {
    'owner': owner,
  }
  if page_key is not None:
    params['pageKey'] = page_key
  if page_size is not None:
    params['pageSize'] = page_size
  if with_metadata is not None:
    params['withMetadata'] = with_metadata
  if include_filters is not None:
    params['includeFilters[]'] = include_filters
  if exclude_filters is not None:
    params['excludeFilters[]'] = exclude_filters
  if order_by is not None:
    params['orderBy'] = order_by
  if spam_confidence_level is not None:
    params['spamConfidenceLevel'] = spam_confidence_level
  r = await self.request('GET', '/getContractsForOwner', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_contracts_for_owner_paged

Paged version of get_contracts_for_owner.

Parameters:

Name Type Description Default
owner str

Wallet address. Supports ENS format on Eth Mainnet.

required
page_size int | None

Contracts per page. Maximum 100. Defaults to 100.

None
with_metadata bool | None

Include contract metadata. Defaults to true.

None
include_filters list[Literal['SPAM', 'AIRDROPS']] | None

Include only tokens matching SPAM or AIRDROPS filters.

None
exclude_filters list[Literal['SPAM', 'AIRDROPS']] | None

Exclude tokens matching SPAM or AIRDROPS filters.

None
order_by Literal['transferTime'] | None

Sort order. 'transferTime' sorts by most recent transfer first.

None
spam_confidence_level Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None

Spam threshold (paid tier). One of: VERY_HIGH, HIGH, MEDIUM, LOW.

None
validate bool | None

Validation override for each request.

None

Returns:

Type Description
PaginatedResponse[OwnerContract, str]

An async iterable and awaitable paginated response over owner contracts.

References
Source code in pkg/src/alchemy/api/nft/get_contracts_for_owner.py
def get_contracts_for_owner_paged(
  self,
  *,
  owner: str,
  page_size: int | None = None,
  with_metadata: bool | None = None,
  include_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  exclude_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  order_by: Literal['transferTime'] | None = None,
  spam_confidence_level: Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None = None,
  validate: bool | None = None,
) -> PaginatedResponse[OwnerContract, str]:
  """Paged version of get_contracts_for_owner.

  Args:
    owner: Wallet address. Supports ENS format on Eth Mainnet.
    page_size: Contracts per page. Maximum 100. Defaults to 100.
    with_metadata: Include contract metadata. Defaults to true.
    include_filters: Include only tokens matching SPAM or AIRDROPS filters.
    exclude_filters: Exclude tokens matching SPAM or AIRDROPS filters.
    order_by: Sort order. 'transferTime' sorts by most recent transfer first.
    spam_confidence_level: Spam threshold (paid tier). One of: VERY_HIGH, HIGH, MEDIUM, LOW.
    validate: Validation override for each request.

  Returns:
    An async iterable and awaitable paginated response over owner contracts.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/get-contracts-for-owner-v-3)
    """
  async def next(state: str):
    response = await self.get_contracts_for_owner(
      owner=owner, page_key=state or None, page_size=page_size,
      with_metadata=with_metadata, include_filters=include_filters,
      exclude_filters=exclude_filters, order_by=order_by,
      spam_confidence_level=spam_confidence_level, validate=validate,
    )
    return response.get('contracts', []), response.get('pageKey')

  return PaginatedResponse('', next)

get_floor_price

Retrieves the floor price of an NFT collection on OpenSeaFloorPrice and LooksRareFloorPrice marketplaces. Ethereum Mainnet only.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
collection_slug str | None

OpenSeaFloorPrice collection slug for the collection.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
FloorPriceResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_floor_price.py
async def get_floor_price(
  self,
  *,
  contract_address: str,
  collection_slug: str | None = None,
  validate: bool | None = None
) -> FloorPriceResponse:
  """Retrieves the floor price of an NFT collection on OpenSeaFloorPrice and LooksRareFloorPrice marketplaces. Ethereum Mainnet only.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    collection_slug: OpenSeaFloorPrice collection slug for the collection.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-sales-endpoints/get-floor-price-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
  }
  if collection_slug is not None:
    params['collectionSlug'] = collection_slug
  r = await self.request('GET', '/getFloorPrice', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_nft_metadata

Fetches metadata for a specific NFT identified by contract address and token ID.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
token_id str

Token ID as a decimal integer string or hex string.

required
token_type NftTokenType | None

Token standard hint to improve response time. One of 'ERC721' or 'ERC1155'.

None
token_uri_timeout_in_ms int | None

Timeout in milliseconds for fetching the token URI. Set to 0 for cache-only access.

None
refresh_cache bool | None

If true, forces a cache refresh and re-fetches metadata from the original source. Defaults to false.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
NftMetadataResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_nft_metadata.py
async def get_nft_metadata(
  self,
  *,
  contract_address: str,
  token_id: str,
  token_type: NftTokenType | None = None,
  token_uri_timeout_in_ms: int | None = None,
  refresh_cache: bool | None = None,
  validate: bool | None = None
) -> NftMetadataResponse:
  """Fetches metadata for a specific NFT identified by contract address and token ID.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    token_id: Token ID as a decimal integer string or hex string.
    token_type: Token standard hint to improve response time. One of 'ERC721' or 'ERC1155'.
    token_uri_timeout_in_ms: Timeout in milliseconds for fetching the token URI. Set to 0 for cache-only access.
    refresh_cache: If true, forces a cache refresh and re-fetches metadata from the original source. Defaults to false.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/data/nft-api/api-reference/nft-metadata-endpoints/get-nft-metadata-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
    'tokenId': token_id,
  }
  if token_type is not None:
    params['tokenType'] = token_type
  if token_uri_timeout_in_ms is not None:
    params['tokenUriTimeoutInMs'] = token_uri_timeout_in_ms
  if refresh_cache is not None:
    params['refreshCache'] = refresh_cache
  r = await self.request('GET', '/getNFTMetadata', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_nft_metadata_batch

Fetches metadata for up to 100 NFTs in a single request. Returns an array of NFT objects.

Parameters:

Name Type Description Default
body NftMetadataBatchRequest

Batch request payload specifying the tokens to fetch metadata for.

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
NftMetadataBatchResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_nft_metadata_batch.py
async def get_nft_metadata_batch(
  self,
  body: NftMetadataBatchRequest,
  *,
  validate: bool | None = None
) -> NftMetadataBatchResponse:
  """Fetches metadata for up to 100 NFTs in a single request. Returns an array of NFT objects.

  Args:
    body: Batch request payload specifying the tokens to fetch metadata for.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-nft-metadata-batch-v-3)
    """
  r = await self.request('POST', '/getNFTMetadataBatch', json=body)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_nft_sales

Retrieves NFT sales data from on-chain marketplaces with rich filtering options.

Parameters:

Name Type Description Default
from_block str | None

Start block number (decimal, hex, or 'latest'). Defaults to '0'.

None
to_block str | None

End block number (decimal, hex, or 'latest'). Defaults to 'latest'.

None
order Literal['asc', 'desc'] | None

Sort direction from fromBlock: 'asc' or 'desc'. Defaults to 'desc'.

None
marketplace Literal['seaport', 'wyvern', 'looksrare', 'x2y2', 'blur', 'cryptopunks'] | None

Filter by marketplace. One of: seaport, wyvern, looksrare, x2y2, blur, cryptopunks.

None
contract_address str | None

Filter by NFT contract address.

None
token_id str | None

Filter by token ID within the contractAddress collection.

None
buyer_address str | None

Filter by buyer wallet address.

None
seller_address str | None

Filter by seller wallet address.

None
taker Literal['BUYER', 'SELLER'] | None

Filter by price taker role: BUYER or SELLER.

None
limit int | None

Max results to return. Maximum 1000. Defaults to 1000.

None
page_key str | None

Pagination cursor from a previous response.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
NftSalesResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_nft_sales.py
async def get_nft_sales(
  self,
  *,
  from_block: str | None = None,
  to_block: str | None = None,
  order: Literal['asc', 'desc'] | None = None,
  marketplace: Literal['seaport', 'wyvern', 'looksrare', 'x2y2', 'blur', 'cryptopunks'] | None = None,
  contract_address: str | None = None,
  token_id: str | None = None,
  buyer_address: str | None = None,
  seller_address: str | None = None,
  taker: Literal['BUYER', 'SELLER'] | None = None,
  limit: int | None = None,
  page_key: str | None = None,
  validate: bool | None = None
) -> NftSalesResponse:
  """Retrieves NFT sales data from on-chain marketplaces with rich filtering options.

  Args:
    from_block: Start block number (decimal, hex, or 'latest'). Defaults to '0'.
    to_block: End block number (decimal, hex, or 'latest'). Defaults to 'latest'.
    order: Sort direction from fromBlock: 'asc' or 'desc'. Defaults to 'desc'.
    marketplace: Filter by marketplace. One of: seaport, wyvern, looksrare, x2y2, blur, cryptopunks.
    contract_address: Filter by NFT contract address.
    token_id: Filter by token ID within the contractAddress collection.
    buyer_address: Filter by buyer wallet address.
    seller_address: Filter by seller wallet address.
    taker: Filter by price taker role: BUYER or SELLER.
    limit: Max results to return. Maximum 1000. Defaults to 1000.
    page_key: Pagination cursor from a previous response.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-sales-endpoints/get-nft-sales-v-3)
    """
  params = {}
  if from_block is not None:
    params['fromBlock'] = from_block
  if to_block is not None:
    params['toBlock'] = to_block
  if order is not None:
    params['order'] = order
  if marketplace is not None:
    params['marketplace'] = marketplace
  if contract_address is not None:
    params['contractAddress'] = contract_address
  if token_id is not None:
    params['tokenId'] = token_id
  if buyer_address is not None:
    params['buyerAddress'] = buyer_address
  if seller_address is not None:
    params['sellerAddress'] = seller_address
  if taker is not None:
    params['taker'] = taker
  if limit is not None:
    params['limit'] = limit
  if page_key is not None:
    params['pageKey'] = page_key
  r = await self.request('GET', '/getNFTSales', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_nft_sales_paged

Paged version of get_nft_sales.

Parameters:

Name Type Description Default
from_block str | None

Start block number.

None
to_block str | None

End block number.

None
order Literal['asc', 'desc'] | None

Sort direction from fromBlock.

None
marketplace Literal['seaport', 'wyvern', 'looksrare', 'x2y2', 'blur', 'cryptopunks'] | None

Filter by marketplace.

None
contract_address str | None

Filter by NFT contract address.

None
token_id str | None

Filter by token ID.

None
buyer_address str | None

Filter by buyer wallet address.

None
seller_address str | None

Filter by seller wallet address.

None
taker Literal['BUYER', 'SELLER'] | None

Filter by price taker role.

None
limit int | None

Max results to return per page.

None
validate bool | None

Validation override for each request.

None

Returns:

Type Description
PaginatedResponse[NftSale, str]

An async iterable and awaitable paginated response over NFT sales.

References
Source code in pkg/src/alchemy/api/nft/get_nft_sales.py
def get_nft_sales_paged(
  self, *, from_block: str | None = None, to_block: str | None = None,
  order: Literal['asc', 'desc'] | None = None,
  marketplace: Literal['seaport', 'wyvern', 'looksrare', 'x2y2', 'blur', 'cryptopunks'] | None = None,
  contract_address: str | None = None,
  token_id: str | None = None,
  buyer_address: str | None = None,
  seller_address: str | None = None,
  taker: Literal['BUYER', 'SELLER'] | None = None,
  limit: int | None = None,
  validate: bool | None = None,
) -> PaginatedResponse[NftSale, str]:
  """Paged version of get_nft_sales.

  Args:
    from_block: Start block number.
    to_block: End block number.
    order: Sort direction from fromBlock.
    marketplace: Filter by marketplace.
    contract_address: Filter by NFT contract address.
    token_id: Filter by token ID.
    buyer_address: Filter by buyer wallet address.
    seller_address: Filter by seller wallet address.
    taker: Filter by price taker role.
    limit: Max results to return per page.
    validate: Validation override for each request.

  Returns:
    An async iterable and awaitable paginated response over NFT sales.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-sales-endpoints/get-nft-sales-v-3)
  """
  async def next(state: str):
    response = await self.get_nft_sales(
      from_block=from_block, to_block=to_block, order=order,
      marketplace=marketplace, contract_address=contract_address,
      token_id=token_id, buyer_address=buyer_address,
      seller_address=seller_address, taker=taker, limit=limit,
      page_key=state or None, validate=validate,
    )
    return response.get('nftSales', []), response.get('pageKey')

  return PaginatedResponse('', next)

get_nfts_for_collection

Retrieves NFTs associated with a specific NFT collection.

Parameters:

Name Type Description Default
contract_address str | None

NFT contract address (ERC721 or ERC1155).

None
collection_slug str | None

OpenSea collection slug.

None
with_metadata bool | None

Include NFT metadata. Defaults to true.

None
start_token str | None

Token ID offset for pagination (hex or decimal).

None
limit int | None

Number of NFTs to return. Defaults to 100.

None
token_uri_timeout_in_ms int | None

Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
CollectionNftsResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_nfts_for_collection.py
async def get_nfts_for_collection(
  self,
  *,
  contract_address: str | None = None,
  collection_slug: str | None = None,
  with_metadata: bool | None = None,
  start_token: str | None = None,
  limit: int | None = None,
  token_uri_timeout_in_ms: int | None = None,
  validate: bool | None = None
) -> CollectionNftsResponse:
  """Retrieves NFTs associated with a specific NFT collection.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    collection_slug: OpenSea collection slug.
    with_metadata: Include NFT metadata. Defaults to true.
    start_token: Token ID offset for pagination (hex or decimal).
    limit: Number of NFTs to return. Defaults to 100.
    token_uri_timeout_in_ms: Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-nf-ts-for-collection-v-3)
    """
  params = {}
  if contract_address is not None:
    params['contractAddress'] = contract_address
  if collection_slug is not None:
    params['collectionSlug'] = collection_slug
  if with_metadata is not None:
    params['withMetadata'] = with_metadata
  if start_token is not None:
    params['startToken'] = start_token
  if limit is not None:
    params['limit'] = limit
  if token_uri_timeout_in_ms is not None:
    params['tokenUriTimeoutInMs'] = token_uri_timeout_in_ms
  r = await self.request('GET', '/getNFTsForCollection', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_nfts_for_collection_paged

Paged version of get_nfts_for_collection.

Parameters:

Name Type Description Default
contract_address str | None

NFT contract address (ERC721 or ERC1155).

None
collection_slug str | None

OpenSea collection slug.

None
with_metadata bool | None

Include NFT metadata. Defaults to true.

None
limit int | None

Number of NFTs to return per page. Defaults to 100.

None
token_uri_timeout_in_ms int | None

Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.

None
validate bool | None

Validation override for each request.

None

Returns:

Type Description
PaginatedResponse[NftMetadataResponse, str]

An async iterable and awaitable paginated response over NFT metadata.

References
Source code in pkg/src/alchemy/api/nft/get_nfts_for_collection.py
def get_nfts_for_collection_paged(
  self, *, contract_address: str | None = None,
  collection_slug: str | None = None, with_metadata: bool | None = None,
  limit: int | None = None, token_uri_timeout_in_ms: int | None = None,
  validate: bool | None = None,
) -> PaginatedResponse[NftMetadataResponse, str]:
  """Paged version of get_nfts_for_collection.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    collection_slug: OpenSea collection slug.
    with_metadata: Include NFT metadata. Defaults to true.
    limit: Number of NFTs to return per page. Defaults to 100.
    token_uri_timeout_in_ms: Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.
    validate: Validation override for each request.

  Returns:
    An async iterable and awaitable paginated response over NFT metadata.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-nf-ts-for-collection-v-3)
  """
  async def next(state: str):
    response = await self.get_nfts_for_collection(
      contract_address=contract_address, collection_slug=collection_slug,
      with_metadata=with_metadata, start_token=state or None,
      limit=limit, token_uri_timeout_in_ms=token_uri_timeout_in_ms,
      validate=validate,
    )
    return response.get('nfts', []), response.get('pageKey') or response.get('nextToken')

  return PaginatedResponse('', next)

get_nfts_for_contract

Retrieves all NFTs belonging to a given contract address.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
with_metadata bool | None

Include NFT metadata. Defaults to true.

None
start_token str | None

Token ID offset for pagination (hex or decimal).

None
limit int | None

Number of NFTs to return. Defaults to 100.

None
token_uri_timeout_in_ms int | None

Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
ContractNftsResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_nfts_for_contract.py
async def get_nfts_for_contract(
  self,
  *,
  contract_address: str,
  with_metadata: bool | None = None,
  start_token: str | None = None,
  limit: int | None = None,
  token_uri_timeout_in_ms: int | None = None,
  validate: bool | None = None
) -> ContractNftsResponse:
  """Retrieves all NFTs belonging to a given contract address.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    with_metadata: Include NFT metadata. Defaults to true.
    start_token: Token ID offset for pagination (hex or decimal).
    limit: Number of NFTs to return. Defaults to 100.
    token_uri_timeout_in_ms: Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-nf-ts-for-contract-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
  }
  if with_metadata is not None:
    params['withMetadata'] = with_metadata
  if start_token is not None:
    params['startToken'] = start_token
  if limit is not None:
    params['limit'] = limit
  if token_uri_timeout_in_ms is not None:
    params['tokenUriTimeoutInMs'] = token_uri_timeout_in_ms
  r = await self.request('GET', '/getNFTsForContract', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_nfts_for_contract_paged

Paged version of get_nfts_for_contract.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
with_metadata bool | None

Include NFT metadata. Defaults to true.

None
limit int | None

Number of NFTs to return per page. Defaults to 100.

None
token_uri_timeout_in_ms int | None

Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.

None
validate bool | None

Validation override for each request.

None

Returns:

Type Description
PaginatedResponse[NftMetadataResponse, str]

An async iterable and awaitable paginated response over NFT metadata.

References
Source code in pkg/src/alchemy/api/nft/get_nfts_for_contract.py
def get_nfts_for_contract_paged(
  self, *, contract_address: str, with_metadata: bool | None = None,
  limit: int | None = None, token_uri_timeout_in_ms: int | None = None,
  validate: bool | None = None,
) -> PaginatedResponse[NftMetadataResponse, str]:
  """Paged version of get_nfts_for_contract.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    with_metadata: Include NFT metadata. Defaults to true.
    limit: Number of NFTs to return per page. Defaults to 100.
    token_uri_timeout_in_ms: Timeout for metadata fetching in milliseconds. Set to 0 for cache-only.
    validate: Validation override for each request.

  Returns:
    An async iterable and awaitable paginated response over NFT metadata.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/get-nf-ts-for-contract-v-3)
  """
  async def next(state: str):
    response = await self.get_nfts_for_contract(
      contract_address=contract_address, with_metadata=with_metadata,
      start_token=state or None, limit=limit,
      token_uri_timeout_in_ms=token_uri_timeout_in_ms,
      validate=validate,
    )
    return response.get('nfts', []), response.get('pageKey')

  return PaginatedResponse('', next)

get_nfts_for_owner

Fetches all NFTs owned by a given wallet address on the requested chain. Supports filtering by contract, spam confidence, and metadata inclusion.

Parameters:

Name Type Description Default
owner str

Wallet address whose NFTs should be fetched. Supports ENS format on Eth Mainnet.

required
contract_addresses list[str] | None

Filter results to specific NFT contract addresses. Maximum 45 contracts.

None
with_metadata bool | None

Whether to include NFT metadata (name, description, image, attributes). Defaults to true.

None
order_by Literal['transferTime'] | None

Sort order. 'transferTime' sorts by most recent transfer first.

None
exclude_filters list[Literal['SPAM', 'AIRDROPS']] | None

Exclude NFTs matching these filters. Mutually exclusive with includeFilters. Values: SPAM, AIRDROPS.

None
include_filters list[Literal['SPAM', 'AIRDROPS']] | None

Include only NFTs matching these filters. Mutually exclusive with excludeFilters. Values: SPAM, AIRDROPS.

None
spam_confidence_level Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None

Spam confidence threshold (paid tier only). One of: VERY_HIGH, HIGH, MEDIUM, LOW.

None
token_uri_timeout_in_ms int | None

Timeout in milliseconds for fetching token URIs. Set to 0 for cache-only access.

None
page_key str | None

Pagination cursor returned by a previous response.

None
page_size int | None

Number of NFTs per page. Maximum 100. Defaults to 100.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
OwnedNftsResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_nfts_for_owner.py
async def get_nfts_for_owner(
  self,
  *,
  owner: str,
  contract_addresses: list[str] | None = None,
  with_metadata: bool | None = None,
  order_by: Literal['transferTime'] | None = None,
  exclude_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  include_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  spam_confidence_level: Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None = None,
  token_uri_timeout_in_ms: int | None = None,
  page_key: str | None = None,
  page_size: int | None = None,
  validate: bool | None = None
) -> OwnedNftsResponse:
  """Fetches all NFTs owned by a given wallet address on the requested chain. Supports filtering by contract, spam confidence, and metadata inclusion.

  Args:
    owner: Wallet address whose NFTs should be fetched. Supports ENS format on Eth Mainnet.
    contract_addresses: Filter results to specific NFT contract addresses. Maximum 45 contracts.
    with_metadata: Whether to include NFT metadata (name, description, image, attributes). Defaults to true.
    order_by: Sort order. 'transferTime' sorts by most recent transfer first.
    exclude_filters: Exclude NFTs matching these filters. Mutually exclusive with includeFilters. Values: SPAM, AIRDROPS.
    include_filters: Include only NFTs matching these filters. Mutually exclusive with excludeFilters. Values: SPAM, AIRDROPS.
    spam_confidence_level: Spam confidence threshold (paid tier only). One of: VERY_HIGH, HIGH, MEDIUM, LOW.
    token_uri_timeout_in_ms: Timeout in milliseconds for fetching token URIs. Set to 0 for cache-only access.
    page_key: Pagination cursor returned by a previous response.
    page_size: Number of NFTs per page. Maximum 100. Defaults to 100.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/get-nf-ts-for-owner-v-3)
    """
  params: dict = {
    'owner': owner,
  }
  if contract_addresses is not None:
    params['contractAddresses[]'] = contract_addresses
  if with_metadata is not None:
    params['withMetadata'] = with_metadata
  if order_by is not None:
    params['orderBy'] = order_by
  if exclude_filters is not None:
    params['excludeFilters[]'] = exclude_filters
  if include_filters is not None:
    params['includeFilters[]'] = include_filters
  if spam_confidence_level is not None:
    params['spamConfidenceLevel'] = spam_confidence_level
  if token_uri_timeout_in_ms is not None:
    params['tokenUriTimeoutInMs'] = token_uri_timeout_in_ms
  if page_key is not None:
    params['pageKey'] = page_key
  if page_size is not None:
    params['pageSize'] = page_size
  r = await self.request('GET', '/getNFTsForOwner', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_nfts_for_owner_paged

Paged version of get_nfts_for_owner.

Parameters:

Name Type Description Default
owner str

Wallet address whose NFTs should be fetched. Supports ENS format on Eth Mainnet.

required
contract_addresses list[str] | None

Filter results to specific NFT contract addresses. Maximum 45 contracts.

None
with_metadata bool | None

Whether to include NFT metadata (name, description, image, attributes). Defaults to true.

None
order_by Literal['transferTime'] | None

Sort order. 'transferTime' sorts by most recent transfer first.

None
exclude_filters list[Literal['SPAM', 'AIRDROPS']] | None

Exclude NFTs matching these filters. Mutually exclusive with includeFilters. Values: SPAM, AIRDROPS.

None
include_filters list[Literal['SPAM', 'AIRDROPS']] | None

Include only NFTs matching these filters. Mutually exclusive with excludeFilters. Values: SPAM, AIRDROPS.

None
spam_confidence_level Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None

Spam confidence threshold (paid tier only). One of: VERY_HIGH, HIGH, MEDIUM, LOW.

None
token_uri_timeout_in_ms int | None

Timeout in milliseconds for fetching token URIs. Set to 0 for cache-only access.

None
page_size int | None

Number of NFTs per page. Maximum 100. Defaults to 100.

None
validate bool | None

Validation override for each request.

None

Returns:

Type Description
PaginatedResponse[OwnedNft, str]

An async iterable and awaitable paginated response over owned NFTs.

References
Source code in pkg/src/alchemy/api/nft/get_nfts_for_owner.py
def get_nfts_for_owner_paged(
  self,
  *,
  owner: str,
  contract_addresses: list[str] | None = None,
  with_metadata: bool | None = None,
  order_by: Literal['transferTime'] | None = None,
  exclude_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  include_filters: list[Literal['SPAM', 'AIRDROPS']] | None = None,
  spam_confidence_level: Literal['VERY_HIGH', 'HIGH', 'MEDIUM', 'LOW'] | None = None,
  token_uri_timeout_in_ms: int | None = None,
  page_size: int | None = None,
  validate: bool | None = None,
) -> PaginatedResponse[OwnedNft, str]:
  """Paged version of get_nfts_for_owner.

  Args:
    owner: Wallet address whose NFTs should be fetched. Supports ENS format on Eth Mainnet.
    contract_addresses: Filter results to specific NFT contract addresses. Maximum 45 contracts.
    with_metadata: Whether to include NFT metadata (name, description, image, attributes). Defaults to true.
    order_by: Sort order. 'transferTime' sorts by most recent transfer first.
    exclude_filters: Exclude NFTs matching these filters. Mutually exclusive with includeFilters. Values: SPAM, AIRDROPS.
    include_filters: Include only NFTs matching these filters. Mutually exclusive with excludeFilters. Values: SPAM, AIRDROPS.
    spam_confidence_level: Spam confidence threshold (paid tier only). One of: VERY_HIGH, HIGH, MEDIUM, LOW.
    token_uri_timeout_in_ms: Timeout in milliseconds for fetching token URIs. Set to 0 for cache-only access.
    page_size: Number of NFTs per page. Maximum 100. Defaults to 100.
    validate: Validation override for each request.

  Returns:
    An async iterable and awaitable paginated response over owned NFTs.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/get-nf-ts-for-owner-v-3)
    """
  async def next(state: str):
    response = await self.get_nfts_for_owner(
      owner=owner, contract_addresses=contract_addresses,
      with_metadata=with_metadata, order_by=order_by,
      exclude_filters=exclude_filters, include_filters=include_filters,
      spam_confidence_level=spam_confidence_level,
      token_uri_timeout_in_ms=token_uri_timeout_in_ms,
      page_key=state or None, page_size=page_size, validate=validate,
    )
    return response.get('ownedNfts', []), response.get('pageKey')

  return PaginatedResponse('', next)

get_owners_for_contract

Retrieves all owners of a given NFT contract. Optionally includes token balances per owner.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
with_token_balances bool | None

If true, includes per-token balances for each owner.

None
page_key str | None

Pagination cursor for contracts with over 50,000 owners.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
ContractOwnersResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_owners_for_contract.py
async def get_owners_for_contract(
  self,
  *,
  contract_address: str,
  with_token_balances: bool | None = None,
  page_key: str | None = None,
  validate: bool | None = None
) -> ContractOwnersResponse:
  """Retrieves all owners of a given NFT contract. Optionally includes token balances per owner.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    with_token_balances: If true, includes per-token balances for each owner.
    page_key: Pagination cursor for contracts with over 50,000 owners.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/data/nft-api/api-reference/nft-ownership-endpoints/get-owners-for-contract-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
  }
  if with_token_balances is not None:
    params['withTokenBalances'] = with_token_balances
  if page_key is not None:
    params['pageKey'] = page_key
  r = await self.request('GET', '/getOwnersForContract', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_owners_for_contract_paged

Paged version of get_owners_for_contract.

Parameters:

Name Type Description Default
contract_address str

NFT contract address.

required
with_token_balances bool | None

If true, includes per-token balances for each owner.

None
validate bool | None

Validation override for each request.

None

Returns:

Type Description
PaginatedResponse[ContractOwner, str]

An async iterable and awaitable paginated response over contract owners.

References
Source code in pkg/src/alchemy/api/nft/get_owners_for_contract.py
def get_owners_for_contract_paged(
  self, *, contract_address: str, with_token_balances: bool | None = None,
  validate: bool | None = None,
) -> PaginatedResponse[ContractOwner, str]:
  """Paged version of get_owners_for_contract.

  Args:
    contract_address: NFT contract address.
    with_token_balances: If true, includes per-token balances for each owner.
    validate: Validation override for each request.

  Returns:
    An async iterable and awaitable paginated response over contract owners.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/data/nft-api/api-reference/nft-ownership-endpoints/get-owners-for-contract-v-3)
  """
  async def next(state: str):
    response = await self.get_owners_for_contract(
      contract_address=contract_address,
      with_token_balances=with_token_balances,
      page_key=state or None, validate=validate,
    )
    return response.get('owners', []), response.get('pageKey')

  return PaginatedResponse('', next)

get_owners_for_nft

Retrieves all owner addresses for a specific NFT token.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
token_id str

Token ID in hex or decimal format.

required
page_key str | None

Pagination cursor returned by a previous response.

None
validate bool | None

Validation override for this request.

None

Returns:

Type Description
NftOwnersResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_owners_for_nft.py
async def get_owners_for_nft(
  self,
  *,
  contract_address: str,
  token_id: str,
  page_key: str | None = None,
  validate: bool | None = None
) -> NftOwnersResponse:
  """Retrieves all owner addresses for a specific NFT token.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    token_id: Token ID in hex or decimal format.
    page_key: Pagination cursor returned by a previous response.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/get-owners-for-nft-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
    'tokenId': token_id,
  }
  if page_key is not None:
    params['pageKey'] = page_key
  r = await self.request('GET', '/getOwnersForNFT', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

get_spam_contracts

Returns all NFT contract addresses currently marked as spam by Alchemy. Requires Growth plan or higher.

Parameters:

Name Type Description Default
validate bool | None

Validation override for this request.

None

Returns:

Type Description
SpamContractsResponse | str

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/get_spam_contracts.py
async def get_spam_contracts(self, *, validate: bool | None = None) -> SpamContractsResponse | str:
  """Returns all NFT contract addresses currently marked as spam by Alchemy. Requires Growth plan or higher.

  Args:
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-spam-endpoints/get-spam-contracts-v-3)
    """
  r = await self.request('GET', '/getSpamContracts')

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

invalidate_contract

Marks all cached tokens for a contract as stale, ensuring the next query fetches fresh data. Use after collection reveals.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
InvalidateContractResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/invalidate_contract.py
async def invalidate_contract(
  self,
  *,
  contract_address: str,
  validate: bool | None = None
) -> InvalidateContractResponse:
  """Marks all cached tokens for a contract as stale, ensuring the next query fetches fresh data. Use after collection reveals.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/invalidate-contract-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
  }
  r = await self.request('GET', '/invalidateContract', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

is_airdrop_nft

Checks whether a specific NFT token was airdropped (minted by an address different from the recipient).

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
token_id str

Token ID in hex or decimal format.

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
AirdropNftCheckResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/is_airdrop_nft.py
async def is_airdrop_nft(
  self,
  *,
  contract_address: str,
  token_id: str,
  validate: bool | None = None
) -> AirdropNftCheckResponse:
  """Checks whether a specific NFT token was airdropped (minted by an address different from the recipient).

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    token_id: Token ID in hex or decimal format.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/data/nft-api/api-reference/nft-spam-endpoints/is-airdrop-nft-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
    'tokenId': token_id,
  }
  r = await self.request('GET', '/isAirdropNFT', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

is_holder_of_contract

Checks whether a given wallet owns any token in a specified NFT contract.

Parameters:

Name Type Description Default
wallet str

Wallet address to check.

required
contract_address str

NFT contract address (ERC721 or ERC1155).

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
ContractHolderCheckResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/is_holder_of_contract.py
async def is_holder_of_contract(
  self,
  *,
  wallet: str,
  contract_address: str,
  validate: bool | None = None
) -> ContractHolderCheckResponse:
  """Checks whether a given wallet owns any token in a specified NFT contract.

  Args:
    wallet: Wallet address to check.
    contract_address: NFT contract address (ERC721 or ERC1155).
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-ownership-endpoints/is-holder-of-contract-v-3)
    """
  params: dict = {
    'wallet': wallet,
    'contractAddress': contract_address,
  }
  r = await self.request('GET', '/isHolderOfContract', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

is_spam_contract

Checks whether a given NFT contract is classified as spam by Alchemy.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
SpamContractCheckResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/is_spam_contract.py
async def is_spam_contract(
  self,
  *,
  contract_address: str,
  validate: bool | None = None
) -> SpamContractCheckResponse:
  """Checks whether a given NFT contract is classified as spam by Alchemy.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-spam-endpoints/is-spam-contract-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
  }
  r = await self.request('GET', '/isSpamContract', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

refresh_nft_metadata

Queues a cache refresh for a specific NFT token's metadata.

Parameters:

Name Type Description Default
body RefreshNftMetadataRequest

Token to refresh.

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
RefreshNftMetadataResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/refresh_nft_metadata.py
async def refresh_nft_metadata(
  self,
  body: RefreshNftMetadataRequest,
  *,
  validate: bool | None = None
) -> RefreshNftMetadataResponse:
  """Queues a cache refresh for a specific NFT token's metadata.

  Args:
    body: Token to refresh.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/refresh-nft-metadata-v-3)
    """
  r = await self.request('POST', '/refreshNftMetadata', json=body)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

report_spam

Reports a contract address as spam to Alchemy's spam classification system.

Parameters:

Name Type Description Default
address str

Contract address to report.

required
is_spam bool

Whether to mark the address as spam (true) or clear the spam flag (false).

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
str

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/report_spam.py
async def report_spam(
  self,
  *,
  address: str,
  is_spam: bool,
  validate: bool | None = None
) -> str:
  """Reports a contract address as spam to Alchemy's spam classification system.

  Args:
    address: Contract address to report.
    is_spam: Whether to mark the address as spam (true) or clear the spam flag (false).
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-spam-endpoints/report-spam-v-3)
    """
  params: dict = {
    'address': address,
    'isSpam': is_spam,
  }
  r = await self.request('GET', '/reportSpam', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

search_contract_metadata

Searches contract metadata across ERC-721 and ERC-1155 contracts for a given keyword. Beta.

Parameters:

Name Type Description Default
query str

Search keyword to match against contract metadata.

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
ContractMetadataSearchResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/search_contract_metadata.py
async def search_contract_metadata(
  self,
  *,
  query: str,
  validate: bool | None = None
) -> ContractMetadataSearchResponse:
  """Searches contract metadata across ERC-721 and ERC-1155 contracts for a given keyword. Beta.

  Args:
    query: Search keyword to match against contract metadata.
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/search-contract-metadata-v-3)
    """
  params: dict = {
    'query': query,
  }
  r = await self.request('GET', '/searchContractMetadata', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()

summarize_nft_attributes

Generates a summary of attribute prevalence across all tokens in a collection.

Parameters:

Name Type Description Default
contract_address str

NFT contract address (ERC721 or ERC1155).

required
validate bool | None

Validation override for this request.

None

Returns:

Type Description
NftAttributesSummaryResponse

The validated endpoint response.

References
Source code in pkg/src/alchemy/api/nft/summarize_nft_attributes.py
async def summarize_nft_attributes(
  self,
  *,
  contract_address: str,
  validate: bool | None = None
) -> NftAttributesSummaryResponse:
  """Generates a summary of attribute prevalence across all tokens in a collection.

  Args:
    contract_address: NFT contract address (ERC721 or ERC1155).
    validate: Validation override for this request.

  Returns:
    The validated endpoint response.

  References:
    - [Alchemy API docs](https://www.alchemy.com/docs/reference/nft-api-endpoints/nft-api-endpoints/nft-metadata-endpoints/summarize-nft-attributes-v-3)
    """
  params: dict = {
    'contractAddress': contract_address,
  }
  r = await self.request('GET', '/summarizeNFTAttributes', params=params)

  if r.status_code != 200:
    self.raise_error(r)
  return adapter.json(r.text) if self.should_validate(validate) else r.json()