curl --request POST \
--url https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>'import requests
url = "https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish"
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"status": "<string>",
"receiver_name": "<string>",
"issue_date": "2023-11-07T05:31:56Z",
"due_date": "2023-11-07T05:31:56Z",
"subtotal": 123,
"discount_total": 123,
"net_amount": 123,
"tax_rate": 123,
"tax_amount": 123,
"total_amount": 123,
"amount_paid": 123,
"client_credit_balance": 123,
"payment_terms_days": 123,
"invoice_type": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"client_id": {},
"receiver_rut": {},
"receiver_email": {},
"receiver_address": {},
"receiver_ciudad": {},
"receiver_comuna": {},
"receiver_giro": {},
"tax_amount_override": {},
"total_amount_override": {},
"uf_value_at_creation": {},
"folio_prefix": {},
"folio_number": {},
"internal_notes": {},
"public_notes": {},
"concept": {},
"periodo": {},
"credit_note_for_id": {},
"credit_note_reason": {},
"factura_id": {},
"parent_client_id": {},
"billing_client_id": {},
"oc_number": {},
"hes_number": {},
"requires_oc": true,
"requires_hes": true,
"detail_xlsx_url": {},
"last_dte_error": {},
"dte_retry_count": 123,
"dte_local_status": {},
"sii_status_detail": {},
"created_by": {},
"deleted_at": {}
}Publicar factura (DRAFT → PUBLISHED) — orquestador canónico
Único camino de emisión comercial: valida la factura (receptor, líneas, total > 0, OC/HES), transiciona DRAFT → PUBLISHED y emite el DTE (PUBLISHED → DTE_SENT, evento DTE_EMITTED). La emisión es best-effort: si falla, la factura queda en PUBLISHED y se reintenta con POST :id/emit-dte. Para la emisión tributaria pura sin factura comercial existe POST /v1/dte/documents, que NO ejecuta la FSM comercial ni sus side-effects (eventos invoice_event, folio ligado a la factura, email, link de pago).
curl --request POST \
--url https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <idempotency-key>'import requests
url = "https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish"
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
fetch('https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.raul.ugps.io/api/v1/billing/invoices/{id}/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"type": "<string>",
"status": "<string>",
"receiver_name": "<string>",
"issue_date": "2023-11-07T05:31:56Z",
"due_date": "2023-11-07T05:31:56Z",
"subtotal": 123,
"discount_total": 123,
"net_amount": 123,
"tax_rate": 123,
"tax_amount": 123,
"total_amount": 123,
"amount_paid": 123,
"client_credit_balance": 123,
"payment_terms_days": 123,
"invoice_type": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"client_id": {},
"receiver_rut": {},
"receiver_email": {},
"receiver_address": {},
"receiver_ciudad": {},
"receiver_comuna": {},
"receiver_giro": {},
"tax_amount_override": {},
"total_amount_override": {},
"uf_value_at_creation": {},
"folio_prefix": {},
"folio_number": {},
"internal_notes": {},
"public_notes": {},
"concept": {},
"periodo": {},
"credit_note_for_id": {},
"credit_note_reason": {},
"factura_id": {},
"parent_client_id": {},
"billing_client_id": {},
"oc_number": {},
"hes_number": {},
"requires_oc": true,
"requires_hes": true,
"detail_xlsx_url": {},
"last_dte_error": {},
"dte_retry_count": 123,
"dte_local_status": {},
"sii_status_detail": {},
"created_by": {},
"deleted_at": {}
}Authorizations
Token de sesión Better Auth para rutas de backoffice; las rutas de portal usan su token propio.
Headers
UUID v4 de intención; requerido para publicar o emitir DTE.
Path Parameters
UUID de la factura
Response
Saldo a favor disponible del cliente desde sobrepagos de otras facturas
local_status del DTE más reciente (estado del XML ante el SII)
Detalle libre devuelto por el SII para el DTE más reciente