Update API Tool Action
Used to update or create an API tool action that defines a specific operation or endpoint within an API tool. Actions represent individual API calls that AI agents can make.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/tools/api-action/{tool_id} |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/tools/api-action/tool_weather_api' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"actionId": "get_current_weather",
"name": "Get Current Weather",
"description": "Retrieves current weather conditions for a specified city",
"endpoint": "/weather",
"method": "GET",
"input_parameters": {
"city": {
"Name": "city",
"Type": "string",
"Description": "Name of the city to get weather for",
"Required": true,
"Location": "query",
"DefaultValue": null,
"EnumValues": null,
"MinValue": null,
"MaxValue": null,
"Pattern": null,
"Properties": null,
"Items": null
},
"units": {
"Name": "units",
"Type": "string",
"Description": "Temperature unit (metric or imperial)",
"Required": false,
"Location": "query",
"DefaultValue": "metric",
"EnumValues": ["metric", "imperial"],
"MinValue": null,
"MaxValue": null,
"Pattern": null,
"Properties": null,
"Items": null
}
},
"output_parameters": {
"temperature": {
"Name": "temperature",
"Type": "number",
"Description": "Current temperature",
"Required": true,
"Location": "body",
"DefaultValue": null,
"EnumValues": null,
"MinValue": null,
"MaxValue": null,
"Pattern": null,
"Properties": null,
"Items": null
},
"conditions": {
"Name": "conditions",
"Type": "string",
"Description": "Weather conditions description",
"Required": true,
"Location": "body",
"DefaultValue": null,
"EnumValues": null,
"MinValue": null,
"MaxValue": null,
"Pattern": null,
"Properties": null,
"Items": null
}
},
"project_key": "YOUR_PROJECT_KEY"
}'
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use application/json |
| Content-Type | application/json | Yes | Data type, must be application/json. |
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| tool_id | string | Yes | Unique identifier of the API tool to add/update the action for. |
Request Body
Request Body Schema
{
"actionId": "string",
"name": "string",
"description": "string",
"endpoint": "string",
"method": "string",
"input_parameters": {
"parameter_name": {
"Name": "string",
"Type": "string",
"Description": "string",
"Required": true,
"Location": "query",
"DefaultValue": "string",
"EnumValues": ["string"],
"MinValue": 0,
"MaxValue": 0,
"Pattern": "string",
"Properties": {},
"Items": "string"
}
},
"output_parameters": {
"parameter_name": {
"Name": "string",
"Type": "string",
"Description": "string",
"Required": true,
"Location": "body",
"DefaultValue": "string",
"EnumValues": ["string"],
"MinValue": 0,
"MaxValue": 0,
"Pattern": "string",
"Properties": {},
"Items": "string"
}
},
"project_key": "string"
}
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| actionId | string | No | Unique identifier for the action. If provided, updates existing action; otherwise creates new action. |
| name | string | Yes | Display name of the action. |
| description | string | Yes | Description of what the action does. |
| endpoint | string | Yes | API endpoint path (relative to the tool's base URL). |
| method | string | Yes | HTTP method (GET, POST, PUT, DELETE, PATCH). |
| input_parameters | object | No | Object defining input parameters for the action. |
| output_parameters | object | No | Object defining expected output/response parameters. |
| project_key | string | Yes | The project key for your project. |
Parameter Object Fields
Each parameter (input or output) is defined with the following fields:
| Field | Type | Description |
|---|---|---|
| Name | string | Parameter name. |
| Type | string | Data type (string, number, integer, boolean, object, array). |
| Description | string | Description of the parameter's purpose. |
| Required | boolean | Whether the parameter is required. |
| Location | string | Parameter location (query, path, header, body). |
| DefaultValue | string | Default value if parameter is not provided. |
| EnumValues | array | List of allowed values for the parameter. |
| MinValue | number | Minimum value (for numeric types). |
| MaxValue | number | Maximum value (for numeric types). |
| Pattern | string | Regex pattern for validation (for string types). |
| Properties | object | Nested properties (for object types). |
| Items | string | Item type specification (for array types). |
tip
Parameter Location Values
- query: URL query parameter (e.g.,
?city=London) - path: URL path parameter (e.g.,
/users/{userId}) - header: HTTP header (e.g.,
Authorization: Bearer token) - body: Request/response body
HTTP Methods
- GET: Retrieve data
- POST: Create new resource
- PUT: Update entire resource
- PATCH: Partially update resource
- DELETE: Remove resource
Response
Success Response (200 OK)
Returns an object containing the action creation/update status.
{
"is_success": true,
"item_id": "get_current_weather",
"detail": "API tool action created successfully",
"error": {}
}
Response Fields
| Field | Type | Description |
|---|---|---|
| is_success | boolean | Indicates whether the operation was successful. |
| item_id | string | Unique identifier of the created or updated action. |
| detail | string | Success or failure message with additional context. |
| error | object | Error details if the operation failed (empty if successful). |
Example Action Configurations
GET Request with Query Parameters
{
"actionId": "search_products",
"name": "Search Products",
"description": "Search for products by name or category",
"endpoint": "/products/search",
"method": "GET",
"input_parameters": {
"query": {
"Name": "query",
"Type": "string",
"Description": "Search query string",
"Required": true,
"Location": "query"
},
"category": {
"Name": "category",
"Type": "string",
"Description": "Product category filter",
"Required": false,
"Location": "query",
"EnumValues": ["electronics", "clothing", "books"]
},
"limit": {
"Name": "limit",
"Type": "integer",
"Description": "Maximum number of results",
"Required": false,
"Location": "query",
"DefaultValue": "10",
"MinValue": 1,
"MaxValue": 100
}
}
}
POST Request with Body Parameters
{
"actionId": "create_order",
"name": "Create Order",
"description": "Create a new order with specified items",
"endpoint": "/orders",
"method": "POST",
"input_parameters": {
"customer_id": {
"Name": "customer_id",
"Type": "string",
"Description": "Customer identifier",
"Required": true,
"Location": "body"
},
"items": {
"Name": "items",
"Type": "array",
"Description": "List of order items",
"Required": true,
"Location": "body",
"Items": "object"
},
"total_amount": {
"Name": "total_amount",
"Type": "number",
"Description": "Total order amount",
"Required": true,
"Location": "body",
"MinValue": 0
}
},
"output_parameters": {
"order_id": {
"Name": "order_id",
"Type": "string",
"Description": "Generated order ID",
"Required": true,
"Location": "body"
},
"status": {
"Name": "status",
"Type": "string",
"Description": "Order status",
"Required": true,
"Location": "body",
"EnumValues": ["pending", "confirmed", "processing"]
}
}
}
Error Response (422 Unprocessable Entity)
Returns validation error details when the request body is invalid.
{
"detail": [
{
"loc": [
"body",
"method"
],
"msg": "invalid HTTP method",
"type": "value_error.str.regex"
}
]
}
Error Response Fields
| Field | Type | Description |
|---|---|---|
| detail | array | Array of validation error objects. |
| loc | array | Location of the error in the request (e.g., path, body). |
| msg | string | Human-readable error message. |
| type | string | Error type identifier. |
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 200 | Successful Response | Success |
| 400 | Bad Request - Invalid action configuration | Bad Request |
| 404 | Not Found - Tool does not exist | Not Found |
| 422 | Validation Error - Invalid request parameters | Unprocessable Entity |
warning
Best Practices
- Provide clear, detailed descriptions for both actions and parameters
- Define all required parameters explicitly
- Use appropriate parameter types and validation (min/max values, patterns, enums)
- Document expected output structure in output_parameters
- Test actions thoroughly before deploying to production
- Consider authentication and authorization requirements
- Implement proper error handling for API failures