Skip to content
masterclass Buddy

Zod · Function

refine

refine adds a custom validation rule to a Zod schema. The rule runs during parsing and can also run during codec encoding.

Last updated

Syntax

schema.refine(refinementFunc)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • check
  • superRefine
  • parse
  • safeParse
  • codec
  • ZodError

Source: Codecs | Zod. Checked 2026-11-03.