GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ProjectOpenSea/api-types: TypeScript types auto-generated from the OpenSea API OpenAPI spec

BranchesTags
Open more actions menu

Latest commit

 

History

58 Commits
58 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
scripts
scripts
 
 
src
src
 
 
test
test
 
 
.nvmrc
.nvmrc
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
biome.json
biome.json
 
 
opensea-api.json
opensea-api.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.base.json
tsconfig.base.json
 
 
tsconfig.check.json
tsconfig.check.json
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.node-cjs.json
tsconfig.node-cjs.json
 
 
tsconfig.node-esm.json
tsconfig.node-esm.json
 
 
tsdown.config.base.mts
tsdown.config.base.mts
 
 
tsdown.config.ts
tsdown.config.ts
 
 
vitest.config.base.ts
vitest.config.base.ts
 
 

Repository files navigation

@opensea/api-types

TypeScript types generated from the OpenSea API OpenAPI spec.

Usage

import type { Schemas, OperationResponse, OperationQueryParams } from "@opensea/api-types";

type Collection = Schemas["CollectionResponse"];
type ListingsResult = OperationResponse<"list_listings_collection_all">;
type ListParams = OperationQueryParams<"list_collections">;

Runtime values

Almost everything here is a type and disappears at compile time. Two exports are real values, generated from opensea-api.json alongside the types so the two cannot drift.

CHAIN_IDENTIFIERS lists every chain slug the API accepts, in spec order. isChainIdentifier narrows a string to ChainIdentifier. Use them instead of a hand-written chain list, which goes stale when the API adds a chain.

import { CHAIN_IDENTIFIERS, isChainIdentifier } from "@opensea/api-types";

for (const chain of CHAIN_IDENTIFIERS) {
  console.log(chain); // "blast" | "base" | "ethereum" | ...
}

const input: string = process.argv[2] ?? "";
if (isChainIdentifier(input)) {
  // input is ChainIdentifier here
  await fetchCollections(input);
}

AUTH_SCOPES is the scope registry from the spec's AuthScope schema: name, display name, description, group, endpoints, and MCP tools for each scope.

These are wire types, in snake_case

Each type mirrors the OpenAPI spec, so its keys are the ones the API sends and accepts. Use them for code that calls the API directly.

Don't use them for values returned by @opensea/sdk. The SDK rewrites response keys to camelCase, so a wire type on an SDK result describes snake_case fields that read undefined at runtime. Single-word keys survive the rewrite, which makes the result look partly populated rather than wrong. TypeScript only catches the mismatch when the wire type has a required snake_case key somewhere in its tree, so the code often compiles.

For SDK results, use the matching type from @opensea/sdk (OpenSeaCollection, ResolveAccountResponse, and so on) or wrap the wire type in the SDK's Camelize<T>. The SDK README covers this under "Response casing".

Updating the spec

# Fetch the latest spec from the API
pnpm --filter @opensea/api-types run update-spec

# Rebuild types
pnpm --filter @opensea/api-types run build

update-spec downloads the spec from https://api.opensea.io/api/v2/openapi.json into opensea-api.json. That file is committed on purpose: it is the versioned input to codegen, so commit it after each update and the diff shows exactly what changed in the API.

Contributing

Read-only mirror of a private monorepo, updated on each release. Pull requests are welcome, and we bring accepted changes into the monorepo.

Security

Found a vulnerability? Report it through OpenSea's Bugcrowd program at https://bugcrowd.com/engagements/opensea rather than opening a public issue. See SECURITY.md.

About

TypeScript types auto-generated from the OpenSea API OpenAPI spec

Resources

Readme

Security policy

Security policy
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.