> ## Documentation Index
> Fetch the complete documentation index at: https://docs.archetypeai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Clone Lens

> Creates a copy of a lens template

## Overview

This endpoint creates a copy of a lens template, registering the lens and returning the new lens\_id.

Note that once a lens is cloned, any modifications to the original lens template will not be propagated to any cloned templates.

## Request

<ParamField body="lens_id" type="string" required>
  The lens ID to clone.
</ParamField>

## Response

<ResponseField name="lens_id" type="string">
  The ID of the new cloned lens.
</ResponseField>

<ResponseField name="lens_name" type="string">
  Name of the cloned lens.
</ResponseField>

<ResponseField name="lens_status" type="string">
  Status of the new lens.
</ResponseField>

<ResponseField name="lens_modifiable" type="boolean">
  Whether the cloned lens can be modified.
</ResponseField>

<ResponseField name="lens_config" type="object">
  Configuration of the cloned lens, including `origin_lens_id` reference.
</ResponseField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X POST https://api.u1.archetypeai.app/v0.5/lens/clone \
    -H "Authorization: Bearer $ATAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "lens_id": "lns-test-lens-93812264"
    }'
  ```

  ```python Python theme={"system"}
  import requests
  import os

  api_key = os.environ.get("ATAI_API_KEY")

  response = requests.post(
      "https://api.u1.archetypeai.app/v0.5/lens/clone",
      headers={
          "Authorization": f"Bearer {api_key}",
          "Content-Type": "application/json"
      },
      json={
          "lens_id": "lns-test-lens-93812264"
      }
  )

  data = response.json()

  # Check if clone was successful (should have lens_name)
  if data.get("lens_name"):
      print(f"Cloned lens ID: {data['lens_id']}")
  else:
      print("Clone may have failed - verify lens_id exists")
  ```

  ```javascript JavaScript theme={"system"}
  const response = await fetch('https://api.u1.archetypeai.app/v0.5/lens/clone', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.ATAI_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      lens_id: 'lns-test-lens-93812264'
    })
  });

  const data = await response.json();

  if (data.lens_name) {
    console.log(`Cloned lens ID: ${data.lens_id}`);
  } else {
    console.log('Clone may have failed - verify lens_id exists');
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={"system"}
  {
    "lens_id": "lns-test-lens-b2ba0058",
    "lens_name": "Test Lens",
    "lens_status": "LENS_STATUS_MOUNTED",
    "lens_modifiable": true,
    "lens_config": {
      "model_pipeline": [
        {
          "processor_name": "lens_noop_processor",
          "processor_config": {}
        }
      ],
      "origin_lens_id": "lns-test-lens-c55bdf3b"
    }
  }
  ```

  ```json 404 - Lens not found theme={"system"}
  {
    "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"
      }
    ]
  }
  ```

  ```json 422 - Missing required field: lens_id theme={"system"}
  {
    "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"
      }
    ]
  }
  ```

  ```json 401 - Unauthorized theme={"system"}
  {
    "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"
      }
    ]
  }
  ```
</ResponseExample>
