Consumer/customer data lookup for integration

Hello, good afternoon.

I’m working on an integration with VTEX and I need to retrieve the documents (CPFs and CNPJs) of the customers (consumers) registered on my client’s platform.

I believe the route could be Scroll {{baseUrl}}/api/dataentities/:acronym/scroll?_fields=id,document.

The acronym CL (which, from what I understand, would be the correct acronym for customers) is not found in my client’s homologation keys, so I ran tests using the acronym SP.

When querying the route above, it doesn’t return the documents. If I set the field to _fields=documents or _all, it returns the following message:

{
“Message”: “Cannot read private fields”
}

If I only use fields=id, it returns the found IDs.

The documentation states that a specific permission is required.

Permissions

Any user or application key must have at least one of the appropriate License Manager resources to be able to successfully run this request. Otherwise they will receive a status code 403 error. These are the applicable resources for this endpoint:

However, my client has confirmed that my token already has admin permission and should have all the necessary permissions.

Am I doing something wrong in my scroll request?

Is there a way to check which permissions my token has?

Hey @bruno.coelho, how’s it going?

The permissions belong to the entity’s field. VTEX, for security reasons and in compliance with LGPD, does not allow reading private fields (such as email, CPF, etc.) by default. You need to explicitly allow reading of these fields.

In the entity, you can check whether the field is marked as filterable:

For example, you can verify whether this option is unchecked in the form schema, as it is for the email field in this screenshot:

Keep in mind that every time you change a field in the entity, the ideal flow is to publish it and then reindex the entity.

If it still doesn’t work, I’d suggest asking the client to generate a new key for you, as the current one may not be configured to perform all operations with those credentials.

Additional documentation:

  1. Data Entity
  2. Difference between Master Data v1 and v2

Hope this helps!

Best,
Estevão.

Thank you so much for the reply, Estevão. I’ve passed the information along to the client to check if they can make the adjustment when creating a new token.

Cheers.