vtex.local – Master-Data-API-
ATTENTION: This version isn't compliant with data entities of old version (e.g. CL and AD). It's possible to use this configuration only to new data entities.
Welcome!
VTEX Master Data is an easy-to-use, secure, fast, scalable and extensible repository. On it you can create your own Entities, store data and consult directly from the storefront or use it to store info for some external integration.
There are internal VTEX modules that use VTEX Master Data as data repository. We have the VTEX Customer Service, VTEX Profile System and VTEX InStore, for example. It is also used by other internal services.
There are two ways to use Master Data:
- Directly from the storefront
- External integration
Directly from the storefront
If your scenario is to be used inside the storefront, be aware of the following observations:
- Use the storefront host to query or store information to avoid CORS;
- Configure which information should be public and which shouldn't, inside the JSON Schema of the Data Entity;
- Do not create query loops (the storefront may be affected with Throttling and apis may be turned off as a security protection);
- Never add via JS any type of authentication key (x-vtex-api-appkey or x-vtex-api-apptoken);
It's important to avoid CORS using the relative path
External Integration
If your scenario is to perform external integration, such as migrating client data from another service, be aware of the following observations:
- Use the host
{{accountName}}.vtexcommercestable.com.br; - Use the authentication keys (x-vtex-api-appkey ou x-vtex-api-apptoken);
Most used attributes listed here
- Homepage
- https://api.apis.guru/v2/specs/vtex.local:Master-Data-API-/1.0.json
- Provider
- vtex.local:Master-Data-API- / Master-Data-API-
- OpenAPI version
- 3.0.0
- Spec (JSON)
- https://api.apis.guru/v2/specs/vtex.local/Master-Data-API-/1.0/openapi.json
- Spec (YAML)
- https://api.apis.guru/v2/specs/vtex.local/Master-Data-API-/1.0/openapi.yaml
Tools (28)
Extracted live via the executor SDK.
-
addresses.createNewCustomerAddressCreates new customer address.
You can use this request to create customer addresses according to any
ADschema. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for the schemas you are using. Learn more about how to use . -
addresses.deleteCustomerAddressDeletes a customer address.
-
addresses.updateCustomerAddressPartially updates a customer address.
You can use this request to update customer addresses according to any
ADschema. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for the schemas you are using. Learn more about how to use . -
clusters.validatedocumentbyclustersCheck if a document is present in one or more clusters (specific set of field values).
There is a limit of five rules per request.
-
customerProfiles.createNewCustomerProfilev2Creates new customer profile.
You can use this request to create customer profiles according to any
CLschema. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for the schemas you are using. Learn more about how to use . -
customerProfiles.deleteCustomerProfileDeletes a customer profile.
-
customerProfiles.updateCustomerProfilePartially updates a customer profile.
You can use this request to update customer profiles according to any
CLschema. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for the schemas you are using. Learn more about how to use . -
documents.createnewdocumentThis request allows you to create a new document corresponding to a given data entity. For example, you can create a new customer profile or address.
You can use this request to create documents for any given data entity. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for each document you wish to create.
Example use cases
Client profile
In order to create a new customer profile, choose the
CLdata entity and send a request similar to this:POST
Request body
Client address
For a new address, the data entity is
ADand the request would look like this:POST
Request body
https://examplestore.vtexcommercestable.com.br/api/dataentities/Client/documents{ "email": "clark.kent@examplemail.com", "firstName": "Clark", "lastName": "Kent", "phone": "+12025550195", "documentType": "CPF", "document": "12345678900" "isCorporate": false, "isNewsletterOptIn": false, "localeDefault": "en-US" }https://examplestore.vtexcommercestable.com.br/api/dataentities/Address/documents{ "addressName": "My House", "addressType": "residential", "city": "Metropolis", "complement": "", "country": "USA", "postalCode": "11375", "receiverName": "Clark Kent", "reference": null, "state": "MP", "street": "Baker Street", "neighborhood": "Upper east side", "number": "21", "userId": "7e03m794-a33a-11e9-84rt6-0adfa64s5a8e"} -
documents.createorupdatepartialdocumentThis request allows you to partially update a document corresponding to a given data entity.
You can use this request to create documents for any given data entity. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for each document you wish to update.
Example use cases
Client profile
In order to create a customer profile's
phoneandisNewsletterOptInfields, choose theCLdata entity and send a request similar to this:PATCH
Request body
Client address
In order to update the
receiverNameof an existing address, the data entity isADand the request would look like this:PATCH
Request body
https://examplestore.vtexcommercestable.com.br/api/dataentities/Client/documents{ "phone": "+12025550195", "isNewsletterOptIn": false }https://examplestore.vtexcommercestable.com.br/api/dataentities/Address/documents{ "receiverName": "Lois Lane"} -
documents.deletedocumentIt allows to delete a document.
-
documents.getdocumentGets document by ID.
Assign the
_fieldsparameter in the query string to retrieve the desired fields. If you want to return all the fields use_fields=_all. -
documents.updateentiredocumentUpdate an existing document corresponding to a given data entity. For example, you can update a customer profile or address.
You can use this request to update documents in any given data entity. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for each document you wish to update.
Example use cases
Client profile
In order to update an existing customer profile, choose the
CLdata entity and send a request similar to this:PUT
Request body
Client address
To update an address, the data entity is
ADand the request would look like this:PUT
Request body
https://examplestore.vtexcommercestable.com.br/api/dataentities/Client/documents/123456789abc{ "email": "clark.kent@examplemail.com", "firstName": "Clark", "lastName": "Kent", "phone": "+12025550195", "documentType": "CPF", "document": "12345678900" "isCorporate": false, "isNewsletterOptIn": false, "localeDefault": "en-US" }https://examplestore.vtexcommercestable.com.br/api/dataentities/Address/documents/123456789abc{ "addressName": "My House", "addressType": "residential", "city": "Metropolis", "complement": "", "country": "USA", "postalCode": "11375", "receiverName": "Clark Kent", "reference": null, "state": "MP", "street": "Baker Street", "neighborhood": "Upper east side", "number": "21", "userId": "7e03m794-a33a-11e9-84rt6-0adfa64s5a8e"} -
documents.updatepartialdocumentThis request allows you to partially update a document corresponding to a given data entity. For example, you can update some fields of a customer profile or address.
You can use this request to update documents for any given data entity. Because of this, you are not restricted to using the fields exemplified below in your requests. But you should be aware of the fields allowed or required for each document you wish to update.
Example use cases
Client profile
In order to update a customer profile's
phoneandisNewsletterOptInfields, choose theCLdata entity and send a request similar to this:PATCH
Request body
Client address
In order to update the
receiverNameof an existing address, the data entity isADand the request would look like this:PATCH
Request body
https://examplestore.vtexcommercestable.com.br/api/dataentities/Client/documents/123456789abc{ "phone": "+12025550195", "isNewsletterOptIn": false }https://examplestore.vtexcommercestable.com.br/api/dataentities/Address/documents/123456789abc{ "receiverName": "Lois Lane"} -
indices.deleteindexbynameDelete an index.
-
indices.getindexbynameReturns an index.
-
indices.getindicesReturns the list of indices by data entity.
-
indices.putindicesCreate an index.
-
schemas.deleteschemabynameDeletes an existing schema for a given data entity.
-
schemas.getschemabynameReturns an existing schema for a given data entity.
-
schemas.getschemasReturn the schemas saved.
-
schemas.saveschemabynameCreates or edits a data entity schema. Learn more about
Note that if you send a
schemaNamethat does not exist for that data entity, this request will create it.This request can also be used to .
-
scroll.scrolldocumentsIn the first request, the
X-VTEX-MD-TOKENtoken will be returned in the header. This token must be passed to the next request in the query string_tokenparameter. The token has a timeout of 10 minutes, which refreshes after each request.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.
Avoid sending too many requests with wildcards (
*) in the search parameters or that use thekeywordparameter. This may lead to this endpoint being temporarily blocked for your account. If this happens you will receive an error with status code429.Request examples
First request:
Retrieve the token in the header
X-VTEX-MD-TOKENfrom the first request's response and use it to make the next requests.Subsequent requests:
-
search.searchdocumentsRetrieves documents' information, while choosing which fields will be returned and filtering documents by specific fields.
The response header
REST-Content-Rangeindicates the total amount of results for that specific search. For example, it may returnresources 0-100/136108, which indicates it has returned results from 0 to 100 of a total 136108.Below you can see some query examples and learn more about each query parameter.
Avoid sending too many requests with wildcards (
*) in the search parameters or that use thekeywordparameter. This may lead to this endpoint being temporarily blocked for your account. If this happens you will receive an error with status code503.Query examples
Simple filter
Complex filter
Date Range
Range numeric fields
Partial filter
Filter for null values
Filter for non-null values
Filter for difference
Filter greater than or less than
/dataentities/Client/search?email=my@email.com/dataentities/Client/search?_where=(firstName=Jon OR lastName=Smith) OR (createdIn between 2001-01-01 AND 2016-01-01)/dataentities/Client/search?_where=createdIn between 2001-01-01 AND 2016-01-01/dataentities/Client/search?_where=age between 18 AND 25/dataentities/Client/search?firstName=*Maria*/dataentities/Client/search?_where=firstName is null/dataentities/Client/search?_where=firstName is not null/dataentities/Client/search?_where=firstName<>maria/dataentities/Client/search?_where=number>5/dataentities/Client/search?_where=date<2001-01-01 -
versions.getversionReturns the version of a document.
-
versions.listversionsAllows to list the versions of a document.
-
versions.putversionUpdates document with version values.
-
openapi.previewSpecPreview an OpenAPI document before adding it as a source
-
openapi.addSourceAdd an OpenAPI source and register its operations as tools