Asociaciones de numeración
Las operaciones de Asociaciones de numeración de la API de Trevol: parámetros, cuerpo, respuestas y ejemplos de código.
Los rangos de numeración de la empresa (los de Trevol y lo que muestra el portal de la DIAN), asociar a Trevol uno que ya tiene y pedir uno nuevo a la DIAN (formulario 1302), con su seguimiento.
Los ejemplos de código salen de los SDK reales. La llave va en TREVOL_API_KEY; los cuerpos de ejemplo son los de la especificación. Los errores comunes están en Errores.
Una asociación de numeración
GET /v1/numbering_associations/{id} · retrieveNumberingAssociation
Cómo va una asociación (también una hecha en la app): pending, running, succeeded o failed, con error.code y un texto fijo si falló (nunca el mensaje del portal).
Respuestas
| Estado | Qué pasó |
|---|---|
| 200 | La asociación (NumberingAssociation) |
| 404 | Error (application/problem+json) (Problem) |
| Error | Error (application/problem+json) (Problem) |
GET /v1/numbering_associations/{id}
curl "https://api.trevol.si/v1/numbering_associations/nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b" \
-H "Authorization: Bearer $TREVOL_API_KEY"import { Trevol } from '@trevol/sdk';
const trevol = new Trevol(); // lee TREVOL_API_KEY
const resultado = await trevol.numberingAssociations.retrieveNumberingAssociation({
id: 'nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b'
});
console.log(resultado);from trevol import Trevol
trevol = Trevol() # lee TREVOL_API_KEY
resultado = trevol.numbering_associations.retrieve_numbering_association(
id="nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b",
)
print(resultado)<?php
use Trevol\Trevol;
require __DIR__ . '/vendor/autoload.php';
$trevol = new Trevol(getenv('TREVOL_API_KEY')); // tvl_test_… → $trevol->environment === 'test'
$resultado = $trevol->numberingAssociations->retrieveNumberingAssociation(
id: 'nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b',
);
echo $resultado, PHP_EOL;
import si.trevol.Trevol;
public class Ejemplo {
public static void main(String[] args) throws Exception {
Trevol trevol = Trevol.builder().apiKey(System.getenv("TREVOL_API_KEY")).build(); // tvl_test_… → trevol.environment() == TEST
var resultado = trevol.numberingAssociations().retrieveNumberingAssociation("nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b").execute();
System.out.println(resultado);
}
}
using System;
using System.Threading.Tasks;
using Trevol;
public static class Ejemplo
{
public static async Task Main()
{
var trevol = new TrevolClient(Environment.GetEnvironmentVariable("TREVOL_API_KEY")); // tvl_test_… → trevol.Environment == TrevolEnvironment.Test
var resultado = await trevol.NumberingAssociations.RetrieveNumberingAssociationAsync(id: "nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b");
Console.WriteLine(TrevolJson.Serialize(resultado));
}
}
package main
import (
"context"
"fmt"
"log"
"os"
trevol "github.com/trevol-si/trevol-go"
)
func main() {
ctx := context.Background()
c, err := trevol.NewClient(os.Getenv("TREVOL_API_KEY"))
if err != nil {
log.Fatal(err)
}
resultado, _, err := c.NumberingAssociationsAPI.RetrieveNumberingAssociation(ctx, "nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b").Execute()
if err != nil {
log.Fatal(err)
}
fmt.Println(resultado)
}
require 'trevol'
trevol = Trevol::Client.new # lee TREVOL_API_KEY
resultado = trevol.numbering_associations.retrieve_numbering_association(
'nas_3f0c1a2b3f0c1a2b3f0c1a2b3f0c1a2b'
)
pp resultado.to_hash
{
"id": "nas_9e8d7c6b9e8d7c6b9e8d7c6b9e8d7c6b",
"object": "numbering_association",
"numbering_range_id": "nrg_7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d",
"removed_from_other_software": true,
"status": "pending",
"error": null,
"created_at": "2026-11-18T09:25:40-05:00",
"finished_at": null
}