GET /api/messages
Retrieve all messages for a project, ordered byupdatedAt ascending (oldest first). Each message includes its associated CodeFragment if one exists.
Query parameters
The ID of the project whose messages you want to retrieve. Minimum 3 characters.
Response
Returns an array of Message objects withcodeFragment included.
Unique message identifier (UUID).
The text content of the message.
Who authored the message. One of
USER or ASSISTANT.Message outcome. One of
RESULT or ERROR.Clerk user ID associated with the message.
Design screenshot URL attached to this message, or
null.The project this message belongs to.
ISO 8601 creation timestamp.
ISO 8601 last-updated timestamp.
The code artifact produced by an assistant message. Present only on
ASSISTANT messages that completed successfully.Example
POST /api/messages
Send a follow-up prompt to a project. ForgeAI stores the message, then fires an Inngest event (code-agent/codeAgent.run) to continue AI code generation asynchronously.
Request body
The follow-up prompt. Minimum 3 characters, maximum 1000 characters.
The ID of the project to send the message to. Minimum 3 characters.
URL of a design screenshot to include with this message. Pro only — requires the
screenshot_upload feature flag.Response
Returns the newly created Message object (the user turn, before AI generation completes).Unique message identifier (UUID).
The prompt text as stored.
Always
USER for messages created via this endpoint.Always
RESULT for messages created via this endpoint.Clerk user ID of the sender.
The design screenshot URL, or
null.The project this message was sent to.
ISO 8601 creation timestamp.
ISO 8601 last-updated timestamp.
Example
The AI-generated response arrives asynchronously. Poll
GET /api/messages?projectId=... to check for the new assistant message and its CodeFragment.