Can I get the API response without the many-to-many junction table?

I’ve set up my data model (details below), but when I query teams, I have to include the junction table in the query, and it also shows up in the response. Is there a way to hide the junction table so I don’t have to include or see it in the request and response?

Sample Query

/items/teams?fields=users.directus_users_id.first_name,users.directus_users_id.last_name

Sample Response

{
  "data": [
    {
      "users": [
        {
          "directus_users_id": {
            "first_name": "Lorem",
            "last_name": "Ipsum"
          }
        }
      ]
    }
  ]
}

Data Model

  • teams table
    • id
    • users (many to many to directus_users)
  • teams_directus_users table
    • id
    • teams_id
    • directus_users_id

Nope, the API output mirrors the structure in your database.

The App and API dynamically “mirror” your actual schema and content in real-time. This is similar to how technical database clients (like phpMyAdmin) work.

To return custom formatted data creating a Custom Endpoint extension is the recommended way.