API Reference

AI Advisor (streaming)

Get expert project advice via streaming chat — SEO, design, accessibility, performance.

Last updated:

AI Advisor API

Stream expert project advice across SEO, design, performance, accessibility, copywriting, architecture, marketing, and security. Each POST costs CREDIT_COSTS.ADVISOR credits and is rate limited to 20 requests per hour per API key. Administrators are exempt from credit charges.

Fetch Advisor History

GET /api/v1/projects/{projectId}/advisor

Returns the chronological advisor conversation for the project.

{
  "data": {
    "history": [
      { "id": "msg_...", "role": "user", "content": "Audit my SEO" },
      { "id": "msg_...", "role": "assistant", "content": "## SEO Audit..." }
    ]
  }
}

Ask the Advisor (streaming)

POST /api/v1/projects/{projectId}/advisor
Content-Type: application/json

{ "message": "Audit my homepage for accessibility issues" }

Returns a text/plain stream. The rate limit headers are flushed before the first chunk so clients can parse them eagerly. Messages longer than 5000 characters are rejected with aVALIDATION_ERROR.

curl -N -X POST https://floop.tech/api/v1/projects/PRJ123/advisor \
  -H "Authorization: Bearer flp_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"message":"Review my copy"}'

On insufficient credits the API returns a structured 403 so tool-calling clients can surface the exact shortfall:

{
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "Insufficient credits",
    "limit": {
      "blocked": true,
      "reason": "credit_limit",
      "required": 1,
      "available": 0,
      "cta": { "text": "Buy credits", "action": "buy_credits" }
    }
  }
}