Functions

Functions are reusable code blocks that perform specialized tasks. Agents or external calls can invoke these functions to automate complex operations effortlessly.

List functions

get

Retrieve all functions created on the platform. Functions can be linked to agents to enable specialized operations.

Responses
200
List of functions retrieved successfully.
application/json
get
GET /v1/functions HTTP/1.1
Host: api.aver.co
Accept: */*
[
  {
    "id": "function_abcde",
    "name": "analyzeMarket",
    "description": "Analyzes market data and returns insights.",
    "code": "function analyzeMarket(data) { /* ... */ }"
  }
]

Create a function

post

Add a new function that can be executed by an agent.

Body
namestringRequired
descriptionstringOptional
codestringOptional

Actual code for the function.

Responses
201
Function created successfully.
application/json
post
POST /v1/functions HTTP/1.1
Host: api.aver.co
Content-Type: application/json
Accept: */*
Content-Length: 50

{
  "name": "text",
  "description": "text",
  "code": "text"
}
{
  "id": "function_abcde",
  "name": "analyzeMarket",
  "description": "Analyzes market data and returns insights.",
  "code": "function analyzeMarket(data) { /* ... */ }"
}

Fetch function by ID

get

Retrieve details about a specific function, including its code, parameters, and usage statistics.

Path parameters
idstringRequired

The unique identifier of the function.

Responses
200
Function details retrieved successfully.
application/json
get
GET /v1/functions/{id} HTTP/1.1
Host: api.aver.co
Accept: */*
{
  "id": "function_abcde",
  "name": "analyzeMarket",
  "description": "Analyzes market data and returns insights.",
  "code": "function analyzeMarket(data) { /* ... */ }"
}

Update a function

patch

Edit the metadata or code of an existing function.

Path parameters
idstringRequired

The unique identifier of the function.

Body
descriptionstringOptional
codestringOptional
Responses
200
Function updated successfully.
application/json
patch
PATCH /v1/functions/{id} HTTP/1.1
Host: api.aver.co
Content-Type: application/json
Accept: */*
Content-Length: 36

{
  "description": "text",
  "code": "text"
}
{
  "id": "function_abcde",
  "name": "analyzeMarket",
  "description": "Analyzes market data and returns insights.",
  "code": "function analyzeMarket(data) { /* ... */ }"
}

Delete a function

delete

Remove a function by its unique identifier.

Path parameters
idstringRequired

The unique identifier of the function.

Responses
204
Function deleted successfully. No content in response.
delete
DELETE /v1/functions/{id} HTTP/1.1
Host: api.aver.co
Accept: */*

No content

Invoke a function directly

post

Execute the specified function without linking it to an agent. Useful for quick testing or external usage.

Path parameters
idstringRequired

The unique identifier of the function.

Body
inputDataobjectOptional

Input needed for the function.

Responses
200
Function invoked successfully.
application/json
post
POST /v1/functions/{id}/invoke HTTP/1.1
Host: api.aver.co
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "inputData": {}
}
{
  "result": {},
  "message": "Function executed successfully."
}

Last updated