__ __ _ ____ ____ _ __
| \/ | ___ ___ ___ __ _ _ __(_) / ___|| _ \| |/ /
| |\/| |/ _ \/ __/ __|/ _` | '__| | \___ \| | | | ' /
| | | | __/\__ \__ \ (_| | | | | ___) | |_| | . \
|_| |_|\___||___/___/\__,_|_| |_| |____/|____/|_|\_\
This repository defines the OpenAPI specifications and types for the official TypeScript SDK. The purpose of the SDK is to provide a type-safe, intuitive interface for accessing Messari's suite of crypto data and AI services.
The repository is organized as follows:
packages/api
: The SDK package that we publish to npm for consumption.packages/examples
: A demo project that implements examples of the SDK in action for the various services: AI, Asset, Intel, News, etc.typegen
: The OpenAPI specifications and type generation scripts. Used for updating the SDK types and operations.
├── packages/
│ └── api/
│ └── src/
│ ├── types.ts # Generated API types from OpenAPI
│ ├── schema.ts # Re-exported schema types
│ └── index.ts # Generated operations and re-exports
│ └── examples/
│ └── src/
│ ├── ai.ts # Example usage of the AI service
│ ├── asset/
│ ├── asset.ts # Example usage of the Asset service
│ ├── ath.ts # Example usage of the Asset service - ATHs
│ ├── roi.ts # Example usage of the Asset service - ROIs
├── typegen/
│ ├── openapi/
│ │ ├── common/ # Shared OpenAPI components
│ │ ├── services/ # Service-specific OpenAPI specs
│ │ ├── index.yaml # Main entry point that combines all services
│ │ └── dist/ # Bundled OpenAPI specs
│ └── scripts/ # Type generation scripts
└── package.json
List of services currently implemented in the SDK, more services will be added over time. For the full list of APIs, see the API Reference Docs.
Service Name | Endpoint Name | Endpoint Route | Implemented |
---|---|---|---|
AI | Chat Completion | /ai/v1/chat/completions |
✅ |
AI | Entity Extraction | /ai/v1/classification/extraction |
✅ |
Networks | Networks | /metrics/v1/networks |
✅ |
Networks | Network Details | /metrics/v1/networks/{networkIdentifier} |
✅ |
Networks | Network Metrics | /metrics/v1/networks/metrics |
✅ |
Networks | Network Timeseries | /metrics/v1/networks/{entityIdentifier}/metrics/{datasetSlug}/time-series/{granularity} |
✅ |
Intel | Events | /intel/v1/events |
🚧 |
Intel | Events By ID | /intel/v1/events/{eventId} |
🚧 |
Intel | Intel Assets | /intel/v1/assets |
🚧 |
News | News Assets | /news/v1/news/assets |
🚧 |
News | News Feed | /news/v1/news/feed |
🚧 |
News | News Sources | /news/v1/news/sources |
🚧 |
AI Digest | Project Recap By ID | /ai-digest/api/v1/recap |
❌ |
AI Digest | Exchange Recaps Overview | /ai-digest/api/v1/exchange-rankings-recap |
❌ |
AI Digest | Exchange Recap By ID | /ai-digest/api/v1/exchange-recap |
❌ |
Research | Reports | /research/v1/reports |
🚧 |
Research | Report By ID | /research/v1/reports/{id} |
🚧 |
Research | Report Tags | /research/v1/reports/tags |
🚧 |
Diligence | Report Preview | /diligence/v1/reports/preview |
🚧 |
Diligence | Report By Asset ID | /diligence/v1/report/asset/{assetId} |
🚧 |
Fundraising | Funding Rounds | /funding/v1/rounds |
🚧 |
Fundraising | Funding Rounds Investors | /funding/v1/rounds/investors |
🚧 |
Fundraising | Mergers and Acquisitions | /funding/v1/mergers-and-acquisitions |
🚧 |
Fundraising | Organizations | /funding/v1/organizations |
🚧 |
Fundraising | Projects | /funding/v1/projects |
🚧 |
To regenerate types after modifying OpenAPI specs:
# Install dependencies
pnpm install
# Generate types & build the SDK
pnpm run api:build
For detailed SDK usage, see the README.
-
Never run type generation scripts directly. Always use the package.json scripts from the root directory:
pnpm api:build
-
Service Registration: When creating a new service, you must register it in
typegen/openapi/index.yaml
:- Add paths to your service's endpoints
- Add tags for your service
- Reference your service's OpenAPI file
-
Schema Name Uniqueness: Schema names must be unique across all services. Since all schemas are combined into a single namespace, duplicate names will cause conflicts.
- Example: If
intel
service has anAsset
schema andnews
service also has anAsset
schema, they will conflict - Solution: Use service-specific prefixes (e.g.,
NewsAsset
vsIntelAsset
)
- Example: If
-
Common Components: Use the common components in
typegen/openapi/common/
for shared schemas:PaginationResult
for pagination metadataAPIResponseWithMetadata
for standard response wrapperAPIError
for error responses
-
DRY Principle: Don't repeat common schemas in service-specific files. Instead, reference them:
PaginationResult: $ref: '../../common/components.yaml#/components/schemas/PaginationResult'
-
Handling Type Collisions: When multiple services define types with the same name:
- For identical types used across services: Move these to
/openapi/common/components.yaml
- For different types with the same name: Use service-specific prefixes (e.g.,
IntelAsset
vsNewsAsset
)
- For identical types used across services: Move these to
-
Common Issues:
- Missing pagination parameters: Ensure referenced parameters are properly handled in the generation scripts
- Type mismatches: Verify OpenAPI specs and run
pnpm api:build
to regenerate all types
For more detailed information on the type generation process, see the Type Generation README.
MIT License - see the LICENSE file for details.