Create tool
Create a new tool for an assistant. The tool type must be available for the assistant's provider configuration.
Request
Authentication
Include your private API key in the request headers:
Authorization: Bearer YOUR_PRIVATE_API_KEY
Path Parameters
Request Body
WEB_SEARCH and CODE_INTERPRETER have no configurable settings — only the type field is needed.
fileSearchTool fields
imageGenerationTool fields
computerUseTool fields
Example request — web search
curl -X POST "https://superinterface.ai/api/cloud/assistants/{assistantId}/tools" \
-H "Authorization: Bearer YOUR_PRIVATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "type": "WEB_SEARCH" }'
Example request — code interpreter
curl -X POST "https://superinterface.ai/api/cloud/assistants/{assistantId}/tools" \
-H "Authorization: Bearer YOUR_PRIVATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "type": "CODE_INTERPRETER" }'
Example request — file search
curl -X POST "https://superinterface.ai/api/cloud/assistants/{assistantId}/tools" \
-H "Authorization: Bearer YOUR_PRIVATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "FILE_SEARCH",
"fileSearchTool": {
"vectorStoreIds": ["vs_abc123"],
"maxNumResults": 10
}
}'
Example request — image generation
curl -X POST "https://superinterface.ai/api/cloud/assistants/{assistantId}/tools" \
-H "Authorization: Bearer YOUR_PRIVATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "IMAGE_GENERATION",
"imageGenerationTool": {
"model": "gpt-image-1",
"quality": "HIGH",
"size": "SIZE_1024_1024",
"outputFormat": "PNG",
"background": "TRANSPARENT"
}
}'
Example request — computer use
curl -X POST "https://superinterface.ai/api/cloud/assistants/{assistantId}/tools" \
-H "Authorization: Bearer YOUR_PRIVATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "COMPUTER_USE",
"computerUseTool": {
"displayWidth": 1920,
"displayHeight": 1080,
"environment": "BROWSER"
}
}'
Response
Example response
{
"tool": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"type": "IMAGE_GENERATION",
"imageGenerationTool": {
"model": "gpt-image-1",
"quality": "HIGH",
"size": "SIZE_1024_1024",
"outputFormat": "PNG",
"background": "TRANSPARENT",
"partialImages": 0
},
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
}
}
Errors
The endpoint may return the following errors:
400 Bad Request — tool not available
This error occurs when the tool type is not supported for the assistant's provider configuration.
{
"error": "Tool type IMAGE_GENERATION is not available for this assistant's provider configuration"
}
401 Unauthorized
This error occurs if the API key is invalid or missing.
{
"error": "Unauthorized",
"message": "Invalid or missing API key"
}