Skip to main content

Create a session

Initiates a new session for emotion analysis by accepting a live stream URL. Each session is automatically assigned a worker which start analyzing the emotions in the stream in real-time until the session is stopped (See Stop session). You can monitor the state of the analysis by checking the meta.workerState field of the session or in real time using the WS API. At the moment, video sessions are not supported by the API.

warning

Stream maximum allowed resolution is 1080p. If provided stream resolution is higher, the session will be stopped and no data will be analyzed.

URL

POST /v1/sessions

Request Body

name
string
Required
New session name. Max 256 characters.
streamUri
string
Required
URI of the stream to analyze. Supported protocols are rtmp, rtsp and rtmps.

Response Body

Created session object

_id
string
Unique identifier for the session.
Example: 65ea1530bb50af72b6e3dc1e
name
string
Name of the session. Maximum 256 characters.
Example: Mobile Word Congress Pitch
type
enum SessionType
Session type
Example: live_analysis
state
enum SessionState
Current state of the session
Example: active
timestamp
Timestamp when the session was created.
Example: 2024-04-01T10:30:00.000Z
duration
number
Session duration in seconds.
Example: 120
config
object
Optional
Information about the configuration of the session.
sources
object[]
Optional
Information about the data sources of the session.
meta
object
Optional
Information referred to the internal state of the session.
product
string
Unique ID of the product used to analyze this session (e.g. pro, advanced...).
Example: 65946a77408bd7b32c5189a3
user
string
ID of the user who created the session.
Example: 65d7a8fb532f66218ecd4cab
version
number
Version of the object schema. It should not change often but can be helpful in the future if a new session schema is published.
Example: 3

Response codes

CodeMeaningDescription
201CreatedThe request has been fulfilled and a new resource was created.
400Bad RequestServer received an invalid request body or invalid query parameters.
503Service UnavailableServer is overloaded.

Request example

curl -X POST 'https://api.emogg.com/v1/sessions' \
-H 'Authorization: Bearer YOUR_API_TOKEN'
-H 'Content-Type: application/json'
-d '{"name":"Mobile Word Congress Pitch","streamUri":"rtmp://stream.emogg.com/mobile-world-congress"}'

Example response

{
"_id": "65ea1530bb50af72b6e3dc1e",
"name": "Mobile Word Congress Pitch",
"type": "live_analysis",
"state": "active",
"timestamp": "2024-04-01T10:30:00.000Z",
"duration": 120,
"config": {
"removeMedia": true
},
"sources": [
{
"id": "c1fcba18-15ec-457c-a1de-fcbb87aeaa0e",
"name": "Integrated Webcam",
"type": "video",
"device": "local_camera"
},
{...},
{...}
],
"meta": {
"expires": "2024-05-01T11:30:00.000Z",
"healthCheck": "2024-05-01T10:39:30.000Z",
"workerState": "working"
},
"product": "65946a77408bd7b32c5189a3",
"user": "65d7a8fb532f66218ecd4cab",
"version": 3
}