How to fetch only custom collections via API without Directus system tables?

Hi everyone! :waving_hand:

I’m trying to fetch only my custom collections via the Directus API (JSON response), but I keep getting all the system tables mixed in.

What I want:

  • Only my custom collections (users, products, orders, etc.)
  • Exclude all Directus system tables (directus_users, directus_files, etc.)
  • Get fields/schema for each custom collection

What I’ve tried:

  • Used ?filter parameter but it’s not working as expected
  • Tried ?fields to select specific fields
  • Attempted _ncontains, _nstarts_with filters
  • Used various filter operators but none seem to work

Current approach:

// Returns ALL collections including system ones
fetch('/collections')

// Tried this but doesn't work:
fetch('/fields?filter[collection][_nstarts_with]=directus_')

Expected: Only my custom collections in the response, no directus_* tables.

Has anyone successfully filtered out system collections when fetching via API?

Thanks! :folded_hands:

GET /collections
GET /fields

These two endpoints do not support the filter parameter. They do respect permissions though so if the user making the API call doesn’t have access to system collections they won’t show up.

For more details, have a look at the API reference.

You would just filter them out after you’ve fetched the data.

Thanks , but Is there an automated way to generate API docs for just my custom collections in Directus? The OpenAPI spec that Directus generates is massive and 99% of it is system stuff I don’t need. I just want clean docs for my own collections like products, customers , services, etc. Anyone know of a tool or script that can filter the OpenAPI spec to only include my collections? Or maybe a better approach entirely? Thanks!

Easiest way to get clean API docs for just your custom collections is to generate the OpenAPI spec using a limited-permission API user. The /server/specs/oas endpoint only returns endpoints the user can access—so if you create a role or access policy that only includes collections like products, customers, services, etc., the output will be exactly what you want without all the system stuff (aside from the utils and login endpoints of course).

Quick rundown:

  1. Create a role or policy with access to just the collections you care about.
  2. Assign it to a user (or you could make one just for this).
  3. Generate an access token for that user (be very careful about where you use / store the token)
  4. Hit /server/specs/oas with the access token in the Authorization header.

No scripts needed, super clean, and just works.

Bonus tip: check out the RapidDocus or API Viewer extensions in the Marketplace if you want to view the filtered spec right inside Directus.