privateAttributes not working in my model

In my model settings file i have:

{
“options”: {
“increments”: true,
“timestamps”: true,
“privateAttributes”: [“event_id”]
},

“event_id” is what i’m trying to hide from my get request to /event/12345

Doesnt matter what field i put in this privateAttributes array, nothing gets hidden from the api response. Im using Strapi v3.1.5

Hey @mkirkland :wave:,

The privateAttributes functionality has been added in v3.1.6, so upgrading should allow you to config this in your model.

Checkout: v3.1.6

  • [core:framework] Add privateAttributes to global and per model response (#7331) @dalbitresb12
1 Like

That worked, Thanks!

Great, good luck!

1 Like

Hi! Is it possible to hide a model’s attribute on all models that have it as a relation but not on the model itself?
I would like to hide PII information such as email from all my models that have a user relation but still allow the user to see his own email.

Thanks!

There is not currently @Pedro_Freitas though you could customize the data response using something like this guide: Custom Data Response - Strapi Developer Documentation

1 Like