Get an API key
Authentication

POST /api/auth/sessions/exchange

POST https://api.iagenify.com/api/auth/sessions/exchange

Exchange an API key for a bearer session. Use the returned bearer token on protected API requests and retain the refresh token only in trusted server-side storage.

no bearer token requiredJSONsession exchange

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

apiKeystringrequired

The API key to exchange.

storageIdstring

Optional storage association.

storageTypestring

Optional client storage type.

frameworkstring

Optional client framework label.

appNamestring

Optional 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.