The forgein API exposes your memory files as context blocks for every AI tool. All endpoints use Bearer token authentication. Tokens start with fg_ and are created at app.forgein.ai/tokens.
Base URL: https://api.forgein.ai·All endpoints: HTTPS only
Authentication
Every API request must include an Authorization header with a Bearer token. Tokens are scoped to a single user account. Create and revoke them from the dashboard.
Requests without a valid token return 401 Unauthorized. Rate limits apply per token: 300 req/min for API routes, 30 req/min for AI endpoints, 15 req/min for auth endpoints.
Adapters
Adapter endpoints return your context formatted for a specific tool. All accept two optional query parameters: projectPath (include project-specific files) and context (override active context: work | home | family).
GET/api/adapters/claude-code
Claude Code context
Returns your context as newline-separated markdown sections. The CLI injects this directly into the system prompt via CLAUDE.md or memory files.
NameTypeDescription
projectPathstringThe forgein project path for the current repo (e.g. -Users-alice-api). Includes project-specific memory files when provided.
contextstringOverride the active context. One of: work (default), home, family.
A stateless MCP server. Each request is a JSON-RPC 2.0 envelope with a method and optional params. All 6 standard MCP methods are supported. No WebSocket or session management required.
NameTypeDescription
jsonrpcreqstringAlways "2.0".
idreqnumberRequest ID — returned verbatim in the response.
Memory files are markdown documents organized by project path. A project path is the filesystem path to your repo with / replaced by -, e.g. -Users-alice-api. Context files (personal/home/family) use special paths prefixed with __ctx_work__, __ctx_home__, etc.
GET/api/memory/files
List files
Returns all memory files for a given project path.
NameTypeDescription
projectPathreqstringThe project to list files for.
Webhooks fire a signed HTTP POST to a URL you control when a memory file is saved. The event payload is signed with HMAC-SHA256 using the webhook secret and delivered in the X-Forgein-Signature header.
Sends a test memory.updated delivery to the webhook URL with "test": true in the payload and X-Forgein-Test: 1 in the headers. Records the delivery in the log and updates lastFiredAt.
curl -s -X POST "https://api.forgein.ai/api/webhooks/wh_abc123/ping" \
-H "Authorization: Bearer fg_..."
When a memory file is saved, forgein sends a signed HTTP POST to each active webhook. The request body is a JSON object containing the event type and file metadata. The signature is an HMAC-SHA256 digest of the raw request body, delivered in X-Forgein-Signature.
API tokens authenticate all API requests. Free accounts can create 1 token; Pro accounts up to 10. Token values start with fg_ and are only returned at creation time.
GET/api/tokens
List tokens
Returns all tokens for the authenticated user (values are not included).
Shares let you publish a public, read-only snapshot of your active context. Each share is accessible for 7 days via a public URL without authentication, then expires automatically.
POST/api/shares
Create share
Creates a public snapshot of the authenticated user's active context. Accepts a Bearer token or session cookie. The share URL is publicly viewable for 7 days without authentication.
NameTypeDescription
titlestringOptional display title for the share.
curl -s -X POST "https://api.forgein.ai/api/shares" \
-H "Authorization: Bearer fg_..." \
-H "Content-Type: application/json" \
-d '{ "title": "My work context" }'
Every account has a unique 8-character referral code. When another user redeems your code, both accounts receive the referral bonus: access to the Home context.
GET/api/referrals/me
Get my referral
Returns the authenticated user's referral code, shareable invite link, redemption count, and current bonus status.
// Response
{
"code": "AB12CD34", // your 8-character referral code
"url": "https://app.forgein.ai/signup?ref=AB12CD34",
"redemptionCount": 3, // times your code has been redeemed
"bonusActive": true, // true when Home context access is active
"usedCode": "XY78EF90" // code you redeemed, or null if none
}
POST/api/referrals/redeem
Redeem referral code
Redeems an 8-character referral code. Grants Home context access to both the redeemer and the code owner. Returns 400 if the code has already been redeemed or if you attempt to use your own code.
NameTypeDescription
codereqstringThe 8-character referral code to redeem.
MCP-compatible tools that support the Model Context Protocol discovery spec can fetch the forgein server URL and auth instructions automatically — no manual config required.
GET/.well-known/mcp
curl -s "https://api.forgein.ai/.well-known/mcp"
// Response
{
"mcpServers": {
"forgein": {
"url": "https://api.forgein.ai/api/adapters/mcp",
"description": "Forgein personal context server — memory files, team conventions, and project notes.",
"authentication": {
"type": "Bearer",
"tokenUrl": "https://app.forgein.ai/tokens"
}
}
}
}
Also available at /.well-known/mcp.json (redirects to the same endpoint).