I'm working on a Strapi v5 server and have set up the following tables:
Referrant – has many Agents.
Agent – has many Referrants.
ReferrantToAgent – a conjunction table to handle the many-to-many relationship with extra data on each connection.
I also used the users-permissions plugin to create two end-user roles: Referrant and Agent.
I'm trying to fetch Agents for a specific Referrant — the flow is that a Referrant user logs in and should get a list of their Agents.
The API call looks like this:
GET /api/referrant-to-agent?filters[referrant][documentId][$eq]=SOME_REFERRANT_ID&populate=agent
When the ReferrantToAgent API permissions are set to Public, the request works fine.
However, when I restrict the permissions to the Referrant role (and authenticate with a valid JWT token), the same request fails with:
{
"error": {
"status": 400,
"name": "ValidationError",
"message": "Invalid key referrant",
"details": {
"key": "referrant",
"path": "referrant",
"source": "query",
"param": "filters"
}
}
}
Why does filtering by referrant work when public, but break when authenticated?
Any ideas how to fix this?