Skip to main content

POST /api/personalize-prompt

Builds and returns the meta-prompt text for a brand and viewer profile. Use this endpoint to get the prompt for copy/paste into your own Gemini session or another LLM.
This endpoint does not call Gemini. To have Splyce call Gemini and return the identified product directly, use POST /api/identify-product.

Request body

brand_name
string
required
The brand to advertise. The LLM infers the best-fitting specific product from the viewer context.
user_data
object | string
Viewer context. Accepts a JSON object or a freeform string describing the viewer (demographics, interests, region, etc.).
mode
string
default:"full"
Prompt size. Must be "full" or "minimal". "full" produces a detailed prompt; "minimal" produces a shorter one.
output_language
string
Optional language for the output, e.g. "English" or "Spanish".
brand_voice_notes
string
Optional tone guidance, legal constraints, or words to avoid. Applied when selecting the specific product.

Response

prompt
string
required
The full meta-prompt text, ready to paste into an LLM session.
mode
string
required
The mode that was used: "full" or "minimal".

Example

curl -X POST http://127.0.0.1:8000/api/personalize-prompt \
  -H "Content-Type: application/json" \
  -d '{
    "brand_name": "Toyota",
    "user_data": {
      "household_income": "$75k-$100k",
      "interests": ["road trips", "outdoors"],
      "region": "US-West",
      "family_size": 2
    },
    "mode": "full"
  }'
Response
{
  "prompt": "You are a retail product specialist for Toyota. Given the following viewer profile...\n",
  "mode": "full"
}

Errors

StatusCause
400brand_name is missing or empty.
400mode is not "full" or "minimal".

Build docs developers (and LLMs) love