Skip to main content
@rewritetoday/typebox provides official TypeBox schemas for the Rewrite API so you can validate requests, responses, reusable resources, and webhook payloads at runtime. Repository: github.com/RewriteToday/typebox

When to use it

  • You prefer TypeBox as your runtime validation layer.
  • You want runtime validation in addition to TypeScript types.
  • You receive external input before calling Rewrite endpoints.
  • You need versioned schemas that stay aligned with Rewrite API models.

Key capabilities

Versioned schemas

Import schemas from namespaces such as @rewritetoday/typebox/v1.

REST contracts

Validate endpoint-specific bodies and responses with REST<Method>* schemas.

Reusable API models

Parse shared API* resources independently from a single endpoint.

Webhook safety

Validate WebhookEvent payloads before branching on the Rewrite event type.

Install

Request validation example

Webhook validation example

Best practices

Import from a specific API namespace such as @rewritetoday/typebox/v1 so upgrades stay deliberate.
Parse external input before it reaches your business logic so invalid payloads fail fast and predictably.
Combine @rewritetoday/typebox with @rewritetoday/rest and @rewritetoday/types for validation, routing, and transport in one stack.

Zod library

Official Zod schemas for teams that prefer the Zod validation model.

Types library

Shared contracts and route builders that complement runtime validation.

REST library

Low-level transport client for sending the payloads you validate with TypeBox.