HTTP request
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()Request body
apiKeystringrequiredThe API key to exchange.
storageIdstringOptional storage association.
storageTypestringOptional client storage type.
frameworkstringOptional client framework label.
appNamestringOptional application name.
Successful response
{
ok: true,
jwt: "…",
refreshToken: "…",
session: { id: "…", storageId: "…" }
}Next request
Send the returned JWT as Authorization: Bearer YOUR_JWT. When it expires, use POST /api/auth/refresh; never put either token in a URL or browser-delivered source.