Before you start: what you are connecting
The store has a REST API that exposes what you see in the panel: products, prices per list, categories, price lists, customers and orders. An AI agent is, at heart, a program that can read an API reference and make HTTP calls. By connecting it, you give it hands to run the store while you keep the voice: you ask in plain English, it calls the API.
There are three things to have at hand before step one:
- The API active on your account. It is an add-on service. If Settings → ERP doesn't show the API Token option, or every call returns 403, ask support to activate it.
- An admin user. Only admins (or a user with the ERP permission) can see and generate the token.
- The API reference. It lives in the panel, on the same token card (link to the technical documentation), and summarized in the help center. It's what you hand the AI so it learns the endpoints.
Step 1: generate the API token
- In the admin panel, go to Settings → ERP.
- Pick the API Token option among the available integrations.
- Click Generate Token. It is shown only once: copy or download it (Download button) right then.
- Also note the base URL: it's your panel's domain, and every endpoint hangs from
/api/v1/.
Test that it works before moving on. From a terminal, with the token in a variable:
export VXM_TOKEN="pegá-acá-tu-token"
export VXM_URL="https://tu-panel.ventasxmayor.com"
curl -s "$VXM_URL/api/v1/products?limit=3" \
-H "Authorization: Bearer $VXM_TOKEN" If a JSON with data, total, offset and limit comes back, the door is open. A 401 means the token isn't travelling correctly; a 403 means the API isn't active on your account.
Step 2: choose the path for the AI you use
Every AI reaches the same API; what changes is the plug. There are four paths, from fastest to most tailored:
| Path | Who it's for | Tools | What you need |
|---|---|---|---|
| A · Terminal agent | The owner or the team that wants to start today | Claude Code · Codex CLI · Gemini CLI · GitHub Copilot · Cursor · Windsurf | Token in a variable + the reference |
| B · MCP connector | Anyone who wants to operate from the chat app | Claude · ChatGPT · Gemini · Copilot Studio · Le Chat · VS Code | An MCP bridge (the AI writes it) |
| C · Actions with OpenAPI | Anyone building a GPT or an agent for their team | GPT personalizado · Copilot Studio · Gems | OpenAPI schema (the AI writes it) |
| D · Automations and SDKs | Scheduled jobs and developers | n8n · Make · Zapier · Power Automate · SDKs de Anthropic, OpenAI, Google, Mistral | HTTP node with the Bearer header |
Path A: a terminal agent (Claude Code, Codex, Gemini CLI, Copilot)
These agents run on your computer and can execute commands, so they call the API directly, with no connector in between. All you have to do is leave the token within reach and describe the store in a context file.
- Create a working folder (for example
my-store-ai) and open the agent there:claude,codex,geminiorcopilot. - Leave the token in an environment variable, never inside a project file: in the terminal, before opening the agent,
export VXM_TOKEN="…"andexport VXM_URL="https://your-panel…". - Write the context file each agent reads at startup:
CLAUDE.mdfor Claude Code,AGENTS.mdfor Codex,GEMINI.mdfor Gemini CLI,.github/copilot-instructions.mdfor Copilot. Same content for all of them (template below). - Ask for something read-only to start: "List the last 10 orders with customer and total". The agent reads the reference, builds the
curland shows you the table.
Context file template
Paste it as is and adjust the URL. It's what makes the AI behave like a careful employee instead of a loose script:
# Tienda mayorista — reglas para operar por la API
Base URL: $VXM_URL/api/v1 (token en $VXM_TOKEN, header Authorization: Bearer)
Referencia: la documentación de la API del panel (Configuración → ERP → API Token)
y https://ventasxmayor.com.ar/centro-de-ayuda/integ-api
## Qué podés tocar
- products (por código), products/{code}/images, products/{code}/prices (por lista y variante)
- categories, price-lists
- customers (crear, editar, bloquear con blocked:true — nunca borrar)
- orders (listar, leer, PUT solo void o internal_notes — no se crean)
## Cómo trabajar
1. Antes de cualquier POST/PUT/DELETE, mostrame qué vas a cambiar y esperá mi OK.
2. En cambios masivos, primero una tabla previa (antes → después) y un conteo.
3. Paginá con limit=100. Si recibís 429, esperá y reintentá. Si recibís 409, releé el recurso.
4. Nunca imprimas el token ni lo guardes en archivos.
5. Al terminar, resumí qué cambió, cuántos registros y qué quedó pendiente. Path B: an MCP connector for chat apps (Claude, ChatGPT, Gemini, Copilot)
Chat apps don't run commands on your computer: they use MCP (Model Context Protocol), the standard an assistant uses to discover and call external tools. Since VentasxMayor doesn't publish an official MCP connector yet, you run a bridge: a small MCP server that translates each tool ("list orders", "change price") into the matching REST call, with the token stored inside the bridge and not in the chat.
B1. Ask the AI to write the bridge
With the path A agent open in the same folder, a request like this is enough:
Escribí un servidor MCP (TypeScript o Python, SDK oficial de MCP) que exponga como
herramientas los endpoints de /api/v1 que están en la referencia: listar/leer/crear/editar
productos, precios por lista, categorías, listas de precios, clientes y pedidos (leer, anular,
notas internas). Base URL y token salen de VXM_URL y VXM_TOKEN. Transporte stdio para uso
local y Streamable HTTP para uso remoto. Cada herramienta de escritura debe describir
claramente qué cambia. Probalo contra la API real con una llamada de solo lectura. Alternative without writing code: a generic OpenAPI → MCP bridge (several are open source) that takes an OpenAPI schema of the API and exposes each operation as a tool. The AI generates the schema from the reference, same as in path C.
B2. Plug the bridge into your app
There are two modes. Local: the bridge runs on your computer and desktop apps use it. Remote: the bridge runs on a server with HTTPS and a public URL, and web and mobile apps use it, connecting from the provider's cloud.
| App | Where to add it | Mode |
|---|---|---|
| Claude (web y móvil) | Customize → Connectors → Add custom connector → bridge URL. On Team and Enterprise the organization owner adds it first. | Remote |
| Claude Desktop | File claude_desktop_config.json, mcpServers block with the bridge command; also accepts .mcpb extensions. | Local |
| ChatGPT | Settings → Apps & Connectors → Advanced settings → Developer mode → Create connector with the bridge URL. Write tools require Business, Enterprise or Edu plans, enabled by the admin. | Remote |
| Codex CLI | codex mcp add or mcp_servers block in config.toml. | Local or remote |
| Gemini (app) | Settings → Connected apps → Custom app → bridge URL. | Remote |
| Gemini CLI | gemini mcp add or mcpServers block in ~/.gemini/settings.json. | Local or remote |
| Microsoft Copilot Studio | Tools → Add → MCP server (Streamable HTTP transport), with generative orchestration on. Each bridge tool shows up as an agent action. | Remote |
| VS Code · Cursor · Windsurf | The editor's mcp.json file (or Settings → MCP), with the bridge command or URL. | Local or remote |
| Mistral Le Chat | Connectors → Add custom connector → bridge URL. | Remote |
Path C: a custom GPT or an agent with actions (OpenAPI)
If you want an assistant built for your team ("Store operator") that anyone can use from ChatGPT or Microsoft 365 Copilot, the piece you need is an OpenAPI schema of the API with Bearer authentication. The platform doesn't publish that schema today, but the AI writes it from the reference:
Generá un esquema OpenAPI 3.1 en YAML de los endpoints /api/v1 de la referencia, con
securitySchemes bearerAuth (http, bearer), el servidor $VXM_URL, y descripciones claras
de cada operación y parámetro (offset, limit, category, customer). Marcá como
x-openai-isConsequential: true las operaciones POST, PUT y DELETE. - Custom GPT (ChatGPT). Explore GPTs → Create → Configure → Actions → Create new action → paste the schema → Authentication: API Key, type Bearer, paste the token → Test with a read operation. Operations marked as consequential ask for confirmation before running.
- Copilot Studio / Microsoft 365 Copilot. Tools → Add → Custom connector → Import from OpenAPI → key authentication in the
Authorizationheader → publish the agent to your team. - Gemini Gems and Claude Projects. They don't run actions on their own: use the path B MCP connector and save the template rules as the Gem's or Project's instructions.
Path D: automations (n8n, Make, Zapier) and developers with SDKs
For tasks that have to run on their own, without anyone asking, the AI pairs with an automation platform:
- n8n, Make, Zapier, Power Automate. A trigger (every morning at 8, or when an email arrives), an HTTP Request node to
$VXM_URL/api/v1/orderswith theAuthorization: Bearerheader, and an AI node (OpenAI, Anthropic, Google, Mistral) that summarizes, classifies or decides. The result goes to WhatsApp, Slack, an email or a spreadsheet. - Provider SDKs. If your team codes, any SDK with tool use or function calling (Anthropic, OpenAI, Google, Mistral) defines the tools over the endpoints and leaves the agent running on your infrastructure. Open models (Llama, DeepSeek, Qwen with Ollama) work the same way: the API is the same.
- No outgoing webhooks, for now. The API doesn't notify when something happens: the automation asks periodically (for example, orders from the last 15 minutes) and acts on what's new.
How to run it day to day: the rules worth giving it
An AI connected to the API has the same power as an admin. The difference between an excellent tool and a scare lies in six rules:
- Read first. The first week, only queries and reports. When you trust how it interprets the store, enable writes.
- Confirm before writing. Every POST, PUT or DELETE is announced and waits for your OK. On bulk changes, a preview table with before and after.
- The product code is the key. Products are addressed by
code, everything else byid. Search before creating: that way products aren't duplicated over an accent or a space. - Respect the limits. 120 calls per minute per method, pages of up to 100, bodies up to 5 MB. On 429 wait; on 409 re-read the resource and try again.
- The token never travels through the chat. It lives in an environment variable, in the MCP bridge or in the GPT's authentication settings. If it ever shows up in a conversation, ask support for a new one.
- Close with a summary. Every session ends with what changed, how many records and what's pending. On orders, internal notes leave a trail of what the AI did and for whom.
Prompts to get started
Copy and paste. They're ordered from lowest to highest risk, and each one uses a different part of the API:
- "List today's orders with customer, total and status. Flag which ones have no payment recorded."
- "Which products in the Cleaning category have zero stock? Build me the table with code, name and last time sold."
- "Compare the prices of the Wholesale A and Wholesale B lists for the 50 best-selling products and show me the percentage difference."
- "Raise all prices of the Wholesale B list in the Cleaning category by 8%. Show me the table first and wait for my OK."
- "Load the products from this spreadsheet: code, name, category, variants and price per list. Update the ones that exist; create the new ones. Tell me how many of each before running."
- "These 12 customers have overdue debt (here are their emails). Block them and note the reason and date on their records."
- "Every Monday at 8, build the weekly summary: orders per customer, average ticket, out-of-stock products, and leave it ready as a scheduled script."
Common errors and what they mean
The API answers with standard HTTP codes and a {"error": {"code": "…", "message": "…"}} body. The ones you'll see most often:
| Code | What happened | What the AI does |
|---|---|---|
401 | Token missing or invalid | Checks the Authorization: Bearer header |
403 | The API isn't active on the account | Stops and asks you to activate it through support |
404 | The route or resource doesn't exist | Looks up the right code or id before retrying |
409 | Someone else changed the resource while you were editing | Re-reads it and applies the change on the new version |
413 | The body exceeds 5 MB | Splits the batch (or image) into smaller pieces |
422 | The data failed validation | Reads the message, fixes the field and shows you what changed |
429 | More than 120 calls in a minute | Waits and retries with pauses |
What the API doesn't do today
- It doesn't create orders. Orders are born in the store cart or the panel, where the pricing, list and discount engine computes them. The AI reads them, voids them and leaves notes.
- It doesn't delete customers. It blocks them with
blocked: true, and the history stays. - It doesn't notify on its own. There are no outgoing webhooks: automations poll periodically.
- No official MCP connector or OpenAPI schema, for now. Both are built in minutes with the AI from the reference, as explained in paths B and C.
Want us to get it running with you?
We activate the API, review your first connection and help you define the rules for your team.
