# Send Message for Stream **POST /messages/stream** Send a message and get back a SSE (Server-Sent Events) stream for the AI response. An example of how to handle SSE stream in Javascript. ```js let message = '' const evtSource = new EventSource('https://stream.aimcaiface.com/abc...123') evtSource.onmessage = (event) => { const data = event.data if (data === '[END]') { // Request is closed by our servers once `[END]` is sent, // you must close the request otherwise the browser will keep retrying the URL. evtSource.close() } else if (data !== '[START]') { message += JSON.parse(data).chunk } } ``` ## Servers - https://getcody.ai/api/v1: https://getcody.ai/api/v1 () ## Authentication methods - Api key ## Parameters ### Body: application/json (object) - **content** (string) Content can be upto 2000 characters. - **conversation_id** (string) - **redirect** (boolean) By default, your request will be redirected to another url that will be a SSE stream. You can disable that and get the url in a json object instead. ## Responses ### 200 When `redirect` is set to `false` #### Body: application/json (object) - **data** (object) ### 302 When `redirect` is set to `true`. #### Headers - **Location** (string) URI to SSE stream. ### 402 When 30 days message limit of your subscription plan is reached. #### Body: application/json (object) - **message** (string) [Powered by Bump.sh](https://bump.sh)