package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go"
"github.com/AhaSend/ahasend-go/api"
"github.com/AhaSend/ahasend-go/models/requests"
"github.com/google/uuid"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
accountID := uuid.New()
// Create context for the API call
ctx := context.Background()
// Call the ping endpoint
response, httpResp, err := client.RoutesAPI.UpdateRoute(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
requests.UpdateRouteRequest{
Name: ahasend.String("Updated Name"),
URL: ahasend.String("https://mystartup.com/new-tickets"),
},
)
if err != nil {
log.Fatalf("Error updating route: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Updated route: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const routeId = "00000000-0000-4000-8000-000000000006";
const route = await client.routes.update(routeId, {
url: "https://example.com/inbound-v2",
});
console.log("Route updated.", { id: route.id, name: route.name });
curl --request PUT \
--url https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Support Route",
"enabled": false
}
'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}"
payload = {
"name": "Updated Support Route",
"enabled": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Support Route',
'enabled' => false
]),
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;
}HttpResponse<String> response = Unirest.put("https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Support Route\",\n \"enabled\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Support Route\",\n \"enabled\": false\n}"
response = http.request(request)
puts response.read_body{
"object": "route",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"url": "<string>",
"recipient": "<string>",
"attachments": true,
"headers": true,
"group_by_message_id": true,
"strip_replies": true,
"enabled": true,
"success_count": 1,
"error_count": 1,
"errors_since_last_success": 1,
"last_request_at": "2023-11-07T05:31:56Z"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Update Route
Updates an existing route. A domain-scoped key must authorize the
existing recipient domain and, when recipient changes, the new domain;
routes:write:all satisfies both checks.
package main
import (
"context"
"fmt"
"log"
"github.com/AhaSend/ahasend-go"
"github.com/AhaSend/ahasend-go/api"
"github.com/AhaSend/ahasend-go/models/requests"
"github.com/google/uuid"
)
func main() {
// Create API client with authentication
client := api.NewAPIClient(
api.WithAPIKey("aha-sk-your-64-character-key"),
)
accountID := uuid.New()
// Create context for the API call
ctx := context.Background()
// Call the ping endpoint
response, httpResp, err := client.RoutesAPI.UpdateRoute(
ctx,
accountID,
uuid.MustParse("c5a32c40-b351-439f-8230-779daed3e42c"),
requests.UpdateRouteRequest{
Name: ahasend.String("Updated Name"),
URL: ahasend.String("https://mystartup.com/new-tickets"),
},
)
if err != nil {
log.Fatalf("Error updating route: %v", err)
}
// Check response
if httpResp.StatusCode == 200 {
fmt.Printf("✅ Status: %d\n", httpResp.StatusCode)
if response != nil {
fmt.Printf("Updated route: %#v\n", response)
}
} else {
fmt.Printf("❌ Unexpected status code: %d\n", httpResp.StatusCode)
}
}
import { AhaSendClient } from "@ahasend/sdk";
const client = AhaSendClient.fromEnv();
const routeId = "00000000-0000-4000-8000-000000000006";
const route = await client.routes.update(routeId, {
url: "https://example.com/inbound-v2",
});
console.log("Route updated.", { id: route.id, name: route.name });
curl --request PUT \
--url https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Updated Support Route",
"enabled": false
}
'import requests
url = "https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}"
payload = {
"name": "Updated Support Route",
"enabled": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Updated Support Route',
'enabled' => false
]),
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;
}HttpResponse<String> response = Unirest.put("https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Updated Support Route\",\n \"enabled\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ahasend.com/v2/accounts/{account_id}/routes/{route_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Updated Support Route\",\n \"enabled\": false\n}"
response = http.request(request)
puts response.read_body{
"object": "route",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"name": "<string>",
"url": "<string>",
"recipient": "<string>",
"attachments": true,
"headers": true,
"group_by_message_id": true,
"strip_replies": true,
"enabled": true,
"success_count": 1,
"error_count": 1,
"errors_since_last_success": 1,
"last_request_at": "2023-11-07T05:31:56Z"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}{
"message": "Error message"
}Authorizations
API key for authentication. Non-empty Security Requirement values are AhaSend API-key roles. Roles listed within one requirement object are jointly required; separate requirement objects are alternatives.
Body
Route name
255Webhook URL for the route
Recipient filter
255Whether to include attachments in webhooks
Whether to include headers in webhooks
Whether to group by message ID
Whether to strip reply content
Whether the route is enabled
Response
Route updated successfully
Object type identifier
route Unique identifier for the route
When the route was created
When the route was last updated
Route name
Webhook URL for the route
Recipient filter; an empty string means no recipient filter
Whether to include attachments in route payload
Whether to include headers in route payload
Whether to group by message ID
Whether to strip reply content
Whether the route is enabled
Number of successful calls
x >= 0Number of unsuccessful calls
x >= 0Number of consecutive failed calls. Reset to zero by the next successful call.
x >= 0When the route was last called

