Generate Context
Return the set of events for the specified session formatted for input into a Generative AI. The format and contents of the response are controlled by the Context specified to optimize the information included for the intended use case.
Path Parameters
Request Body required
slice object optional
Possible values: [UNSPECIFIED
, FIRST
, LAST
, TIMESTAMP
]
Default value: FIRST
If specified, the event limit and duration limit will be applied to the time beginning at this timestamp.
context object optional
Controls the session context elements to include, takes precedence over individual inclusion fields. Can be 'user', 'org', 'location', 'device'. If not specified and not excluded, all context elements are included.
Controls the session context elements to exclude, takes precedence over individual exclusion fields. Can be 'user', 'org', 'location', 'device'. If not specified and not excluded, all context elements are included.
events object optional
media object optional
cache object optional
Context response containing the session information and events as JSON.
Schema
- Array [
- Array [
- ]
- ]
context_data object optional
context object optional
org_context object optional
user_context object optional
properties object optional
location_context object optional
device_context object optional
screen_size object optional
viewport_size object optional
pages object[] optional
events object[] optional
{
"context_data": {
"context": {
"org_context": {},
"user_context": {
"properties": {}
},
"location_context": {},
"device_context": {
"screen_size": {},
"viewport_size": {}
}
},
"pages": [
{
"events": [
{
"properties": {}
}
]
}
]
}
}
Returned when invalid input has been provided. Fix the issue and retry.
Schema
Long form description of what went wrong
A short snake-cased value that is safe to handle programmatically
{
"message": "session_id is required",
"code": "required_field"
}
Returned when access to the resource is unauthorized.
Schema
Long form description of what went wrong
A short snake-cased value that is safe to handle programmatically
{
"message": "access is unauthorized",
"code": "unauthorized"
}
Returned when access is not allowed due to insufficient permissions.
Schema
Long form description of what went wrong
A short snake-cased value that is safe to handle programmatically
{
"message": "insufficient permissions",
"code": "forbidden"
}
Returned when the resource does not exist.
Schema
Long form description of what went wrong
A short snake-cased value that is safe to handle programmatically
{
"message": "Requested resource does not exist",
"code": "resource_not_found"
}
Returned when the client has exceeded the rate limit for this endpoint. A Retry-After
header will be included with the response. This header will contain the number of seconds that you should wait before attempting to send another request.
Schema
Long form description of what went wrong
A short snake-cased value that is safe to handle programmatically
{
"message": "Too many requests. Client has exceeded the rate limit for this endpoint.",
"code": "too_many_requests"
}
Returned when a server error is encountered.
Schema
Long form description of what went wrong
A short snake-cased value that is safe to handle programmatically
{
"message": "Server error was encountered",
"code": "server_error"
}