Skip to Content

NPC Interaction

Base URL: https://loremind.peekgames.dev/api/loremind/v1

Last verified against LoreMind v1.0.67 (August 2026).

The runtime NPC endpoint is the stable integration surface for your game — call it from your backend with a Server Key. Want to try it first? See the API Quickstart.

POST /npc/interact

Generate an NPC response to player input. This is the primary endpoint for NPC interactions.

Authentication: Server Key (sk_server_*)

Request Body

{ // Required text: string; // Player's message (max 2,000 chars) entityMindId: string; // Entity Mind ID (provides name, personality, knowledge filters) playerId: string; // Your player identifier (max 255 chars; used for rate limiting, // memory, and conversation tracking) // Optional context?: { location?: string; // Current location name locationDetails?: string; // Location description timeOfDay?: string; // "morning", "evening", etc. weather?: string; // Weather conditions atmosphere?: string; // Scene mood ("peaceful", "tense", ...) situation?: string; // Interaction type ("shopping", "combat", ...) npcMood?: string; // NPC's current mood npcActivity?: string; // What the NPC is doing playerAppearance?: string; // How player looks to NPC playerReputation?: string; // How the NPC views the player playerVisibleItems?: string[]; // Notable items the player carries nearbyCharacters?: string[]; // Other characters present nearbyObjects?: string[]; // Notable objects present recentEvents?: string[]; // Recent world events custom?: string; // Freeform game-specific context (max 500 chars) }; memory?: { retrieve?: boolean; // Retrieve past memories for this player (default: false) }; activeKnowledgeTags?: string[]; // Narrow which lore the NPC can reference (by tag name). // Max 50 tags, 100 chars each. Can only restrict the // Entity Mind's configured tags, never expand them. conversationHistory?: Array<{ // Max 50 messages, 10,000 chars per message. role: "user" | "assistant"; // The server keeps the most recent messages up to the content: string; // project's max session length. }>; }

The request schema is strict: unknown fields are rejected with a 400 error. String fields inside context are capped at 200 characters (500 for custom), arrays at 10 items (100 characters per item), and the context block at 2,000 characters overall.

Response

{ success: true; response: string; // NPC's response text character: string; // Character name metadata: { memoryCheckpoint?: boolean; // True when session hit max length and memories were auto-saved warnings?: string[]; // Non-fatal notices (e.g. ignored knowledge tags) }; }

Example Request

curl -X POST https://loremind.peekgames.dev/api/loremind/v1/npc/interact \ -H "Authorization: Bearer sk_server_your_key" \ -H "Content-Type: application/json" \ -d '{ "text": "What can you tell me about the dragon?", "entityMindId": "em_abc123", "playerId": "steam_76561198012345678", "context": { "location": "Blacksmith Shop", "timeOfDay": "evening", "weather": "rainy" }, "memory": { "retrieve": true }, "activeKnowledgeTags": ["dragon-war", "village-history"] }'

Example Response

{ "success": true, "response": "The dragon? Aye, I've heard the rumors. Spotted near the old watchtower, they say. If you're thinking of going after it, you'll need better steel than what you're carrying.", "character": "Grom the Blacksmith", "metadata": {} }

Error Responses

StatusErrorDescription
400Missing or empty textNo player message provided
400Text too longMessage exceeds 2,000 characters
400Missing entityMindIdentityMindId is required
400Missing playerIdplayerId is required for API key authentication
400Unknown field(s)Request contains fields not in the schema
400Entity Mind has no knowledge tags configuredConfigure knowledge tags in the dashboard first
401Invalid API keyAPI key is missing, malformed, or revoked
402Insufficient creditsTeam balance too low
403Invalid authenticationEditor keys cannot be used; use a Server Key
404Project not foundInvalid project or key
404Entity Mind not foundInvalid entityMindId
429Rate limit exceededToo many requests (see Retry-After header and retryAfter field)
503Generation failedLLM error (retry)

Rate limit defaults and 429 behavior are covered in Errors & Rate Limits.

Next Steps

Last updated on