Both AI endpoints are asynchronous. Requests return
202 Accepted immediately and dispatch a background job. A push notification or in-app notification is sent when the result is ready.POST /api/v1/ai/generate
Generate a business profile using AI based on basic business details. Dispatches aGenerateBusinessProfile background job.
Middleware: auth:sanctum, throttle:apiAuthentication: Required
Budget enforcement
In addition to the route-level throttle, this endpoint enforces a token bucket rate limit: 5 requests per hour per user (key:ai-gen:{user_id}). When the budget is exhausted the endpoint returns 429 with a countdown until the next available slot.
The user must also have an associated tenant_id. Requests without a tenant return 403.
Request body
Business name. Between 3 and 100 characters.
Primary business activity or industry. Maximum 50 characters.
Geographic location of the business. Maximum 50 characters.
Optional additional context for the AI. Maximum 200 characters.
Response 202 Accepted
processingConfirmation message that the AI is working on the profile.
Number of remaining AI generation attempts in the current hour.
Response 403 Forbidden
Returned when the authenticated user has no associated tenant.
No business associated.Response 429 Too Many Requests
Returned when the per-user token bucket is exhausted.
Countdown message with minutes and seconds until the next slot.
Error responses
| Status | Cause |
|---|---|
401 | Missing or invalid token |
403 | User has no associated tenant |
422 | Validation failure (missing required fields, length violations) |
429 | Per-user AI budget exhausted |
POST /api/v1/ai/optimize-profile
Queue an AI-powered optimization of an existing business profile. Accepts structured inputs including tone, target audience, and keywords. Dispatches aGenerateBusinessProfileJob.
Middleware: auth:sanctum, throttle:apiAuthentication: Required
Request body
Business name. Maximum 255 characters.
Current business description. Between 10 and 1000 characters.
Description of the intended audience. Maximum 255 characters.
Array of keywords (maximum 10 keywords, each up to 50 characters).
Writing tone for the optimized profile. One of:
formal, casual, persuasive, witty, professional.Response 202 Accepted
processingProfile optimization has been queued.Error responses
| Status | Cause |
|---|---|
401 | Missing or invalid token |
422 | Validation failure (tone not in allowed list, keywords > 10, description too short) |