Skip to main content

Overview

The ICP API backs the ICP Generator. It manages a Postgres-backed library of Ideal Customer Profile dossiers and exposes AI synthesis of new profiles. All endpoints live under /api. Responses are JSON with a success boolean. Errors return success: false and an error message with HTTP 400 (validation), 503 (missing AI key), or 500 (server error). Profiles are scoped by workspaceId. Records with no workspaceId are global and visible to every workspace.

List ICP profiles

Returns profiles ordered by creation date, newest first. The first call seeds the library with three baseline profiles if the table is empty. Query parameters:
Response (200):

Generate an ICP profile with AI

Synthesizes a complete ICP dossier with Gemini. Requires the GOOGLE_GENERATIVE_AI_API_KEY environment variable; if it is not set, the endpoint returns 503.
Returns 200 with the profile in profile. If saveToDb is true, the response contains the saved database record with source: "ai_synthesized"; otherwise it contains the raw generated dossier. The endpoint tries gemini-2.5-flash first and falls back to gemini-1.5-flash, then gemini-1.5-pro.

Create an ICP profile

Saves a manually written profile. Requires name, industry, targetRole, and valueProposition; missing fields return 400.
Returns 201 with the created record in profile and source: "manual".

Delete an ICP profile

Deletes the profile with the given ID. Returns 200 with a confirmation message.