> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ortavox.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ortavox.ai/_mcp/server.

# Create a new tool

POST https://api.ortavox.ai/v1/tools
Content-Type: application/json

Create an end_call or API tool for agents to use

Reference: https://docs.ortavox.ai/api-reference/tools/create-a-new-tool

## Authentication

- `Authorization` header (bearer token, required) — Clerk JWT token or OrtaVox API key (sk_live_... or pk_live_...)
- `x-api-key` header (required) — OrtaVox API key (alternative to Bearer token)

## Servers

- `https://api.ortavox.ai` (Production server, default)
- `http://localhost:3000` (Local development server)

## Request

### Body (application/json)

This endpoint expects a CreateTool.

- `name` (string, required) — Tool name
- `type` (enum, required) — Tool type
  - Allowed values: `end_call`, `api`
- `description` (string, optional) — Tool description (optional, auto-generated if not provided)
- `url` (string, optional) — API endpoint URL (required for api type)
- `method` (enum, optional) — HTTP method (required for api type)
  - Allowed values: `GET`, `POST`, `PUT`, `DELETE`, `PATCH`
- `headers` (CreateToolHeaders, optional) — HTTP headers for api type
- `parameters` (CreateToolParameters, optional) — JSON Schema for tool parameters

## Response

### 201

Tool created successfully

- `data` (ToolResponseData, optional)

## Errors

### 400 Bad Request Error

Validation error

- `any`

## Types

### CreateToolHeaders

HTTP headers for api type

### CreateToolParameters

JSON Schema for tool parameters

- `type` (string, optional)
- `properties` (CreateToolParameters, optional) — JSON Schema for tool parameters
- `required` (list of string, optional)

### ToolResponseData

- `id` (string, optional)
- `type` (enum, optional)
  - Allowed values: `end_call`, `api`
- `createdAt` (datetime, optional)
- `updatedAt` (datetime, optional)
- `tool` (ToolResponseDataTool, optional)

### ToolResponseDataTool

- `type` (enum, optional)
  - Allowed values: `end_call`, `api`
- `name` (string, optional)
- `description` (string, optional)
- `parameters` (ToolResponseDataToolParameters, optional, nullable)
- `url` (string, optional, nullable)
- `method` (string, optional, nullable)
- `headers` (ToolResponseDataToolHeaders, optional, nullable)
- `goodbye_message` (string, optional, nullable)

### ToolResponseDataToolParameters

### ToolResponseDataToolHeaders

## Examples

**Request**

```json
{
  "name": "API request",
  "type": "api"
}
```

**Response**

```json
{
  "data": {
    "id": "string",
    "type": "end_call",
    "createdAt": "2024-01-15T09:30:00Z",
    "updatedAt": "2024-01-15T09:30:00Z",
    "tool": {
      "type": "end_call",
      "name": "string",
      "description": "string",
      "parameters": {},
      "url": "string",
      "method": "string",
      "headers": {},
      "goodbye_message": "string"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.ortavox.ai/v1/tools"

payload = {
    "name": "API request",
    "type": "api"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.ortavox.ai/v1/tools';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"API request","type":"api"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ortavox.ai/v1/tools"

	payload := strings.NewReader("{\n  \"name\": \"API request\",\n  \"type\": \"api\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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.ortavox.ai/v1/tools")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"API request\",\n  \"type\": \"api\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ortavox.ai/v1/tools")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"API request\",\n  \"type\": \"api\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.ortavox.ai/v1/tools', [
  'body' => '{
  "name": "API request",
  "type": "api"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.ortavox.ai/v1/tools");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"API request\",\n  \"type\": \"api\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "API request",
  "type": "api"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.ortavox.ai/v1/tools")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```