Core Methods
Register Agent and Plan
Registers a new AI agent along with a payment plan.
POST
/
agent
Register Agent and Plan
curl --request POST \
--url http://sandbox.mintlify.com/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentMetadata": {
"name": "<string>",
"tags": [
"<string>"
],
"dateCreated": "2023-11-07T05:31:56Z"
},
"agentApi": {
"endpoints": [
{}
]
},
"price": {},
"credits": {}
}
'import requests
url = "http://sandbox.mintlify.com/agent"
payload = {
"agentMetadata": {
"name": "<string>",
"tags": ["<string>"],
"dateCreated": "2023-11-07T05:31:56Z"
},
"agentApi": { "endpoints": [{}] },
"price": {},
"credits": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentMetadata: {name: '<string>', tags: ['<string>'], dateCreated: '2023-11-07T05:31:56Z'},
agentApi: {endpoints: [{}]},
price: {},
credits: {}
})
};
fetch('http://sandbox.mintlify.com/agent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://sandbox.mintlify.com/agent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agentMetadata' => [
'name' => '<string>',
'tags' => [
'<string>'
],
'dateCreated' => '2023-11-07T05:31:56Z'
],
'agentApi' => [
'endpoints' => [
[
]
]
],
'price' => [
],
'credits' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://sandbox.mintlify.com/agent"
payload := strings.NewReader("{\n \"agentMetadata\": {\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"dateCreated\": \"2023-11-07T05:31:56Z\"\n },\n \"agentApi\": {\n \"endpoints\": [\n {}\n ]\n },\n \"price\": {},\n \"credits\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://sandbox.mintlify.com/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentMetadata\": {\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"dateCreated\": \"2023-11-07T05:31:56Z\"\n },\n \"agentApi\": {\n \"endpoints\": [\n {}\n ]\n },\n \"price\": {},\n \"credits\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://sandbox.mintlify.com/agent")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentMetadata\": {\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"dateCreated\": \"2023-11-07T05:31:56Z\"\n },\n \"agentApi\": {\n \"endpoints\": [\n {}\n ]\n },\n \"price\": {},\n \"credits\": {}\n}"
response = http.request(request)
puts response.read_body{
"agentId": "<string>",
"planId": "<string>"
}{
"error": 123,
"message": "<string>"
}Registers a new AI agent along with a payment plan in a single transaction using the Nevermined Payments API.
This is the most common entrypoint for AI Builders looking to monetize their services immediately after deploying them.
Returns the unique identifiers of the newly created agent and the payment plan.
Example Usage
import { Payments } from '@nevermined-io/payments'
const payments = Payments.getInstance({
nvmApiKey: process.env.NVM_API_KEY,
environment: 'production'
})
const agentMetadata = {
name: 'Corporate Swiss Law assistant',
tags: ['legal', 'assistant'],
dateCreated: new Date('2024-12-31')
}
const agentApi = {
endpoints: [{ POST: 'https://example.com/api/query' }]
}
// Configure pricing - 10 USDC fixed price
const priceInUSDC = getERC20PriceConfig(10_000_000n, USDC_ERC20_ADDRESS, builderAddress)
// Configure credits - 100 credits with 5 credits per request
const fiveCreditsPerRequest = getFixedCreditsConfig(100n, 5n)
const { agentId, planId } = await payments.registerAgentAndPlan(
agentMetadata,
agentApi,
priceInUSDC,
fiveCreditsPerRequest
)
Parameters
agentMetadata: Metadata about the AI agent including name, tags, and creation date.agentApi: Defines the query endpoints the agent exposes.price: Configuration object describing cost, token type, and receiver(s).credits: Defines what the subscriber gets (number of credits, expiration, etc.).
Returns
{
agentId: string
planId: string
}
Notes
- You must initialize the
Paymentsclient before calling this method. - The plan will immediately be associated with the registered agent.
- All pricing and credit logic is enforced on-chain.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Agent and plan to register
Previous
Get AgentRetrieves information about a registered AI agent, including metadata and associated payment plans.
Next
⌘I
Register Agent and Plan
curl --request POST \
--url http://sandbox.mintlify.com/agent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentMetadata": {
"name": "<string>",
"tags": [
"<string>"
],
"dateCreated": "2023-11-07T05:31:56Z"
},
"agentApi": {
"endpoints": [
{}
]
},
"price": {},
"credits": {}
}
'import requests
url = "http://sandbox.mintlify.com/agent"
payload = {
"agentMetadata": {
"name": "<string>",
"tags": ["<string>"],
"dateCreated": "2023-11-07T05:31:56Z"
},
"agentApi": { "endpoints": [{}] },
"price": {},
"credits": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agentMetadata: {name: '<string>', tags: ['<string>'], dateCreated: '2023-11-07T05:31:56Z'},
agentApi: {endpoints: [{}]},
price: {},
credits: {}
})
};
fetch('http://sandbox.mintlify.com/agent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://sandbox.mintlify.com/agent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agentMetadata' => [
'name' => '<string>',
'tags' => [
'<string>'
],
'dateCreated' => '2023-11-07T05:31:56Z'
],
'agentApi' => [
'endpoints' => [
[
]
]
],
'price' => [
],
'credits' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://sandbox.mintlify.com/agent"
payload := strings.NewReader("{\n \"agentMetadata\": {\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"dateCreated\": \"2023-11-07T05:31:56Z\"\n },\n \"agentApi\": {\n \"endpoints\": [\n {}\n ]\n },\n \"price\": {},\n \"credits\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://sandbox.mintlify.com/agent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentMetadata\": {\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"dateCreated\": \"2023-11-07T05:31:56Z\"\n },\n \"agentApi\": {\n \"endpoints\": [\n {}\n ]\n },\n \"price\": {},\n \"credits\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://sandbox.mintlify.com/agent")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agentMetadata\": {\n \"name\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"dateCreated\": \"2023-11-07T05:31:56Z\"\n },\n \"agentApi\": {\n \"endpoints\": [\n {}\n ]\n },\n \"price\": {},\n \"credits\": {}\n}"
response = http.request(request)
puts response.read_body{
"agentId": "<string>",
"planId": "<string>"
}{
"error": 123,
"message": "<string>"
}