v1

latestOpenAPI 3.0.0Apache 2.0 License2026-07-1457064.8 KB

Creates a new session or modifies an existing session with an Amazon Lex bot. Use this operation to enable your application to set the state of the bot.

For more information, see Managing Sessions.

post/bot/{botName}/alias/{botAlias}/user/{userId}/session

Path parameters

botNamestring required

The name of the bot that contains the session data.

botAliasstring required

The alias in use for the bot that contains the session data.

userIdstring required

The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.

Headers

Acceptstring
<p>The message that Amazon Lex returns in the response can be either text or speech based depending on the value of this field.</p> <ul> <li> <p>If the value is <code>text/plain; charset=utf-8</code>, Amazon Lex returns text in the response.</p> </li> <li> <p>If the value begins with <code>audio/</code>, Amazon Lex returns speech in the response. Amazon Lex uses Amazon Polly to generate the speech in the configuration that you specify. For example, if you specify <code>audio/mpeg</code> as the value, Amazon Lex returns speech in the MPEG format.</p> </li> <li> <p>If the value is <code>audio/pcm</code>, the speech is returned as <code>audio/pcm</code> in 16-bit, little endian format.</p> </li> <li> <p>The following are the accepted values:</p> <ul> <li> <p> <code>audio/mpeg</code> </p> </li> <li> <p> <code>audio/ogg</code> </p> </li> <li> <p> <code>audio/pcm</code> </p> </li> <li> <p> <code>audio/*</code> (defaults to mpeg)</p> </li> <li> <p> <code>text/plain; charset=utf-8</code> </p> </li> </ul> </li> </ul>

Request body

sessionAttributesobject

Map of key/value pairs representing the session-specific context information. It contains application information passed between Amazon Lex and a client application.

Response

Success

audioStreamstring

The audio version of the message to convey to the user.