
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
opensea-api
Advanced tools
This an API wrapper library for the OpenSea API written in Python 3.
The library provides a simplified interface to fetch a diverse set of NFT data points from OpenSea.
The wrapper covers the following OpenSea API endpoints:
You need to have an API key to use the OpenSea API, and thus
you need one to use this wrapper too. You can request a key here.
NOTE: The API key can take over 4-7 days to be delivered. It also requires you to show the project you are working on.
Install with pip:
virtualenv env && source env/bin/activate
pip install opensea-api
pip install opensea-api -U
# import the OpenseaAPI object from the opensea module
from opensea import OpenseaAPI
# create an object to interact with the Opensea API (need an api key)
api = OpenseaAPI(apikey="YOUR APIKEY")
# fetch a single asset
contract_address = "0x495f947276749Ce646f68AC8c248420045cb7b5e"
token_id = "66406747123743156841746366950152533278033835913591691491127082341586364792833"
result = api.asset(asset_contract_address=contract_address, token_id=token_id)
# fetch multiple assets
result = api.assets(owner="0xce90a7949bb78892f159f428d0dc23a8e3584d75", limit=3)
# fetch a single contract
result = api.contract(asset_contract_address="0x495f947276749Ce646f68AC8c248420045cb7b5e")
# fetch a single collection
result = api.collection(collection_slug="cryptopunks")
# fetch multiple collections
result = api.collections(asset_owner="0xce90a7949bb78892f159f428d0dc23a8e3584d75", limit=3)
# fetch collection stats
result = api.collection_stats(collection_slug="cryptopunks")
# fetch multiple events
from opensea import utils as opensea_utils
period_end = opensea_utils.datetime_utc(2021, 11, 6, 14, 30)
result = api.events(
occurred_before=period_end,
limit=10,
export_file_name="events.json",
)
# fetch multiple bundles
result = api.bundles(limit=2)
# paginate the events endpoint (cursors are handled internally)
from datetime import datetime, timezone
start_at = datetime(2021, 10, 5, 3, 25, tzinfo=timezone.utc)
finish_at = datetime(2021, 10, 5, 3, 20, tzinfo=timezone.utc)
event_generator = api.events_backfill(start=start_from,
until=finish_at,
event_type="successful")
for event in event_generator:
if event is not None:
print(event) # or do other things with the event data
Here's a demo video showcasing the basics.
occured_after and collection_editor arguments to events endpointevents_backfill())events_backfill() function) by
passing only the cursor hash and not the full URL to the next request.next url problem until OpenSea addresses this issueOpenseaAPI objectFAQs
Python 3 wrapper for the OpenSea NFT API
We found that opensea-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.