curl -X POST https://api.u1.archetypeai.app/v0.5/lens/modify \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name"
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/modify",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name"
}
)
result = response.json()
if result.get("lens_name"):
print(f"Lens modified: {result['lens_id']}")
else:
print("Modification may have failed")
const response = await fetch(
"https://api.u1.archetypeai.app/v0.5/lens/modify",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
lens_id: "lns-test-lens-b2ba0058",
lens_name: "Updated Lens Name",
}),
}
);
const result = await response.json();
if (result.lens_name) {
console.log(`Lens modified: ${result.lens_id}`);
} else {
console.log("Modification may have failed");
}
{
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name",
"lens_status": "LENS_STATUS_MOUNTED",
"lens_modifiable": true,
"lens_config": {
"model_pipeline": [
{
"processor_name": "lens_noop_processor",
"processor_config": {}
}
]
}
}
{
"errors": [
{
"code": "missing_lens_id",
"message": "Missing required field: lens_id.",
"suggestion": "Include the 'lens_id' field in the request payload.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "lens_not_found",
"message": "The specified lens was not found.",
"suggestion": "Verify the lens identifier and ensure it exists before retrying.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "lens_not_modifiable",
"message": "The specified lens is non-modifiable.",
"suggestion": "Check whether the lens is modifiable before attempting modifications.",
"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
Modify Lens
Modifies an existing lens template
POST
/
lens
/
modify
curl -X POST https://api.u1.archetypeai.app/v0.5/lens/modify \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name"
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/modify",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name"
}
)
result = response.json()
if result.get("lens_name"):
print(f"Lens modified: {result['lens_id']}")
else:
print("Modification may have failed")
const response = await fetch(
"https://api.u1.archetypeai.app/v0.5/lens/modify",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
lens_id: "lns-test-lens-b2ba0058",
lens_name: "Updated Lens Name",
}),
}
);
const result = await response.json();
if (result.lens_name) {
console.log(`Lens modified: ${result.lens_id}`);
} else {
console.log("Modification may have failed");
}
{
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name",
"lens_status": "LENS_STATUS_MOUNTED",
"lens_modifiable": true,
"lens_config": {
"model_pipeline": [
{
"processor_name": "lens_noop_processor",
"processor_config": {}
}
]
}
}
{
"errors": [
{
"code": "missing_lens_id",
"message": "Missing required field: lens_id.",
"suggestion": "Include the 'lens_id' field in the request payload.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "lens_not_found",
"message": "The specified lens was not found.",
"suggestion": "Verify the lens identifier and ensure it exists before retrying.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "lens_not_modifiable",
"message": "The specified lens is non-modifiable.",
"suggestion": "Check whether the lens is modifiable before attempting modifications.",
"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
This endpoint modifies an existing lens template, overwriting any previous settings of that template. Only lens templates that are modifiable can be modified. Developers can check if a lens template is modifiable via the/lens/metadata API (look for lens_modifiable: true).
Request Body
string
required
The ID of the lens to modify (must be a modifiable lens)
string
Updated name for the lens
object
Response
string
ID of the modified lens
string
Updated name of the lens
boolean
Whether the lens can be further modified
string
Current status of the lens
object
Updated lens configuration
curl -X POST https://api.u1.archetypeai.app/v0.5/lens/modify \
-H "Authorization: Bearer $ATAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name"
}'
import requests
import os
api_key = os.environ.get("ATAI_API_KEY")
response = requests.post(
"https://api.u1.archetypeai.app/v0.5/lens/modify",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name"
}
)
result = response.json()
if result.get("lens_name"):
print(f"Lens modified: {result['lens_id']}")
else:
print("Modification may have failed")
const response = await fetch(
"https://api.u1.archetypeai.app/v0.5/lens/modify",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ATAI_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
lens_id: "lns-test-lens-b2ba0058",
lens_name: "Updated Lens Name",
}),
}
);
const result = await response.json();
if (result.lens_name) {
console.log(`Lens modified: ${result.lens_id}`);
} else {
console.log("Modification may have failed");
}
{
"lens_id": "lns-test-lens-b2ba0058",
"lens_name": "Updated Lens Name",
"lens_status": "LENS_STATUS_MOUNTED",
"lens_modifiable": true,
"lens_config": {
"model_pipeline": [
{
"processor_name": "lens_noop_processor",
"processor_config": {}
}
]
}
}
{
"errors": [
{
"code": "missing_lens_id",
"message": "Missing required field: lens_id.",
"suggestion": "Include the 'lens_id' field in the request payload.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "lens_not_found",
"message": "The specified lens was not found.",
"suggestion": "Verify the lens identifier and ensure it exists before retrying.",
"error_uid": "err-xxxxxxxx"
}
]
}
{
"errors": [
{
"code": "lens_not_modifiable",
"message": "The specified lens is non-modifiable.",
"suggestion": "Check whether the lens is modifiable before attempting modifications.",
"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