Solicitud HTTP
curl https://api.iagenify.com/api/auth/sessions/exchange \
-X POST \
-H "Content-Type: application/json" \
-d '{"apiKey":"YOUR_API_KEY"}'JavaScript
const response = await fetch("https://api.iagenify.com/api/auth/sessions/exchange", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ apiKey: process.env.IAGENIFY_API_KEY }),
});
const session = await response.json();
if (!response.ok) throw new Error(session.error);
// Store session.jwt and session.refreshToken only in trusted storage.Python
import os, requests
response = requests.post(
"https://api.iagenify.com/api/auth/sessions/exchange",
json={"apiKey": os.environ["IAGENIFY_API_KEY"]},
timeout=30,
)
response.raise_for_status()
session = response.json()Cuerpo de la solicitud
apiKeystringobligatorioLos API clave para el intercambio.
storageIdstringAsociación de almacenamiento opcional.
storageTypestringTipo de almacenamiento opcional del cliente.
frameworkstringEtiqueta opcional de marco de cliente.
appNamestringNombre de la solicitud opcional.
Respuesta correcta
{
ok: true,
jwt: "…",
refreshToken: "…",
session: { id: "…", storageId: "…" }
}Siguiente solicitud
Enviar el devuelto JWT como Authorization: Bearer YOUR_JWTCuando expire, use POST /api/auth/refresh; nunca poner ninguna de las fichas en un URL o fuente entregada por el navegador.