Desviar a extensión existente
Consultar, modificar y eliminar desvíos y obtener credenciales SIP exclusivas.
PATCH /api/v1/dids/1234/forwardingPermiso: forwarding:write
Permisos requeridos
forwarding:write
Indique sipAccountId de la extensión existente autorizada (entero 1–2147483647). Reemplaza el desvío sin crear extensión ni devolver contraseña. sipAccountId no es didId ni usuario SIP. Las credenciales requieren su endpoint y validación de elegibilidad.
Cuando una cuenta está en revisión de seguridad, las consultas y operaciones se bloquean con HTTP 403 y código account_security_review, incluso con tokens emitidos previamente. No intente eludir la restricción ni repetir automáticamente. El acceso se restablece después de la liberación administrativa; se mantienen los demás límites y restricciones. Los webhooks pendientes y los eventos del período se suprimen sin reenvío automático. La facturación y los vencimientos siguen las reglas existentes. Siga la revisión en https://novodid.com/seguranca/atendimento. Solo el ticket vinculado a la revisión permite lectura, respuestas y archivos adjuntos en el sitio autenticado. Los demás tickets y la API pública continúan bloqueados. El cliente debe esperar el primer mensaje del equipo y puede enviar una sola respuesta por cada nuevo mensaje del soporte, incluidos los archivos solicitados.
Cuerpo de la solicitud
{
"type": "sip",
"sipAccountId": 5678
}Respuesta exitosa (200)
{
"didId": 1234,
"number": "5511999999999",
"forwarding": null
}Ejemplo de error
{
"error": {
"code": "insufficient_scope",
"message": "Token sem permissão para esta operação."
}
}curl
curl -X PATCH \
-H "Authorization: Bearer $NOVODID_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"type":"sip","sipAccountId":5678}' \
"https://novodid.com/api/v1/dids/1234/forwarding"Node
const response = await fetch("https://novodid.com/api/v1/dids/1234/forwarding", {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.NOVODID_API_TOKEN}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"type": "sip",
"sipAccountId": 5678
})
});
const payload = await response.json();
if (!response.ok) {
throw new Error(payload.error?.message || "Erro na API NovoDID");
}
console.log({ status: response.status });Python
import os
import requests
response = requests.patch(
"https://novodid.com/api/v1/dids/1234/forwarding",
headers={"Authorization": f"Bearer {os.environ['NOVODID_API_TOKEN']}"},
json={
"type": "sip",
"sipAccountId": 5678
},
timeout=30,
)
payload = response.json()
response.raise_for_status()
print({"status": response.status_code})Go
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
req, err := http.NewRequest("PATCH", "https://novodid.com/api/v1/dids/1234/forwarding", strings.NewReader(`{"type":"sip","sipAccountId":5678}`))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("NOVODID_API_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
_, _ = io.Copy(io.Discard, res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("NovoDID API HTTP %d", res.StatusCode))
}
fmt.Println(res.StatusCode)
}Rust
use serde_json::json;
use reqwest::blocking::Client;
use std::env;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let response = client
.patch("https://novodid.com/api/v1/dids/1234/forwarding")
.bearer_auth(env::var("NOVODID_API_TOKEN")?)
.json(&json!({
"type": "sip",
"sipAccountId": 5678
}))
.send()?;
let status = response.status();
let _payload = response.text()?;
if !status.is_success() {
return Err(format!("NovoDID API HTTP {}", status).into());
}
println!("HTTP {}", status);
Ok(())
}PHP
<?php
$ch = curl_init("https://novodid.com/api/v1/dids/1234/forwarding");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("NOVODID_API_TOKEN"),
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => '{"type":"sip","sipAccountId":5678}',
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response === false || $status >= 300) {
throw new RuntimeException("NovoDID API HTTP " . $status);
}
echo $status . PHP_EOL;Ruby
require "net/http"
uri = URI("https://novodid.com/api/v1/dids/1234/forwarding")
request = Net::HTTP::Patch.new(uri)
request["Authorization"] = "Bearer #{ENV.fetch("NOVODID_API_TOKEN")}"
request["Content-Type"] = "application/json"
request.body = %q({"type":"sip","sipAccountId":5678})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
raise "NovoDID API HTTP #{response.code}" unless response.is_a?(Net::HTTPSuccess)
puts response.codeC#
using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Patch, "https://novodid.com/api/v1/dids/1234/forwarding");
request.Headers.Authorization = new AuthenticationHeaderValue(
"Bearer",
Environment.GetEnvironmentVariable("NOVODID_API_TOKEN")
);
request.Content = new StringContent(
"""
{
"type": "sip",
"sipAccountId": 5678
}
""",
Encoding.UTF8,
"application/json"
);
using var response = await client.SendAsync(request);
var payload = await response.Content.ReadAsStringAsync();
response.EnsureSuccessStatusCode();
Console.WriteLine(response.StatusCode);
