Scroll documents
Returns a list of documents according to query parameter filters. If you need to query the entire database, or your collection is over 10000 documents, use this endpoint.
In the first request, the X-VTEX-MD-TOKEN token will be obtained in the response header. This token must be passed to the next request in the _token query string parameter. The token expires after 20 minutes of inactivity, and each request made with the token during this time resets the expiration timer.
After the token is obtained, it is no longer necessary to send the filter or document size per page parameters. You only need to resend the token until the document collection is empty.
First request:
/dataentities/Newsletter/scroll?isCluster=true&_size=250&_fields=email,firstName
Retrieve the token in the header X-VTEX-MD-TOKEN from the first request's response and use it to make the following requests.
Subsequent requests:
/dataentities/Newsletter/scroll?_token={tokenValue}
Learn more about Pagination in the Master Data API.
⚠️ Avoid sending too many requests with wildcards (*) in the search parameters or using the keyword parameter. This may lead to this endpoint being temporarily blocked for your account. If this happens you will receive an error with status code 429.
Query examples
| Query Type | Example |
|---|---|
| Simple filter | /dataentities/Newsletter/scroll?email=my@email.com |
| Complex filter | /dataentities/Newsletter/scroll?_where=(firstName=Jon OR lastName=Smith) OR (createdIn between 2001-01-01 AND 2016-01-01) |
| Date range | /dataentities/Newsletter/scroll?_where=createdIn between 2001-01-01 AND 2016-01-01 |
| Range numeric fields | /dataentities/Newsletter/scroll?_where=age between 18 AND 25 |
| Partial filter | /dataentities/Newsletter/scroll?firstName=*Maria* |
| Filter for null values | /dataentities/Newsletter/scroll?_where=firstName is null |
| Filter for non-null values | /dataentities/Newsletter/scroll?_where=firstName is not null |
| Filter for difference | /dataentities/Newsletter/scroll?_where=firstName<>maria |
| Filter greater than | /dataentities/Newsletter/scroll?_where=number>5 |
| Filter less than | /dataentities/Newsletter/scroll?_where=date<2001-01-01 |
Permissions
Any user or API 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:
| Product | Category | Resource |
|---|---|---|
| Dynamic Storage | Dynamic storage generic resources | Read only documents |
| Dynamic Storage | Dynamic storage generic resources | Insert or update document (not remove) |
| Dynamic Storage | Dynamic storage generic resources | Full access to all documents |
| Dynamic Storage | Dynamic storage generic resources | Master Data administrator |
There are no applicable predefined roles for this resource list. You must create a custom role and add at least one of the resources above in order to use this endpoint.To learn more about machine authentication at VTEX, see Authentication overview.
❗ To prevent integrations from having excessive permissions, consider the best practices for managing API keys when assigning License Manager roles to integrations.
Path parameters
Name of the data entity.
Query parameters
Value of the X-VTEX-MD-TOKEN token obtained in the response header of the first request, necessary on subsequent requests to continue scrolling through documents. The token expires after 20 minutes of inactivity, and each request made with the token during this time resets the expiration timer.
Inform the number of documents per request. Maximum value of 1000.
Fields that should be returned by document. Separate fields' names with commas. For example _fields=email,firstName,document. You can also use _fields=_all to fetch all fields.
Defines a condition the document must comply with. When referring to fields, you can use a nested field up to the first level (e.g. wishlistProduct.productName).
Name of the schema that the document complies with. This field is required when using _where or _fields query parameters.
Defines sorting mode in two parts. The first part is the name of the field you want to sort by. It can be a nested field up to the first level (e.g. wishlistProduct.productName). In the second part, use ASC for ascending order or DESC for descending order.
Headers
Type of the content being sent.
HTTP Client Negotiation Accept Header. Indicates the types of responses the client can understand.
Response
OK