Saltar al contenido principal

¿Qué son los runtime tokens?

Los runtime tokens (prefijo jfn_rt_) son credenciales que autentican las peticiones a tus funciones en producción. Cada función tiene al menos un token activo.

Generación automática

El primer deploy de una función genera un token automáticamente:
jelou deploy
# ✓ Deployed
# ▸ URL: https://mi-funcion.fn.jelou.ai
# ⚠ A default runtime token was created for this function.
#   Save it now — it will not be shown again.
# ▸ Token    jfn_rt_abc123...
El token se muestra una sola vez. Los deploys subsiguientes no lo muestran. Si lo pierdes, crea uno nuevo con jelou tokens create.

Cómo usarlos

Envía el token en el header X-Jelou-Token:
curl -X POST https://mi-funcion.fn.jelou.ai \
  -H "Content-Type: application/json" \
  -H "X-Jelou-Token: jfn_rt_abc123..." \
  -d '{"telefono": "593987654321"}'
ReglaDetalle
HeaderX-Jelou-Token (no Authorization: Bearer)
FormatoNo query param, no body — solo header
Tamaño máximo4 KB
Sin token401 { "error": "Unauthorized" }

Gestión con CLI

Listar tokens

jelou tokens list mi-funcion
# ▸ Name          Prefix          Last Used              Created
# ▸ default       jfn_rt_abc1..   4/7/2026, 10:30:00 AM  4/1/2026, 2:00:00 PM
# ▸ ci-deploy     jfn_rt_def4..   never                  4/5/2026, 9:00:00 AM

Crear token adicional

jelou tokens create mi-funcion --name ci-deploy
# ✓ Created token "ci-deploy"
# ▸ Token    jfn_rt_def456...
# ⚠ Save this token now — it will not be shown again.

Revocar token

jelou tokens revoke mi-funcion <token-id>
# ? Revoke token jfn_rt_def4... for mi-funcion? (y/N) y
# ✓ Token revoked

Múltiples tokens

Puedes tener varios tokens activos por función — uno por entorno, servicio o equipo:
  • default — generado en el primer deploy
  • ci-staging — para el pipeline de staging
  • brain-studio — para Brain Studio
  • partner-api — para un integrador externo
Revocar uno no afecta a los demás.

¿Perdiste el token?

  1. Crea uno nuevo: jelou tokens create mi-funcion --name nuevo
  2. El token anterior sigue activo (no se revoca automáticamente)
  3. Si el token fue comprometido, revócalo: jelou tokens revoke mi-funcion <id>

CI/CD

Crear tokens desde pipelines:
# Crear token y extraer el valor con jq
TOKEN=$(jelou tokens create mi-funcion --name ci-staging --json | jq -r '.data.token')
echo "::add-mask::$TOKEN"

Brain Studio

Configura tu función como servidor MCP externo:
CampoValor
URLhttps://mi-funcion.fn.jelou.ai/mcp
Header nameX-Jelou-Token
Header valuejfn_rt_abc123...

Pasar token a otra función

Guarda el token de la función destino como secret:
jelou secrets set mi-funcion OTRA_FUNCION_TOKEN=jfn_rt_xyz789...
handler: async (input, ctx) => {
  const res = await fetch("https://otra-funcion.fn.jelou.ai", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Jelou-Token": ctx.env.get("OTRA_FUNCION_TOKEN")!,
    },
    body: JSON.stringify({ dato: input.valor }),
  });
  return await res.json();
}