For Developers

Build AI that trulyunderstands users

Stop asking users to repeat themselves. With Enagrams, your AI app instantly knows their preferences, recent activities, and context.

1

Register your app

Create an app in the developer console. Get your client ID and secret.

2

OAuth connect

Users authorize your app with a familiar OAuth flow. Zero friction.

3

Fetch context

Call /v1/context with the user's token to get personalized data.

api-call.ts
const res = await fetch(
  `${API_BASE_URL}/v1/context`,
  {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${accessToken}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      query: "What should I know about this
              user's shopping preferences?",
      max_items: 20,
    }),
  }
);

const { items, summary } = await res.json();
// Use context to personalize AI response

How it works

Integrate Enagrams in minutes with our simple OAuth flow and unified context API.

Token Exchange Flow

// 1. User clicks "Connect with Enagrams" in your app
// Redirect to:
const authUrl = `https://api.enagrams.ai/oauth/authorize?
  response_type=code&
  client_id=YOUR_CLIENT_ID&
  redirect_uri=https://yourapp.com/callback&
  scope=read:context%20read:graph&
  state=random_state_string`;

// 2. After user approves, they're redirected to your callback
// https://yourapp.com/callback?code=AUTH_CODE&state=random_state_string

// 3. Exchange code for tokens (server-side)
const tokenRes = await fetch('https://api.enagrams.ai/oauth/token', {
  method: 'POST',
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  body: new URLSearchParams({
    grant_type: 'authorization_code',
    client_id: 'YOUR_CLIENT_ID',
    client_secret: 'YOUR_CLIENT_SECRET',
    code: 'AUTH_CODE',
    redirect_uri: 'https://yourapp.com/callback'
  })
});

const { access_token, refresh_token, expires_in } = await tokenRes.json();

// 4. Use the access token to fetch user context
const contextRes = await fetch('https://api.enagrams.ai/v1/context', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${access_token}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: "What's relevant for this user right now?",
    max_items: 20
  })
});

const { items, summary } = await contextRes.json();