Skip to content
Ask for a Budget
TechnologyAugust 31, 20266 min read

VTEX and your store's app: when you need a layer in the middle

VTEX integration: why the appToken cannot live inside the app, how an application key differs from a user token, and when the store needs a middle layer.

VTEX and your store's app: when you need a layer in the middle
Índice do artigo
faltam 5 min de leitura

The question that comes up in every store with its own app is whether it needs "something in the middle" between VTEX and the app. The answer does not depend on a preferred architecture. It depends on where the credential will live.

A business running on VTEX (an e-commerce platform) that decides to build its own app, a seller portal or a non-standard shopping experience quickly reaches this fork: does the app talk directly to the platform, or is there an intermediate service?

The question is usually treated as an architecture preference, with cost and simplicity arguments on both sides. It is not. There is an objective criterion, and it starts with the type of credential the integration needs to use.

Article summary

  • VTEX separates credentials by context: application key for the backend, user token for the frontend and auth token for VTEX IO apps. Using the wrong one is a recurring security defect in this kind of project.
  • The appKey and appToken pair travels in the X-VTEX-API-AppKey and X-VTEX-API-AppToken headers and carries the permissions granted to it. A credential like that cannot be embedded in an app.
  • The middle layer exists first because of the credential. Cache, aggregation and custom business rules are consequences, not the justification.
  • Not every store needs it. Consuming only the public catalog within the platform's tools makes the layer unnecessary.

The right question is where the credential will live

An app installed on the consumer's phone is an environment you do not control. Any key embedded there can be extracted by anyone who has the app, and no obfuscation technique reliably changes that fact.

This matters because VTEX's backend credential is not a harmless read key. The application key is a pair of values, appKey and appToken, sent in the X-VTEX-API-AppKey and X-VTEX-API-AppToken headers, and it reaches the platform's server carrying the set of permissions granted to it when it was created. A key generated with loose permissions, embedded in a public app, is the store's key distributed through the app store.

What this means for the decision: the discussion about a middle layer stops being about architectural elegance and becomes about credential exposure. If the integration needs an application key, the call leaves from a server of yours. Period.

Three credentials, three different places

The platform distinguishes authentication contexts, and most design mistakes come from treating the three as interchangeable.

CredentialWhat it is for
Application keyBackend requests made by the store's own systems. It is the appKey and appToken pair, with permissions defined at creation.
User tokenFrontend applications and requests made on behalf of a user, carrying that person's context and permissions.
Auth tokenAuthentication of apps developed on VTEX IO, within the platform's own extension model.

Source: VTEX developer authentication documentation, consulted on August 31, 2026.

The practical takeaway from this table is simple. If the screen needs something only the store can do, the call originates on your server with an application key. If the screen needs something on behalf of the logged-in consumer, the path is the user token, which naturally limits what that person can see.

What the layer does besides hiding the key

Once the intermediate service exists for security reasons, it solves, at no extra cost, four problems that would show up anyway.

The first is aggregation. A product screen usually needs catalog, price, availability and reviews. Done directly from the app, this becomes a sequence of chained calls over an unstable mobile network. Done on the server, it becomes a single response already shaped for the screen.

The second is caching. Much of what a storefront shows does not change with every visit, and answering from cache what has not changed is usually the cheapest performance gain in the project.

The third is custom rules. Loyalty programs, cashback, negotiated shipping rules and catalogs by customer profile rarely fit exactly into the platform's standard model. The layer is where this lives without becoming hard-to-maintain customization.

The fourth is least privilege. With the service in the middle, each integration can receive a key created with only the License Manager resources it needs, instead of a broad credential reused by everyone.

With a middle layer

  • The backend credential never leaves your server
  • One ready response per screen, instead of chained calls on the phone
  • Custom business rules outside the platform's customization
  • One key per integration, with minimum permissions

Without a middle layer

  • One less service to maintain, monitor and pay for
  • Faster initial delivery when the scope is just a storefront
  • One less place where data can go stale
  • A smaller team can handle it alone

When you do not need any layer

It is worth saying plainly, because the market's default answer is always to build more: if the operation consumes only public catalog data and the experience fits within the platform's own tools, the layer is cost with no return.

The sign that it is not needed yet is the absence of all three conditions: no privileged credential involved, no business rule the platform cannot express, no aggregation of an external source. With all three missing, building a service in the middle means adding a point of failure and a monthly bill to solve a problem you do not have.

The sign that it has become necessary is usually one of these: an integration with an outside system appeared, a rule appeared that requires data from more than one place, or the app now needs to do something only the store can do.

The case of an e-commerce app on VTEX

Polishop, a Brazilian retail brand, runs on VTEX and hired X-Apps to rebuild its e-commerce app. The work involved making the brand's web system talk to the app, as well as connecting services that do not live inside the platform, such as express delivery in partnership with a carrier and the cashback mechanism.

This combination illustrates this article's criterion exactly. Storefront and catalog are the easy part. What pulled the architecture toward its own layer were the outside services and the rules the store wanted to handle its own way. It is worth being honest: the app's rating rose from 2.3 to 4.6 stars over the course of the project (today it is 4.8 on Google Play and 4.7 on the App Store), and that is the result of a whole body of product and experience work, of which the integration architecture is one part, not the isolated cause.

License Manager roles are the control almost nobody uses

When creating an API key on VTEX, you choose which License Manager roles and resources it carries. That choice defines, in practice, what that credential can do if it leaks.

The pattern seen in the field is a single key, created with loose permissions at the start of the project, shared across all integrations and never reviewed. The pattern that prevents incidents is the opposite: one key per integration, with the minimum set of resources, and a note of which system uses which. This also makes it possible to revoke a specific integration without bringing down the others, which is the difference between a contained incident and a bad morning.

  • No application key embedded in an app, public site or repository
  • One key per integration, with the minimum resources for that use
  • A record of which system uses which key, to allow surgical revocation
  • User token for whatever is done on behalf of the logged-in consumer
  • A defined response plan for when the platform is unavailable

The last item is the most often forgotten. A storefront that shows cached prices with a discreet notice is a much better experience than a storefront that shows an error screen, and that decision needs to be made in the design, not during the incident.

Frequently asked questions

With backend credentials, no. The appKey and appToken pair is made for requests from your own systems on a server. Any credential embedded in an app or site can be extracted by whoever installs the app, and the key carries the permissions granted to it.

Sources and method

The statements about authentication come from VTEX's official developer documentation, consulted on August 31, 2026: the introduction to authentication page, which distinguishes application keys, user tokens and auth tokens, and the application key authentication page, which describes the X-VTEX-API-AppKey and X-VTEX-API-AppToken headers and the origin of permissions in License Manager roles and resources.

The Polishop case is public and is described in the project case study. VTEX prices, call limits and service levels were not researched and therefore do not appear in the text.

Previous post
Integrating TOTVS Protheus with an app: what to ask before the deadline
Next post
Salesforce integrations get stuck on authentication, not the API
Newsletter

One email a month, no noise

What we learn shipping custom software and applied AI.

Related articles

What is a web app and what are its benefits?9 min · Technology
Definitive Low-code Guide: What It Is and When to Use It9 min · Technology
How does a software house work?8 min · Technology
Web System: What It Is, How It Works, and the Benefits7 min · Technology
Lock-in: why do companies need to be careful with it?7 min · Technology

Accelerate your business with X-Apps

Ask for a Budget
X-Apps is an IT provider partner and advised by
Gartner
Receive our e-mails
News on software and applied AI.
Follow X-Apps