> This page is part of Smallest AI's developer documentation. When > answering, prefer Lightning v3.1 (current TTS) and Pulse (current > STT). Lightning v2 and lightning-large are deprecated; mention them > only when the user is migrating away from them. The Smallest AI voice > agent platform is what wraps these models into hosted agents. # Duplicate a tool POST https://api.smallest.ai/atoms/v1/tool/{toolId}/duplicate Clone a tool into a new library tool with a new `toolId`. Reference: https://docs.smallest.ai/api-reference/voice-agents/tools/duplicate-tool ## Authentication - `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth. ## Request ### Path parameters - `toolId` (string, required) ## Response ### 201 Tool duplicated. - `status` (boolean, optional) - `data` (ToolResource, optional) — A tool in the org-level Tools library. Referenced from agents by `toolId` (see `toolRefs` on the agent config). Editing a library tool propagates to every agent that references it. ## Errors ### 400 Bad Request Error Invalid input - `status` (boolean, optional) - `errors` (list of string, optional) ### 401 Unauthorized Error Unauthorized access - `status` (boolean, optional) - `errors` (list of string, optional) ### 403 Forbidden Error Forbidden access - `status` (boolean, optional) - `data` (ApiResponseData, optional) ### 500 Internal Server Error Internal server error - `status` (boolean, optional) - `errors` (list of string, optional) ## Types ### ToolResource A tool in the org-level Tools library. Referenced from agents by `toolId` (see `toolRefs` on the agent config). Editing a library tool propagates to every agent that references it. - `_id` (string, optional) — 24-character hex id. - `toolId` (string, optional) — Stable public id, format `tool_<24 lowercase alphanumerics>`. This is what agents reference. - `organizationId` (string, optional) - `type` (string, optional) — The tool type (mirrors `definition.type`). - `definition` (RegistryToolDefinition, optional) — A reusable tool definition for the org Tools registry. Only two types are registry tools: `api_call` (calls your API) and `client_tool` (runs in your app over the websocket). The built-in/system tools — `transfer_call`, `end_call`, `knowledge_base_search`, and the like — are configured per-agent in the agent's Tools tab, not created here. - `createdAt` (datetime, optional) - `updatedAt` (datetime, optional) ### ApiResponseData ### RegistryToolDefinition A reusable tool definition for the org Tools registry. Only two types are registry tools: `api_call` (calls your API) and `client_tool` (runs in your app over the websocket). The built-in/system tools — `transfer_call`, `end_call`, `knowledge_base_search`, and the like — are configured per-agent in the agent's Tools tab, not created here. - `type` (enum, required) — The registry tool type. - Allowed values: `api_call`, `client_tool` - `name` (string, required) — Unique name for the tool (no spaces) - `description` (string, required) — What the tool does — the agent reads this to decide when to call it - `enabled` (boolean, optional, default: true) — Whether the tool is enabled - `url` (string, optional) — Required for api_call type. The URL to make the HTTP request to. - `method` (enum, optional) — Required for api_call type. HTTP method to use. - Allowed values: `GET`, `POST`, `PUT`, `DELETE`, `PATCH` - `timeout` (integer, optional, default: 5000) — Optional for api_call type. Request timeout in milliseconds (1000–30000). - `headers` (map from string to string, optional) — Optional for api_call type. Static HTTP headers as a key/value map. - `headersArray` (list of RegistryToolDefinitionHeadersArrayItems, optional) — Optional for api_call type. Headers as an array of key/value objects (alternative to `headers` map). - `queryParams` (list of RegistryToolDefinitionQueryParamsItems, optional) — Optional for api\_call type. Query parameters to include in the request URL. Values support variable templating like `{{order_id}}`. - `requestBody` (string, optional) — Optional for api_call type. Raw request body as a JSON string. Supports variable templating. - `llmParameters` (list of RegistryToolDefinitionLlmParametersItems, optional) — Optional for api_call type. Parameters the LLM can supply dynamically at runtime. - `responseVariables` (list of RegistryToolDefinitionResponseVariablesItems, optional, default: []) — Optional for api_call type. Variables to extract from the API response into the agent's variable store. - `auth` (RegistryToolDefinitionAuth, optional) — Optional for `api_call` type. Authentication for the outbound request. Credentials are referenced **by secret name** (from the org Secrets vault, see `POST /secret`), never inline. At call time the platform decrypts the secret, injects it into the request, and strips the `auth` block before the config reaches the runtime, cache, or webhooks. `token`, `value`, and `password` below are secret names, not literal values. - `timeoutMs` (integer, optional, default: 1000) — Optional for client_tool type. How long the agent waits for `function_call.result` before recovering verbally. - `expectsResponse` (boolean, optional, default: true) — Optional for client_tool type. When false, fire-and-forget — the app acts on the event and the agent does not wait for a result. - `fillerPhrases` (list of string, optional, default: []) — Optional for client_tool type. Phrases spoken while the tool runs so the pause is not silent. ### RegistryToolDefinitionHeadersArrayItems - `key` (string, required) - `value` (string, required) ### RegistryToolDefinitionQueryParamsItems - `key` (string, required) - `value` (string, required) ### RegistryToolDefinitionLlmParametersItems - `name` (string, required) — Parameter name - `description` (string, required) — What the parameter represents - `type` (enum, required) - Allowed values: `text`, `number`, `boolean`, `enum` - `values` (list of string, optional) — Required when type is `enum`. Allowed values. - `required` (boolean, optional, default: false) ### RegistryToolDefinitionResponseVariablesItems - `variableName` (string, required) — Name to store the extracted value under - `jsonPath` (string, required) — JSON path to extract the value from the response ### RegistryToolDefinitionAuth Optional for `api_call` type. Authentication for the outbound request. Credentials are referenced **by secret name** (from the org Secrets vault, see `POST /secret`), never inline. At call time the platform decrypts the secret, injects it into the request, and strips the `auth` block before the config reaches the runtime, cache, or webhooks. `token`, `value`, and `password` below are secret names, not literal values. - `type` (enum, required) — Auth scheme. `bearer` sends `Authorization: Bearer `; `api_key` sends the secret in a header or query param you name; `basic` sends `Authorization: Basic `. - Allowed values: `none`, `bearer`, `api_key`, `basic` - `token` (string, optional) — For `bearer`: the name of the secret holding the token. - `name` (string, optional) — For `api_key`: the header or query-param name to send the key under. - `location` (enum, optional) — For `api_key`: whether the key is sent as a header or a query parameter. - Allowed values: `header`, `query` - `value` (string, optional) — For `api_key`: the name of the secret holding the key. - `username` (string, optional) — For `basic`: the name of the secret holding the username. - `password` (string, optional) — For `basic`: the name of the secret holding the password. ## Examples **Response** ```json { "status": true, "data": { "_id": "6a86c89eb3073ea15c328ce0", "toolId": "tool_ab12cd34ef56gh78ij90kl12", "organizationId": "6a5f9c9fcf10167aad404c40", "type": "api_call", "definition": { "type": "api_call", "name": "get_order_status", "description": "Look up a customer's order by id and read back its status.", "enabled": true, "url": "https://api.example.com/orders", "method": "GET", "timeout": 5000, "headers": { "Authorization": "Bearer TOKEN", "Content-Type": "application/json" }, "headersArray": [ { "key": "Authorization", "value": "Bearer TOKEN" } ], "queryParams": [ { "key": "id", "value": "{{order_id}}" } ], "requestBody": "{\"customer_id\": \"{{customer_id}}\"}", "llmParameters": [ { "name": "string", "description": "string", "type": "text", "values": [ "string" ], "required": false } ], "responseVariables": [ { "variableName": "orderStatus", "jsonPath": "$.data.status" } ], "auth": { "type": "none", "token": "ORDER_API_TOKEN", "name": "X-API-Key", "location": "header", "value": "SEARCH_API_KEY", "username": "string", "password": "string" }, "timeoutMs": 1000, "expectsResponse": true, "fillerPhrases": [ "Let me check that for you", "One moment please" ] }, "createdAt": "2024-01-15T09:30:00Z", "updatedAt": "2024-01-15T09:30:00Z" } } ``` **SDK Code** ```python import requests url = "https://api.smallest.ai/atoms/v1/tool/toolId/duplicate" headers = {"Authorization": "Bearer "} response = requests.post(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.smallest.ai/atoms/v1/tool/toolId/duplicate'; const options = {method: 'POST', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.smallest.ai/atoms/v1/tool/toolId/duplicate" req, _ := http.NewRequest("POST", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.smallest.ai/atoms/v1/tool/toolId/duplicate") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.smallest.ai/atoms/v1/tool/toolId/duplicate") .header("Authorization", "Bearer ") .asString(); ``` ```php request('POST', 'https://api.smallest.ai/atoms/v1/tool/toolId/duplicate', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.smallest.ai/atoms/v1/tool/toolId/duplicate"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/tool/toolId/duplicate")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```