---
url: /validation/skip-validation.md
description: >-
  Set runtimeValidation option to false to keep TypeScript type checking without
  runtime validation for gradual adoption, performance optimization, or trusted
  internal endpoints.
---

There are cases where you want `TypeScript` type checking without the runtime validation overhead -
rapid iteration on payload structures, or trusted internal endpoints where you control both sides.

The second type argument to your handler accepts per-target options.
Set `runtimeValidation: false` to keep compile-time types while skipping runtime checks for that target:

```ts [api/example/index.ts]
export default defineRoute<"example">(({ POST }) => [
  POST<{
    json: Payload<User>,
  },
  {
    json: {
      runtimeValidation: false, // [!code hl]
    }
  }>(async (ctx) => {
    // ctx.validated.json is not available - use the bodyparser directly
    const user = await ctx.bodyparser.json<User>()
  }),
]);
```

This works for both payload and response targets. Route parameter validation cannot be skipped -
parameters are part of the URL structure and always validated.

For response targets the flag also works the other way: production builds skip response
validation unless you set `runtimeValidation: true` on the handler.
[Details ›](/validation/response.md)

Use this sparingly. Runtime validation is what catches the bugs `TypeScript` can't -
mismatched database responses, unexpected client payloads, API drift.
Skipping it is a conscious tradeoff, not a default.
