Skip to main content
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. includeSystem covers these collections: payload-jobs, payload-kv, payload-llm-instructions, payload-locked-documents, payload-migrations, payload-preferences and payload-query-presets. It also covers the payload-jobs-stats global. See Endpoints for the full list of endpoints and the option that controls each one.

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:
  • include is an allowlist. Leave it empty and everything is documented; add anything and only matching entities survive.
  • exclude always wins. An entity matching both lists is dropped.

Document only a few collections

Once include 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 with public- and drops everything else:
payload.config.ts
Common patterns, for reference:
  • /^public-/ — slug starts with public-
  • /-draft$/ — slug ends with -draft
  • /^(posts|pages)$/ — slug is exactly posts or pages
  • /internal/i — slug contains internal, 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. It applies to every operation in the spec: collection, global, custom, jobs and system (upload instructions, /api/access) operations.

Rules

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. kind is one of 'collection', 'global', 'custom' (endpoints with custom.openapi), 'jobs' or 'system'. Custom, jobs and system operations have no slug, so a rule with slug never matches them.
payload.config.ts

Functions

For logic that doesn’t fit a rule, put a function in the same list. It receives the method, path, slug and kind of every operation. The operation is dropped only when the function returns true. An async function is awaited:
payload.config.ts
Filters only remove things from the document. To change how a kept operation is marked (public vs. secured), see Security marking.