Skip to content

Authentication

All API endpoints (except /api/v1/health) require authentication. NeuralRepo supports two primary authentication methods and a separate MCP OAuth flow.

When you sign in through the NeuralRepo web app, a session token is stored in a secure HTTP-only cookie. You can also pass it explicitly via the Authorization header:

Authorization: Bearer <session_token>

Session tokens are short-lived and automatically refreshed by the web client. They are best suited for browser-based integrations.

API keys provide long-lived access for scripts, CI pipelines, and third-party integrations. Every key is prefixed with nrp_ followed by 64 hexadecimal characters:

X-API-Key: nrp_a1b2c3d4e5f6...
Terminal window
curl -X POST https://neuralrepo.com/api/v1/user/api-keys \
-H "Authorization: Bearer <session_token>" \
-H "Content-Type: application/json" \
-d '{"label": "CI Pipeline"}'

Response 201 Created

{
"id": "ak_abc123",
"label": "CI Pipeline",
"key": "nrp_a1b2c3d4e5f67890...",
"created_at": "2026-03-24T12:00:00Z"
}
GET /api/v1/user/api-keys

Returns all active keys for the authenticated user. The key field is masked.

DELETE /api/v1/user/api-keys/:id

Immediately invalidates the key. Returns 204 No Content.

API keys support the following scopes:

ScopeDescription
ideas:readRead ideas, tags, relations, links, search, map, duplicates
ideas:writeCreate, update, delete, merge, and develop ideas; manage tags, links, and relations

Session tokens have full access. API keys receive both scopes by default.

NeuralRepo provides MCP (Model Context Protocol) tokens for AI assistant integrations. The MCP OAuth flow is separate from standard API authentication:

  1. Request an MCP token through the NeuralRepo dashboard or via GET /api/v1/user/mcp-tokens.
  2. The MCP token is used by compatible AI clients (such as Claude) to access NeuralRepo tools.
  3. MCP tokens have the same scopes as API keys.

This flow is handled automatically when you connect NeuralRepo as an MCP server in a supported client.

StatusMeaning
401 UnauthorizedMissing or invalid token/key
403 ForbiddenValid auth but insufficient permissions or plan limits exceeded
{
"error": "Invalid API key"
}
  • Use API keys for server-side scripts and automations.
  • Use session tokens only from browser-based code.
  • Rotate API keys periodically and revoke unused keys.
  • Never commit API keys to version control.