Skip to main content

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

PropertyValue
Request MethodPOST
Request URLhttps://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

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use application/json
Content-Typeapplication/jsonYesData type, must be application/json.

Path Parameters

FieldTypeRequiredDescription
tool_idstringYesUnique 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

FieldTypeRequiredDescription
actionIdstringNoUnique identifier for the action. If provided, updates existing action; otherwise creates new action.
namestringYesDisplay name of the action.
descriptionstringYesDescription of what the action does.
endpointstringYesAPI endpoint path (relative to the tool's base URL).
methodstringYesHTTP method (GET, POST, PUT, DELETE, PATCH).
input_parametersobjectNoObject defining input parameters for the action.
output_parametersobjectNoObject defining expected output/response parameters.
project_keystringYesThe project key for your project.

Parameter Object Fields

Each parameter (input or output) is defined with the following fields:

FieldTypeDescription
NamestringParameter name.
TypestringData type (string, number, integer, boolean, object, array).
DescriptionstringDescription of the parameter's purpose.
RequiredbooleanWhether the parameter is required.
LocationstringParameter location (query, path, header, body).
DefaultValuestringDefault value if parameter is not provided.
EnumValuesarrayList of allowed values for the parameter.
MinValuenumberMinimum value (for numeric types).
MaxValuenumberMaximum value (for numeric types).
PatternstringRegex pattern for validation (for string types).
PropertiesobjectNested properties (for object types).
ItemsstringItem 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

FieldTypeDescription
is_successbooleanIndicates whether the operation was successful.
item_idstringUnique identifier of the created or updated action.
detailstringSuccess or failure message with additional context.
errorobjectError 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

FieldTypeDescription
detailarrayArray of validation error objects.
locarrayLocation of the error in the request (e.g., path, body).
msgstringHuman-readable error message.
typestringError type identifier.

Error Codes

Status CodeDescriptionResponse Type
200Successful ResponseSuccess
400Bad Request - Invalid action configurationBad Request
404Not Found - Tool does not existNot Found
422Validation Error - Invalid request parametersUnprocessable 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