Management
Update an agent
Update an agent by its external identifier.
PATCH
/
v1
/
agents
/
{identifier}
PHP
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$updateAgentRequestDto = new Components\UpdateAgentRequestDto();
$response = $sdk->agents->update(
identifier: '<value>',
updateAgentRequestDto: $updateAgentRequestDto
);
if ($response->agentResponseDto !== null) {
// handle response
}from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.agents.update(identifier="<value>", update_agent_request_dto={
"behavior": {
"access_rule": {
"in": [
{
"var": "context.tenant.data.plan",
},
[
"pro",
"enterprise",
],
],
},
},
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Agents.Update(ctx, "<value>", components.UpdateAgentRequestDto{
Behavior: &components.AgentBehaviorDto{
AccessRule: map[string]any{
"in": []any{
map[string]any{
"var": "context.tenant.data.plan",
},
[]any{
"pro",
"enterprise",
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.AgentResponseDto != nil {
// handle response
}
}import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.agents.update({
behavior: {
accessRule: {
"in": [
{
"var": "context.tenant.data.plan",
},
[
"pro",
"enterprise",
],
],
},
},
}, "<value>");
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Agents.UpdateAsync(
identifier: "<value>",
updateAgentRequestDto: new UpdateAgentRequestDto() {
Behavior = new AgentBehaviorDto() {
AccessRule = new Dictionary<string, object>() {
{ "in", new List<object>() {
new Dictionary<string, object>() {
{ "var", "context.tenant.data.plan" },
},
new List<object>() {
"pro",
"enterprise",
},
} },
},
},
}
);
// handle responsecurl --request PATCH \
--url https://api.novu.co/v1/agents/{identifier} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"active": true,
"behavior": {
"acknowledgeOnReceived": true,
"reactionOnResolved": "check",
"accessRule": {
"in": [
{
"var": "context.tenant.data.plan"
},
[
"pro",
"enterprise"
]
]
},
"replyPolicy": "auto_reply"
},
"bridgeUrl": "<string>",
"devBridgeUrl": "<string>",
"devBridgeActive": true
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
active: true,
behavior: {
acknowledgeOnReceived: true,
reactionOnResolved: 'check',
accessRule: {in: [{var: 'context.tenant.data.plan'}, ['pro', 'enterprise']]},
replyPolicy: 'auto_reply'
},
bridgeUrl: '<string>',
devBridgeUrl: '<string>',
devBridgeActive: true
})
};
fetch('https://api.novu.co/v1/agents/{identifier}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.patch("https://api.novu.co/v1/agents/{identifier}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"behavior\": {\n \"acknowledgeOnReceived\": true,\n \"reactionOnResolved\": \"check\",\n \"accessRule\": {\n \"in\": [\n {\n \"var\": \"context.tenant.data.plan\"\n },\n [\n \"pro\",\n \"enterprise\"\n ]\n ]\n },\n \"replyPolicy\": \"auto_reply\"\n },\n \"bridgeUrl\": \"<string>\",\n \"devBridgeUrl\": \"<string>\",\n \"devBridgeActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/agents/{identifier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"behavior\": {\n \"acknowledgeOnReceived\": true,\n \"reactionOnResolved\": \"check\",\n \"accessRule\": {\n \"in\": [\n {\n \"var\": \"context.tenant.data.plan\"\n },\n [\n \"pro\",\n \"enterprise\"\n ]\n ]\n },\n \"replyPolicy\": \"auto_reply\"\n },\n \"bridgeUrl\": \"<string>\",\n \"devBridgeUrl\": \"<string>\",\n \"devBridgeActive\": true\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"name": "<string>",
"identifier": "<string>",
"behavior": {
"acknowledgeOnReceived": true,
"reactionOnResolved": "check",
"subscriberAccess": "open",
"accessRule": {
"in": [
{
"var": "context.tenant.data.plan"
},
[
"pro",
"enterprise"
]
]
},
"replyPolicy": "auto_reply"
},
"active": true,
"_environmentId": "<string>",
"_organizationId": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"description": "<string>",
"bridgeUrl": "<string>",
"devBridgeUrl": "<string>",
"devBridgeActive": true,
"runtime": "self-hosted",
"visibility": "public",
"managedRuntime": {
"providerId": "<string>",
"integrationId": "<string>",
"externalAgentId": "<string>",
"externalEnvironmentId": "<string>",
"externalWorkspaceId": "<string>",
"consoleUrl": "<string>",
"tools": [
{
"externalId": "<string>",
"name": "<string>",
"type": "builtin",
"description": "<string>"
}
],
"mcpServers": [
{
"externalId": "<string>",
"name": "<string>",
"url": "<string>"
}
],
"systemPrompt": "<string>"
},
"createdBy": "<string>",
"integrations": [
{
"integrationId": "<string>",
"providerId": "<string>",
"name": "<string>",
"identifier": "<string>",
"active": true,
"channel": "in_app"
}
],
"exceedsPlanLimit": true
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."Authorizations
Body
application/json
Response
OK
Cloud only. true when the agent falls outside the organization plan agent limit (by creation order among active agents — inactive agents do not consume slots). Only plan limits produce this flag — system-capped organizations (enterprise/unlimited tiers) are never over-limit. Over-limit agents are still stored but will not respond to inbound messages until the plan is upgraded or older agents are deactivated.
Was this page helpful?
⌘I
PHP
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$updateAgentRequestDto = new Components\UpdateAgentRequestDto();
$response = $sdk->agents->update(
identifier: '<value>',
updateAgentRequestDto: $updateAgentRequestDto
);
if ($response->agentResponseDto !== null) {
// handle response
}from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.agents.update(identifier="<value>", update_agent_request_dto={
"behavior": {
"access_rule": {
"in": [
{
"var": "context.tenant.data.plan",
},
[
"pro",
"enterprise",
],
],
},
},
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/components"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Agents.Update(ctx, "<value>", components.UpdateAgentRequestDto{
Behavior: &components.AgentBehaviorDto{
AccessRule: map[string]any{
"in": []any{
map[string]any{
"var": "context.tenant.data.plan",
},
[]any{
"pro",
"enterprise",
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
if res.AgentResponseDto != nil {
// handle response
}
}import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.agents.update({
behavior: {
accessRule: {
"in": [
{
"var": "context.tenant.data.plan",
},
[
"pro",
"enterprise",
],
],
},
},
}, "<value>");
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
var res = await sdk.Agents.UpdateAsync(
identifier: "<value>",
updateAgentRequestDto: new UpdateAgentRequestDto() {
Behavior = new AgentBehaviorDto() {
AccessRule = new Dictionary<string, object>() {
{ "in", new List<object>() {
new Dictionary<string, object>() {
{ "var", "context.tenant.data.plan" },
},
new List<object>() {
"pro",
"enterprise",
},
} },
},
},
}
);
// handle responsecurl --request PATCH \
--url https://api.novu.co/v1/agents/{identifier} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"active": true,
"behavior": {
"acknowledgeOnReceived": true,
"reactionOnResolved": "check",
"accessRule": {
"in": [
{
"var": "context.tenant.data.plan"
},
[
"pro",
"enterprise"
]
]
},
"replyPolicy": "auto_reply"
},
"bridgeUrl": "<string>",
"devBridgeUrl": "<string>",
"devBridgeActive": true
}
'const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
active: true,
behavior: {
acknowledgeOnReceived: true,
reactionOnResolved: 'check',
accessRule: {in: [{var: 'context.tenant.data.plan'}, ['pro', 'enterprise']]},
replyPolicy: 'auto_reply'
},
bridgeUrl: '<string>',
devBridgeUrl: '<string>',
devBridgeActive: true
})
};
fetch('https://api.novu.co/v1/agents/{identifier}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.patch("https://api.novu.co/v1/agents/{identifier}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"behavior\": {\n \"acknowledgeOnReceived\": true,\n \"reactionOnResolved\": \"check\",\n \"accessRule\": {\n \"in\": [\n {\n \"var\": \"context.tenant.data.plan\"\n },\n [\n \"pro\",\n \"enterprise\"\n ]\n ]\n },\n \"replyPolicy\": \"auto_reply\"\n },\n \"bridgeUrl\": \"<string>\",\n \"devBridgeUrl\": \"<string>\",\n \"devBridgeActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v1/agents/{identifier}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"active\": true,\n \"behavior\": {\n \"acknowledgeOnReceived\": true,\n \"reactionOnResolved\": \"check\",\n \"accessRule\": {\n \"in\": [\n {\n \"var\": \"context.tenant.data.plan\"\n },\n [\n \"pro\",\n \"enterprise\"\n ]\n ]\n },\n \"replyPolicy\": \"auto_reply\"\n },\n \"bridgeUrl\": \"<string>\",\n \"devBridgeUrl\": \"<string>\",\n \"devBridgeActive\": true\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"name": "<string>",
"identifier": "<string>",
"behavior": {
"acknowledgeOnReceived": true,
"reactionOnResolved": "check",
"subscriberAccess": "open",
"accessRule": {
"in": [
{
"var": "context.tenant.data.plan"
},
[
"pro",
"enterprise"
]
]
},
"replyPolicy": "auto_reply"
},
"active": true,
"_environmentId": "<string>",
"_organizationId": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>",
"description": "<string>",
"bridgeUrl": "<string>",
"devBridgeUrl": "<string>",
"devBridgeActive": true,
"runtime": "self-hosted",
"visibility": "public",
"managedRuntime": {
"providerId": "<string>",
"integrationId": "<string>",
"externalAgentId": "<string>",
"externalEnvironmentId": "<string>",
"externalWorkspaceId": "<string>",
"consoleUrl": "<string>",
"tools": [
{
"externalId": "<string>",
"name": "<string>",
"type": "builtin",
"description": "<string>"
}
],
"mcpServers": [
{
"externalId": "<string>",
"name": "<string>",
"url": "<string>"
}
],
"systemPrompt": "<string>"
},
"createdBy": "<string>",
"integrations": [
{
"integrationId": "<string>",
"providerId": "<string>",
"name": "<string>",
"identifier": "<string>",
"active": true,
"channel": "in_app"
}
],
"exceedsPlanLimit": true
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"fieldName1": {
"messages": [
"Field is required",
"Must be a valid email address"
],
"value": "invalidEmail"
},
"fieldName2": {
"messages": [
"Must be at least 18 years old"
],
"value": 17
},
"fieldName3": {
"messages": [
"Must be a boolean value"
],
"value": true
},
"fieldName4": {
"messages": [
"Must be a valid object"
],
"value": {
"key": "value"
}
},
"fieldName5": {
"messages": [
"Field is missing"
],
"value": null
},
"fieldName6": {
"messages": [
"Undefined value"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."