Skip to main content
The SDK provides 100% type safety with auto-generated types from OpenAPI specifications, complete IntelliSense support, and compile-time error prevention.

Why Type Safety Matters

IntelliSense Support

Complete autocomplete for all API methods, parameters, and response data

Compile-time Checking

Catch errors during development, not at runtime

Self-Documenting Code

Types serve as always up-to-date documentation

Refactoring Safety

Confidently refactor with IDE support for finding all usages

Auto-Generated Types

All types are automatically generated from the OpenAPI specification, ensuring they’re always in sync with the API:

Response Types vs Input Types

The SDK exports context-aware types to distinguish between data you read from the API and data you send to the API:
Type nameUsed forExample
SchemaNameResponse data (reading)CustomerAddress, Cart, Product
SchemaNameInputRequest bodies (writing)CustomerAddressInput, AnalyticsEventInput
Some schemas appear only in responses, some only in request bodies, and some in both. The SDK generates the right exports automatically:
  • Response-only schemas — export the base name only (e.g. Cart)
  • Request + response schemas — export both (e.g. CustomerAddress + CustomerAddressInput)
  • Request-only schemas — export the Input name only (e.g. AnalyticsEventInput)
You can also use the endpoint-level Body types (e.g. UpdateFulfillmentPreferenceBody) to type the full request body shape passed to an SDK method.

The { data, error } Pattern

Every API operation returns a type-safe object with data and error properties:

IntelliSense in Action

Method Parameters

Complete autocomplete for all API parameters with OpenAPI-generated types:

Response Data Access

Full type safety when accessing response data:

Cart Operations

Type-safe cart management with correct API structure:

Advanced Type Features

Discriminated Unions

Type-safe handling of different response states:

Generic Type Constraints

Type-safe configuration with OpenAPI-generated interfaces:

Framework Integration Types

React Hook Types

Component Props

Type Utilities

Exported Utility Types

Readable & Writable Utility Types

The SDK re-exports Readable and Writable utility types for advanced use cases where the generated exports don’t cover your needs:
In most cases you won’t need Readable or Writable directly — the generated base-name and Input exports cover standard usage. These are provided as escape hatches.

Type Guards

Development Experience

IDE Integration

The SDK works seamlessly with popular IDEs:
  • VSCode: Full IntelliSense, error squiggles, auto-imports
  • WebStorm: Complete type information, refactoring support
  • Vim/Neovim: TypeScript LSP provides full type information

Compile-Time Validation

Type Safety vs Direct API

Best Practices

Configure TypeScript for maximum type safety:
tsconfig.json
Always import and use the generated types from the SDK:
Always check for both success and error conditions:

Migration Benefits

When migrating from direct API calls:

Catch Errors Early

Find API usage errors during development, not production

Always Current Documentation

Types are auto-generated from OpenAPI spec and always up-to-date

Faster Development

IntelliSense speeds up development with accurate autocomplete

Confident Refactoring

Change APIs with confidence using IDE refactoring tools
All SDK types are automatically generated from the OpenAPI specification, ensuring they’re always accurate and up-to-date with the actual API. Response types use the base schema name (e.g. CustomerAddress), while request body types use the Input suffix (e.g. CustomerAddressInput). The Readable and Writable utility types are also available for advanced use cases.