curl -X POST https://api.u1.archetypeai.app/v0.5/lens/register \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"lens_config": {
"lens_name": "My Test Lens"
}
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/register",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"lens_config": {
"lens_name": "My Test Lens"
}
}
)
data = response.json()
if data.get("is_valid") == False:
print(f"Error: {data.get('error_messages')}")
else:
print(f"Lens ID: {data['lens_id']}")
const response = await fetch(
"https://api.u1.archetypeai.app/v0.5/lens/register",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
lens_config: {
lens_name: "My Test Lens",
},
}),
}
);
const data = await response.json();
if (data.is_valid === false) {
console.error("Error:", data.error_messages);
} else {
console.log(`Lens ID: ${data.lens_id}`);
}
{
"lens_id": "lns-test-lens-176520-e7885b3f",
"lens_name": "My Test Lens",
"lens_status": "LENS_STATUS_MOUNTED",
"lens_modifiable": true,
"lens_config": {
"model_pipeline": [
{
"processor_name": "lens_noop_processor",
"processor_config": {}
}
]
}
}
{
"errors": [
{
"code": "invalid_json_payload",
"message": "Invalid JSON payload.",
"suggestion": "Ensure the request body contains valid JSON and is properly formatted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "missing_lens_name",
"message": "Missing required field: lens_name.",
"suggestion": "Include the 'lens_name' field in the request payload.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"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"
}
]
}
Lens API
Register Lens
Register a new lens configuration that can be used to create sessions
POST
/
lens
/
register
curl -X POST https://api.u1.archetypeai.app/v0.5/lens/register \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"lens_config": {
"lens_name": "My Test Lens"
}
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/register",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"lens_config": {
"lens_name": "My Test Lens"
}
}
)
data = response.json()
if data.get("is_valid") == False:
print(f"Error: {data.get('error_messages')}")
else:
print(f"Lens ID: {data['lens_id']}")
const response = await fetch(
"https://api.u1.archetypeai.app/v0.5/lens/register",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
lens_config: {
lens_name: "My Test Lens",
},
}),
}
);
const data = await response.json();
if (data.is_valid === false) {
console.error("Error:", data.error_messages);
} else {
console.log(`Lens ID: ${data.lens_id}`);
}
{
"lens_id": "lns-test-lens-176520-e7885b3f",
"lens_name": "My Test Lens",
"lens_status": "LENS_STATUS_MOUNTED",
"lens_modifiable": true,
"lens_config": {
"model_pipeline": [
{
"processor_name": "lens_noop_processor",
"processor_config": {}
}
]
}
}
{
"errors": [
{
"code": "invalid_json_payload",
"message": "Invalid JSON payload.",
"suggestion": "Ensure the request body contains valid JSON and is properly formatted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "missing_lens_name",
"message": "Missing required field: lens_name.",
"suggestion": "Include the 'lens_name' field in the request payload.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"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"
}
]
}
Requires version 1.1.5 or later of the Archetype platform.
Overview
Register a new lens by providing a configuration. The lens can be a minimal registration (just a name) or a full production lens with model pipeline and parameters.Request Body
object
required
Response
string
Unique identifier for the registered lens (format: “lns-…”)
string
Name of the registered lens
boolean
Whether the lens can be modified or deleted
string
Current status of the lens (“LENS_STATUS_MOUNTED” or “LENS_STATUS_REGISTERED”)
boolean
If
false, indicates an error occurred. Check error_messages for details.array
Array of error messages if registration failed
curl -X POST https://api.u1.archetypeai.app/v0.5/lens/register \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"lens_config": {
"lens_name": "My Test Lens"
}
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/register",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"lens_config": {
"lens_name": "My Test Lens"
}
}
)
data = response.json()
if data.get("is_valid") == False:
print(f"Error: {data.get('error_messages')}")
else:
print(f"Lens ID: {data['lens_id']}")
const response = await fetch(
"https://api.u1.archetypeai.app/v0.5/lens/register",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
lens_config: {
lens_name: "My Test Lens",
},
}),
}
);
const data = await response.json();
if (data.is_valid === false) {
console.error("Error:", data.error_messages);
} else {
console.log(`Lens ID: ${data.lens_id}`);
}
{
"lens_id": "lns-test-lens-176520-e7885b3f",
"lens_name": "My Test Lens",
"lens_status": "LENS_STATUS_MOUNTED",
"lens_modifiable": true,
"lens_config": {
"model_pipeline": [
{
"processor_name": "lens_noop_processor",
"processor_config": {}
}
]
}
}
{
"errors": [
{
"code": "invalid_json_payload",
"message": "Invalid JSON payload.",
"suggestion": "Ensure the request body contains valid JSON and is properly formatted.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "missing_lens_name",
"message": "Missing required field: lens_name.",
"suggestion": "Include the 'lens_name' field in the request payload.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"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"
}
]
}
Was this page helpful?
⌘I