Skip to main content
PATCH
/
ai-agents
/
agent-builder
/
api-tools
/
{slug}
Update API Tool
curl --request PATCH \
  --url https://{appId}.api-{region}.cometchat.io/v3/ai-agents/agent-builder/api-tools/{slug} \
  --header 'Content-Type: application/json' \
  --header 'apikey: <api-key>' \
  --data '
{
  "slug": "create_lead",
  "description": "When to use, preconditions, what it returns",
  "endpoint": "https://api.example.com/leads",
  "method": "POST",
  "enableBasicAuth": true,
  "basicAuthUsername": "username",
  "basicAuthPassword": "password",
  "headers": "{\"Content-Type\": \"application/json\", \"Authorization\": \"Bearer token\"}",
  "bodyTemplate": "{\"name\": \"{{name}}\", \"email\": \"{{email}}\"}",
  "allowAdditionalProperties": false,
  "parameters": [
    {
      "key": "email",
      "type": "string",
      "description": "Email of the lead",
      "required": false
    }
  ],
  "icon": "http://localhost:3001"
}
'
{
  "_id": "myapp_my-api-tool",
  "appId": "my-app-id",
  "slug": "my-api-tool",
  "name": "My API Tool",
  "description": "Calls an external API",
  "icon": "https://example.com/icon.png",
  "endpoint": "https://api.example.com/search",
  "method": "GET",
  "enableBasicAuth": false,
  "headers": "{\"Content-Type\":\"application/json\"}",
  "bodyTemplate": "{\"query\":\"{{query}}\"}",
  "allowAdditionalProperties": false,
  "parameters": [
    {
      "key": "query",
      "type": "string",
      "description": "The search query",
      "required": true
    }
  ],
  "tool": {
    "name": "my-api-tool",
    "description": "Calls an external API",
    "parameters": {
      "type": "object",
      "properties": {},
      "required": []
    }
  },
  "createdAt": 1700000000000,
  "updatedAt": 1700000000000
}

Documentation Index

Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

For the complete error reference, see Error Guide.

Authorizations

apikey
string
header
required

API Key (i.e. Rest API Key from the Dashboard).

Path Parameters

slug
string
required

Body

application/json
slug
string

Slug for the API tool (unique)

Example:

"create_lead"

description
string

Description of the API tool

Example:

"When to use, preconditions, what it returns"

endpoint
string

API endpoint URL

Example:

"https://api.example.com/leads"

method
enum<string>

HTTP method

Available options:
GET,
POST,
PUT,
PATCH,
DELETE
Example:

"POST"

enableBasicAuth
boolean

Whether to enable basic authentication

Example:

true

basicAuthUsername
string

Basic auth username (required if enableBasicAuth is true)

Example:

"username"

basicAuthPassword
string

Basic auth password (required if enableBasicAuth is true)

Example:

"password"

headers
string

HTTP headers as a JSON string (e.g., '{"Content-Type": "application/json", "Authorization": "Bearer token"}')

Example:

"{\"Content-Type\": \"application/json\", \"Authorization\": \"Bearer token\"}"

bodyTemplate
string

Body template for the API request

Example:

"{\"name\": \"{{name}}\", \"email\": \"{{email}}\"}"

allowAdditionalProperties
boolean
default:false

Whether to allow additional properties

Example:

false

parameters
object[]

Array of parameters for the API tool

icon
string

Icon for the API Tool

Example:

"http://localhost:3001"

Response

200 - application/json

API tool updated successfully

_id
string
Example:

"myapp_my-api-tool"

appId
string
Example:

"my-app-id"

slug
string
Example:

"my-api-tool"

name
string
Example:

"My API Tool"

description
string
Example:

"Calls an external API"

icon
string
Example:

"https://example.com/icon.png"

endpoint
string
Example:

"https://api.example.com/search"

method
string
Example:

"GET"

enableBasicAuth
boolean
Example:

false

headers
string | null
Example:

"{\"Content-Type\":\"application/json\"}"

bodyTemplate
string | null
Example:

"{\"query\":\"{{query}}\"}"

allowAdditionalProperties
boolean
Example:

false

parameters
object[]
tool
object
createdAt
number
Example:

1700000000000

updatedAt
number
Example:

1700000000000