---
title: Let an agent translate
project: Documents
version: v1
section: recipes
language: en
license: MIT
url: https://totaljs.es/docs/documents/1/recipes/agent-translator/
updated: 2026-11-19T05:59:09.540Z
---

# Let an agent translate

> Give an AI agent a translator token and let it fill the missing translations through MCP or the JSON API.

1. Enable the language in **Languages**, for example Spanish.
2. In **Agent tokens**, create a token with the **translator** role, for the projects to translate, with an expiry.
3. Connect the agent to `/mcp/` with the token. It gets `Translations_list` (what is missing or outdated), `Translations_read` (the original and its translation) and `Translations_save`. Agents without MCP use these two calls of the JSON API:

```bash
# What is missing or outdated
curl -X POST https://docs.example.com/api/ -H "Authorization: Bearer docs_…" -H "Content-Type: application/json" \
  -d '{"schema":"translations?language=es"}'

# Save one translation
curl -X POST https://docs.example.com/api/ -H "Authorization: Bearer docs_…" -H "Content-Type: application/json" \
  -d '{"schema":"translations_save","data":{"reftype":"pages","refid":"…","language":"es","fields":{"title":"…","body":"…"}}}'
```

4. The agent reads each original with `Translations_read` (`translations_read` in the JSON API).

Every translation is in the history with the name of the token. Review them in **Translations**, and revoke the token when you are done.
