Skip to main content
POST
/
tools
/
Create OpenAPI Tool
curl --request POST \
  --url https://agent-prod.studio.lyzr.ai/v3/tools/ \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "tool_set_name": "<string>",
  "openapi_schema": {},
  "default_headers": {},
  "default_query_params": {},
  "default_body_params": {},
  "endpoint_defaults": {},
  "enhance_descriptions": true,
  "openai_api_key": "<string>"
}
'
import requests

url = "https://agent-prod.studio.lyzr.ai/v3/tools/"

payload = {
"tool_set_name": "<string>",
"openapi_schema": {},
"default_headers": {},
"default_query_params": {},
"default_body_params": {},
"endpoint_defaults": {},
"enhance_descriptions": True,
"openai_api_key": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tool_set_name: '<string>',
openapi_schema: {},
default_headers: {},
default_query_params: {},
default_body_params: {},
endpoint_defaults: {},
enhance_descriptions: true,
openai_api_key: '<string>'
})
};

fetch('https://agent-prod.studio.lyzr.ai/v3/tools/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://agent-prod.studio.lyzr.ai/v3/tools/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'tool_set_name' => '<string>',
'openapi_schema' => [

],
'default_headers' => [

],
'default_query_params' => [

],
'default_body_params' => [

],
'endpoint_defaults' => [

],
'enhance_descriptions' => true,
'openai_api_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://agent-prod.studio.lyzr.ai/v3/tools/"

payload := strings.NewReader("{\n \"tool_set_name\": \"<string>\",\n \"openapi_schema\": {},\n \"default_headers\": {},\n \"default_query_params\": {},\n \"default_body_params\": {},\n \"endpoint_defaults\": {},\n \"enhance_descriptions\": true,\n \"openai_api_key\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://agent-prod.studio.lyzr.ai/v3/tools/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"tool_set_name\": \"<string>\",\n \"openapi_schema\": {},\n \"default_headers\": {},\n \"default_query_params\": {},\n \"default_body_params\": {},\n \"endpoint_defaults\": {},\n \"enhance_descriptions\": true,\n \"openai_api_key\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://agent-prod.studio.lyzr.ai/v3/tools/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tool_set_name\": \"<string>\",\n \"openapi_schema\": {},\n \"default_headers\": {},\n \"default_query_params\": {},\n \"default_body_params\": {},\n \"endpoint_defaults\": {},\n \"enhance_descriptions\": true,\n \"openai_api_key\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "tool_ids": [
    "<string>"
  ]
}

Endpoint

POST /v3/tools/

Description

Creates a new tool using an OpenAPI schema with custom configurations.

Authentication

API Key (x-api-key) in the header.

Request Parameters

ParameterTypeDescription
tool_set_nameStringName for the tool set (prefixed with openapi-).
openapi_schemaObjectOpenAPI schema for tool definition.
default_headersObjectOptional default headers for requests.
default_query_paramsObjectOptional default query parameters.
default_body_paramsObjectOptional default body parameters.
endpoint_defaultsObjectOptional endpoint-specific default parameters.
enhance_descriptionsBooleanWhether to enhance descriptions using OpenAI.
openai_api_keyStringOpenAI API key (if enhancement is enabled).

Request Example

{
  "tool_set_name": "hello",
  "openapi_schema": {
    "openapi": "3.0.0",
    "info": {
      "title": "Sample API",
      "version": "1.0.0",
      "description": "A sample API specification"
    },
    "servers": [
      {
        "url": "https://api.example.com/v1",
        "description": "Production server"
      }
    ]
  },
  "default_headers": {
    "Content-Type": "application/json"
  },
  "enhance_descriptions": true,
  "openai_api_key": "YOUR_OPENAI_API_KEY"
}

Curl Request

curl -X POST "https://agent-prod.studio.lyzr.ai/v3/tools/" ^
-H "accept: application/json" ^
-H "content-type: application/json" ^
-H "x-api-key: sk-default-REDACTED" ^
-d '{"tool_set_name":"string","openapi_schema":{},"default_headers":{},"default_query_params":{},"default_body_params":{},"endpoint_defaults":{},"enhance_descriptions":false,"openai_api_key":null}'

Response

Returns tool IDs for the created tools.

Authorizations

x-api-key
string
header
required

Body

application/json
tool_set_name
string

Name for the tool set (prefixed with openapi-).

openapi_schema
object

OpenAPI schema for tool definition.

default_headers
object

Optional default headers for requests.

default_query_params
object

Optional default query parameters.

default_body_params
object

Optional default body parameters.

endpoint_defaults
object

Optional endpoint-specific default parameters.

enhance_descriptions
boolean

Whether to enhance descriptions using OpenAI.

openai_api_key
string | null

OpenAI API key (if enhancement is enabled).

Response

Tools created successfully

tool_ids
string[]