filters decides what the spec contains: which collections and globals are documented, which Payload-internal collections show up, which extra endpoint groups are generated, and which individual operations are dropped. It’s one flat object.
Choosing entities with include and exclude
These two lists pick which collections and globals are documented. Each entry is an EntityMatcher — one of three shapes:
Two rules govern how the lists combine:
includeis an allowlist. Leave it empty and everything is documented; add anything and only matching entities survive.excludealways wins. An entity matching both lists is dropped.
Document only a few collections
Onceinclude has entries, everything else stays out of the spec:
payload.config.ts
Document everything except a few entities
payload.config.ts
Match a group of slugs with a regular expression
The pattern is tested against the slug. This keeps every collection whose slug starts withpublic- and drops everything else:
payload.config.ts
/^public-/— slug starts withpublic-/-draft$/— slug ends with-draft/^(posts|pages)$/— slug is exactlypostsorpages/internal/i— slug containsinternal, case-insensitive
Disambiguate a collection from a global
A plain string matches any entity with that slug. When a collection and a global share one, use{ kind, slug } to target just one of them:
payload.config.ts
Mix them
include narrows the set first, then exclude removes from what’s left:
payload.config.ts
include and exclude only apply to your own collections and globals. Hidden and Payload-internal collections are
governed by includeHidden and includeSystem, which run first — adding payload-jobs to include won’t
surface it unless includeSystem is on.Dropping individual operations
include / exclude work at the entity level. To remove specific operations — one method on one collection, every DELETE, anything under a path prefix — use excludeOperations or excludeWhen.
excludeOperations
Each rule is a set of conditions. Within one rule, every field you set must match (AND). Across rules, an operation is dropped if any rule matches it (OR). A field you leave out matches anything.
payload.config.ts
excludeWhen
For logic that doesn’t fit a rule, excludeWhen is the escape hatch. It runs after excludeOperations and receives the method, path, slug, and kind of every operation; return true to drop it:
payload.config.ts