curl -X POST https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"event": {
"type": "image",
"data": "base64_encoded_image_data"
}
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"event": {
"type": "image",
"data": "base64_encoded_image_data"
}
}
)
result = response.json()
if result.get("type") == "error":
print(f"Error: {result['event_data']['error_messages']}")
elif not result:
print("Empty response - check session_id and event parameters")
else:
print(f"Success: {result}")
const response = await fetch('https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
session_id: 'lsn-250313c2177253cbaa7a73542edd90',
event: {
type: 'image',
data: 'base64_encoded_image_data'
}
})
});
const result = await response.json();
if (result.type === 'error') {
console.error('Error:', result.event_data.error_messages);
} else if (Object.keys(result).length === 0) {
console.log('Empty response - check session_id and event parameters');
} else {
console.log('Success:', result);
}
{
"type": "success",
"event_data": {
"response": "Processing result..."
}
}
{
"type": "error",
"event_data": {
"is_valid": false,
"error_messages": [
"Unknown event type: test"
]
}
}
{
"type": "error",
"event_data": {
"is_valid": false,
"error_messages": [
"Event payload is empty!"
]
}
}
{
"detail": "error"
}
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
Internal Server Error
Lens API
Session Events Process
Sends an event to an active session to process
POST
/
lens
/
sessions
/
events
/
process
curl -X POST https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"event": {
"type": "image",
"data": "base64_encoded_image_data"
}
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"event": {
"type": "image",
"data": "base64_encoded_image_data"
}
}
)
result = response.json()
if result.get("type") == "error":
print(f"Error: {result['event_data']['error_messages']}")
elif not result:
print("Empty response - check session_id and event parameters")
else:
print(f"Success: {result}")
const response = await fetch('https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
session_id: 'lsn-250313c2177253cbaa7a73542edd90',
event: {
type: 'image',
data: 'base64_encoded_image_data'
}
})
});
const result = await response.json();
if (result.type === 'error') {
console.error('Error:', result.event_data.error_messages);
} else if (Object.keys(result).length === 0) {
console.log('Empty response - check session_id and event parameters');
} else {
console.log('Success:', result);
}
{
"type": "success",
"event_data": {
"response": "Processing result..."
}
}
{
"type": "error",
"event_data": {
"is_valid": false,
"error_messages": [
"Unknown event type: test"
]
}
}
{
"type": "error",
"event_data": {
"is_valid": false,
"error_messages": [
"Event payload is empty!"
]
}
}
{
"detail": "error"
}
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
Internal Server Error
Requires version 1.1.5 or later of the Archetype platform.
Overview
This endpoint sends an event to an active session to process.Request
string
required
The ID of the active session the event should be routed to.
object
required
The event to route to the session. Must contain a
type field.Response
string
Response type. “error” indicates a processing error occurred.
object
Event processing result or error details.
curl -X POST https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"event": {
"type": "image",
"data": "base64_encoded_image_data"
}
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"session_id": "lsn-250313c2177253cbaa7a73542edd90",
"event": {
"type": "image",
"data": "base64_encoded_image_data"
}
}
)
result = response.json()
if result.get("type") == "error":
print(f"Error: {result['event_data']['error_messages']}")
elif not result:
print("Empty response - check session_id and event parameters")
else:
print(f"Success: {result}")
const response = await fetch('https://api.u1.archetypeai.app/v0.5/lens/sessions/events/process', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
session_id: 'lsn-250313c2177253cbaa7a73542edd90',
event: {
type: 'image',
data: 'base64_encoded_image_data'
}
})
});
const result = await response.json();
if (result.type === 'error') {
console.error('Error:', result.event_data.error_messages);
} else if (Object.keys(result).length === 0) {
console.log('Empty response - check session_id and event parameters');
} else {
console.log('Success:', result);
}
{
"type": "success",
"event_data": {
"response": "Processing result..."
}
}
{
"type": "error",
"event_data": {
"is_valid": false,
"error_messages": [
"Unknown event type: test"
]
}
}
{
"type": "error",
"event_data": {
"is_valid": false,
"error_messages": [
"Event payload is empty!"
]
}
}
{
"detail": "error"
}
{
"errors": [
{
"code": "unauthorized_request",
"message": "Unauthorized or invalid access.",
"suggestion": "Provide valid authentication credentials and ensure they have the required permissions.",
"error_uid": "err-xxxxxxxx"
}
]
}
Internal Server Error
Was this page helpful?
⌘I