Skip to main content
This library includes TypeScript definitions for all request params and response fields. You may import and use them for type-safe API interactions.

Importing types

All types are available as named exports from the main cloudflare package:
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.

Request parameter types

Request parameter types follow the naming convention [Resource][Method]Params:

Response types

Response types are named after the resource they represent:

Type safety benefits

Using TypeScript types provides several benefits:

Autocomplete

Get intelligent code completion for all API methods and parameters

Compile-time checking

Catch errors before runtime with TypeScript’s type checker

Documentation

See inline documentation for parameters and return types

Refactoring

Safely refactor code with confidence in type correctness

Partial types

You can use TypeScript’s utility types to create partial or custom types:

Generic types

The library also exports common types used across the API:
All types are automatically generated from the Cloudflare OpenAPI specification and are kept up-to-date with the latest API changes.