LogoLogo
Go to website
  • Getting Started
    • Introduction
    • Vision & Milestones
  • Aver Protocol
    • Drag & Drop AI Agent Builder
    • Architecture
    • Use Cases
    • Tokenize & Launch Your Agents
    • Roadmap
    • Tokenomics
  • API REFERENCE
    • Agents
    • Strategies
    • Functions
Powered by GitBook
On this page
  1. API REFERENCE

Functions

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

PreviousStrategies

Last updated 5 months ago

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
404
Function not found.
500
Server error while fetching function details.
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) { /* ... */ }"
}

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.
404
Function not found.
500
Server error while deleting the function.
delete
DELETE /v1/functions/{id} HTTP/1.1
Host: api.aver.co
Accept: */*

No content

  • GETList functions
  • POSTCreate a function
  • GETFetch function by ID
  • PATCHUpdate a function
  • DELETEDelete a function
  • POSTInvoke a function directly

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
500
Server error while listing functions.
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
400
Invalid function data.
500
Server error while creating the function.
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) { /* ... */ }"
}

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
400
Invalid update payload.
404
Function not found.
500
Server error while updating the function.
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) { /* ... */ }"
}

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
400
Invalid input data.
404
Function not found.
500
Server error while invoking the function.
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."
}