POST
/
v1
/
chat
/
states
/
{type}
/
{id}
/
{name}
cURL
curl --request POST \
  --url https://api.botpress.cloud/v1/chat/states/{type}/{id}/{name} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-bot-id: <api-key>' \
  --data '{
  "payload": {},
  "expiry": 1296000000.5
}'
{
  "state": {
    "id": "<string>",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "botId": "<string>",
    "conversationId": "<string>",
    "userId": "<string>",
    "name": "<string>",
    "type": "conversation",
    "payload": {}
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

x-bot-id
string
header
required

Your bot ID.

Path Parameters

type
enum<string>
required

State type

Available options:
conversation,
user,
bot,
integration,
task,
workflow
id
string
required

State id

name
string
required

State name

Body

application/json

State content

payload
object | null
required

Payload is the content of the state defined by your bot.

expiry
number | null

Expiry of the State in milliseconds. The state will expire if it is idle for the configured value. By default, a state doesn't expire.

Required range: 1 <= x <= 2592000000

Response

200
application/json

Returns the updated State object if a valid identifier was provided. Returns an an error otherwise

state
object
required

The state object represents the current payload. A state is always linked to either a bot, a conversation, or a user.