zoxaAI
Homepage
API ReferenceAgents

AI-generate agent content

POST /api/v1/agents/generate — generate a systemPrompt or greeting line from a natural-language instruction.

POST /api/v1/agents/generate

Use an LLM to draft a systemPrompt or a greeting line (an entry for greeting.firstMessages) from a one-line instruction. Returns plain text — no JSON, no formatting — ready to paste into an agent config.

Authentication

X-API-Key: zsk_...

Request body

FieldTypeRequiredNotes
field"system_prompt" / "first_message"✓Which kind of content to generate.
instructionstring (≤ 2000 chars)✓What you want — e.g. "a polite onboarding agent for a B2B SaaS".
agent_namestring (≤ 255)—Optional name context.
agent_descriptionstring (≤ 2000)—Optional description context.

Response

{ "content": "You are a polite onboarding agent..." }

The string is the raw model output, trimmed. No quotes, no markdown, no JSON wrapping inside content.

Examples

curl -X POST https://dashboard.zoxa.ai/api/v1/agents/generate \
  -H "X-API-Key: zsk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "field": "system_prompt",
    "instruction": "Polite B2B SaaS onboarding agent. Asks one question at a time.",
    "agent_name": "Onboarder"
  }'
const { content } = await fetch(
  "https://dashboard.zoxa.ai/api/v1/agents/generate",
  {
    method: "POST",
    headers: { "X-API-Key": "zsk_...", "Content-Type": "application/json" },
    body: JSON.stringify({
      field: "first_message",
      instruction: "Friendly greeting for a sales bot",
    }),
  },
).then((r) => r.json());

console.log(content);
import httpx
content = httpx.post(
    "https://dashboard.zoxa.ai/api/v1/agents/generate",
    headers={"X-API-Key": "zsk_..."},
    json={"field": "system_prompt", "instruction": "Polite IT support agent."},
).json()["content"]

Errors

StatusdetailWhen
503"AI generation not configured"Platform's OpenAI key isn't set on the server side.
500"AI generation failed"Upstream LLM error.
422arrayinstruction too long, unknown field value, etc.

Notes

  • Backed by gpt-4.1-mini at temperature 0.7. No model selection on the client side.
  • Output capped at 1000 tokens.
  • This endpoint exists to populate the agent editor's "Generate" buttons — power users typically write prompts by hand.

On this page