Auto-generated TypeScript types from the OpenSea API v2 OpenAPI spec. Source of truth for API types in the devtools ecosystem.
cd packages/api-types
pnpm run update-spec # fetch latest OpenAPI spec
pnpm run build # regenerate types and bundle
pnpm run type-check
pnpm run test
pnpm run lint- Keep
opensea-api.jsonas the committed, versioned OpenAPI snapshot. - Generate named schema exports, auth-scope metadata, and response helpers from the spec.
- Provide the types that
@opensea/sdkand@opensea/cliimport.
- Never hand-edit generated files in
src/generated.ts,src/schemas-generated.ts, orsrc/auth-scopes-generated.ts. Runpnpm run buildafterupdate-spec. - Add API endpoints via the spec first. Before writing SDK/CLI methods, run
pnpm --filter @opensea/api-types run update-spec && pnpm --filter @opensea/api-types run build. Hand-rolling request/response types is forbidden andpnpm check-api-paths(from the repo root) will fail. - Schema additions are automatic. New
components.schemas.*entries become named exports automatically; only editsrc/index.tsfor non-schema helpers or response envelopes. - Rebuild downstream. After spec changes, rebuild api-types, then run
pnpm --filter sdk run check-typesandpnpm --filter cli run build. Those use the workspace copy; theMirror layoutCI gate compiles sdk and cli against the published package, so SDK/CLI code that consumes a spec addition stays red until api-types is on npm. Land and release the spec refresh first, and see Spec changes and release order for the auth-scope case, which cannot be split that way. - Export check. CI runs
node packages/api-types/scripts/check-consumer-imports.mjsto ensure every workspace import from@opensea/api-typesexists indist/index.d.ts. - Auth-scope drift. CI runs
node scripts/check-auth-scope-drift.mjs(repo root) to compare the auth scopes inopensea-api.jsonagainst the live/api/v2/auth/scopesregistry. Re-runupdate-spec+buildwhen it reports drift.
- ESM-only, dual CJS/ESM output via tsup.
pnpm run update-specis idempotent and falls back to the local file on network errors.- Use
/sync-openapifor the full fetch → regenerate → PR flow.