// Documentos electrónicos
Eliminar nómina
Deja sin efecto una nómina aceptada con una nota de ajuste de eliminación. Solo se envía el motivo.
POST
/api/v1/payroll/adjustmentsCuando una nómina no debió transmitirse (trabajador equivocado, mes que no correspondía), se elimina con una nota de ajuste de eliminación (tipo 2). No envías la nómina: la API toma los datos del documento original y la nota sale con neto en cero.
Reglas
- El documento debe estar aceptado y vigente (
current: trueen la consulta). - No puede tener ya otro ajuste.
Headers
| Header | Obligatorio | Valor |
|---|---|---|
nestfac-api-key |
Sí | Tu API key. Ver Autenticación. |
nestfac-idempotency-key |
Sí | Un valor único por ajuste. Ver Idempotencia. |
Content-Type |
Sí | application/json |
Ejemplo
curl -X POST "https://api-sandbox.nestfac.co/api/v1/payroll/adjustments" \
-H "nestfac-api-key: $NESTFAC_API_KEY" \
-H "nestfac-idempotency-key: NOM-2026-09-1075234567-ELIM" \
-H "Content-Type: application/json" \
-d '{
"adjustment_type": "2",
"predecessor_id": "90994cdd-0563-4749-ac15-983fbf193f0c",
"notes": [
"Nómina emitida a un trabajador equivocado"
]
}'// Node.js 18+ (fetch nativo). Corre en TU servidor: la API key nunca va al navegador.
const body = {
"adjustment_type": "2",
"predecessor_id": "90994cdd-0563-4749-ac15-983fbf193f0c",
"notes": [
"Nómina emitida a un trabajador equivocado"
]
};
const res = await fetch("https://api-sandbox.nestfac.co/api/v1/payroll/adjustments", {
method: "POST",
headers: {
"nestfac-api-key": process.env.NESTFAC_API_KEY,
"nestfac-idempotency-key": "NOM-2026-09-1075234567-ELIM",
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
const json = await res.json();
if (!res.ok) throw new Error(`${json.code ?? res.status}: ${json.message ?? JSON.stringify(json.errors)}`);
console.log(json.data);import os
import requests
payload = {
"adjustment_type": "2",
"predecessor_id": "90994cdd-0563-4749-ac15-983fbf193f0c",
"notes": ["Nómina emitida a un trabajador equivocado"],
}
res = requests.post(
"https://api-sandbox.nestfac.co/api/v1/payroll/adjustments",
headers={
"nestfac-api-key": os.environ["NESTFAC_API_KEY"],
"nestfac-idempotency-key": "NOM-2026-09-1075234567-ELIM",
},
json=payload,
timeout=30,
)
data = res.json()
if not res.ok:
raise RuntimeError(f"{data.get('code', res.status_code)}: {data.get('message') or data.get('errors')}")
print(data["data"])<?php
$payload = [
'adjustment_type' => '2',
'predecessor_id' => '90994cdd-0563-4749-ac15-983fbf193f0c',
'notes' => ['Nómina emitida a un trabajador equivocado'],
];
$ch = curl_init('https://api-sandbox.nestfac.co/api/v1/payroll/adjustments');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'nestfac-api-key: ' . getenv('NESTFAC_API_KEY'),
'nestfac-idempotency-key: NOM-2026-09-1075234567-ELIM',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($payload, JSON_UNESCAPED_UNICODE),
]);
$response = json_decode(curl_exec($ch), true);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException(($response['code'] ?? $status) . ': ' . ($response['message'] ?? json_encode($response['errors'] ?? null)));
}
print_r($response['data']);// .NET 7+
using System.Net.Http;
using System.Text;
using var http = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api-sandbox.nestfac.co/api/v1/payroll/adjustments");
request.Headers.Add("nestfac-api-key", Environment.GetEnvironmentVariable("NESTFAC_API_KEY"));
request.Headers.Add("nestfac-idempotency-key", "NOM-2026-09-1075234567-ELIM");
var json = """
{
"adjustment_type": "2",
"predecessor_id": "90994cdd-0563-4749-ac15-983fbf193f0c",
"notes": [
"Nómina emitida a un trabajador equivocado"
]
}
""";
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await http.SendAsync(request);
var result = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode) throw new Exception($"{(int)response.StatusCode}: {result}");
Console.WriteLine(result);// Java 15+ (java.net.http)
import java.net.URI;
import java.net.http.*;
String json = """
{
"adjustment_type": "2",
"predecessor_id": "90994cdd-0563-4749-ac15-983fbf193f0c",
"notes": [
"Nómina emitida a un trabajador equivocado"
]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-sandbox.nestfac.co/api/v1/payroll/adjustments"))
.header("nestfac-api-key", System.getenv("NESTFAC_API_KEY"))
.header("nestfac-idempotency-key", "NOM-2026-09-1075234567-ELIM")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 400) throw new RuntimeException(response.body());
System.out.println(response.body());package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
body := `{
"adjustment_type": "2",
"predecessor_id": "90994cdd-0563-4749-ac15-983fbf193f0c",
"notes": [
"Nómina emitida a un trabajador equivocado"
]
}`
req, _ := http.NewRequest("POST", "https://api-sandbox.nestfac.co/api/v1/payroll/adjustments", strings.NewReader(body))
req.Header.Set("nestfac-api-key", os.Getenv("NESTFAC_API_KEY"))
req.Header.Set("nestfac-idempotency-key", "NOM-2026-09-1075234567-ELIM")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}// La API key NUNCA va en el navegador. React llama a TU backend,
// que agrega la key y la llave de idempotencia (pestaña Node.js).
async function enviar(datos) {
const res = await fetch("/api/nestfac/payroll/adjustments", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(datos),
});
const json = await res.json();
if (!res.ok) throw new Error(json.message ?? json.code);
return json.data;
}
// const resultado = await enviar(datosDeLaVenta);202 Accepted
{
"success": true,
"message": "Payroll delete adjustment received",
"data": {
"payroll_id": "83921e3f-c326-49b6-97d2-0b925ea62536",
"predecessor_id": "90994cdd-0563-4749-ac15-983fbf193f0c",
"adjustment_type": "2",
"full_number": "NAP1",
"cune": "9ddfb43bc13a4eba785bea528464b90cab1e4fb8e6b8352df9b594820f3f7f6720badf1326f9dff53d80154971d9ff32",
"status": "PENDING",
"net_total": "0.00"
}
}Campos
Body
- adjustment_typestringobligatorio
2eliminar.2- predecessor_idstring (uuid)obligatorio
- La nómina vigente que se elimina.
- notesstring[]obligatorio
- El motivo de la eliminación.
// Revisado contra la API el 24 de octubre de 2026.