Search documents
Retrieves Master Data v2 documents' information, while choosing which fields will be returned and filtering documents by specific fields.
The response header REST-Content-Range indicates the total amount of results for that specific search. For example, it may return resources 0-100/136108, which indicates it has returned the first 100 results out of a total of 136108.
Below you can see some query examples and learn more about each query parameter.
Learn more about Pagination in the Master Data API.
⚠️ Avoid sending too many requests with wildcards (*) in the search parameters or that use 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 503.
Query examples
| Query Type | Example |
|---|---|
| Simple filter | /dataentities/Newsletter/search?email=my@email.com |
| Complex filter | /dataentities/Newsletter/search?_where=(firstName=Jon OR lastName=Smith) OR (createdIn between 2001-01-01 AND 2016-01-01) |
| Date range | /dataentities/Newsletter/search?_where=createdIn between 2001-01-01 AND 2016-01-01 |
| Range numeric fields | /dataentities/Newsletter/search?_where=age between 18 AND 25 |
| Partial filter | /dataentities/Newsletter/search?firstName=*Maria* |
| Filter for null values | /dataentities/Newsletter/search?_where=firstName is null |
| Filter for non-null values | /dataentities/Newsletter/search?_where=firstName is not null |
| Filter for difference | /dataentities/Newsletter/search?_where=firstName<>maria |
| Filter greater than | /dataentities/Newsletter/search?_where=number>5 |
| Filter less than | /dataentities/Newsletter/search?_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
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.
Specifies the range of documents to be returned in the response. The value should follow the format resources={x}-{y}, where:
- x: Index of the first document in the returned array.
- y: Index of the last document in the returned array + 1.
This field controls pagination by defining the subset of documents to be retrieved. The maximum number of documents returned per query is limited to 100. For example, resources=0-10 returns the first 10 documents.
Response
OK