Documentación / Facturas Verifactu
Descarga en formato FacturaE
GET https://{entorno}.verifactu.ws/facturae/
Este método permite obtener una factura en formato FacturaE v3.2 (en formato Base64) que previamente se hubiera enviado a TicketBAI a través de Verifactu WS. Para que la factura salga firmada digitalmente se deberá proporcionar un certificado digital válido de la empresa para la firma del mismo.
Los métodos GET permiten el envío de los parámetros en el body como payload JSON o mediante query string en la URL como se ve en el ejemplo cURL.
PARÁMETROS
| serie string obligatorio Serie de la factura | A |
| numero string obligatorio Número de factura | 2022000123 |
| cod_organo_gestor string opcional Código del órgano gestor | A01021700 |
| cod_unidad_tramitadora string opcional Código de la unidad tramitadora | A01021700 |
| cod_oficina_contable string opcional Código de la oficina contable | A01021700 |
GET https://{entorno}.verifactu.ws/facturae/
$ curl --request GET \
--url https://api.verifactu.ws/facturae/ \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Token: xxx' \
--header 'Nif: 00000014Z'
--data '{"serie":"A","numero":"2021000123"}'
$ composer require ticketbaiws/ticketbaiws-php
<?php
// Instalación: composer require ticketbaiws/ticketbaiws-php
require 'vendor/autoload.php';
$tbai = new \TicketbaiWS\Client('xxx', '00000014Z', ['entorno' => 'real']);
$r = $tbai->facturae('A', '2021000123');
if ($r->isError()) {
echo $r->getMessageText();
} else {
file_put_contents('facturae.xml', base64_decode($r->getData()));
}
$ python -m pip install requests
import requests
url = "https://api.verifactu.ws/facturae/"
headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
response = requests.request("GET", url, headers=headers)
print(response.text)
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.verifactu.ws/facturae/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.verifactu.ws/facturae/?serie=A&numero=2021000123")
.get()
.addHeader("Accept", "application/json")
.addHeader("Token", "xxx")
.addHeader("Nif", "00000014Z")
.build();
Response response = client.newCall(request).execute();
{ } Response JSON
HTTP/1.1 200 OK
{
"result": "OK",
"return": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGZlOkZhY3R1cmFlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiB4bWxuczpmZT0iaHR0cDovL3d3dy5mYWN0dXJhZS5lcy9GYWN0dXJhZS8yMDA5L3YzLjIvRmFjdHV ...",
"msg": null
}
Métodos de facturas Verifactu
- POST Nueva factura / subsanación (zuzendu) TicketBAI / Verifactu
- POST Completar factura simplificada
- GET Consulta factura TicketBAI / Verifactu
- GET Listado facturas TicketBAI / Verifactu
- GET Descarga XML TicketBAI / Verifactu
- GET Descarga factura en formato FacturaE
- GET Descarga factura en PDF
- GET Estado sistema
- DEL Anular factura TicketBAI / Verifactu
- PUT Forzar reenvío TicketBAI / Verifactu
- POST Validar NIF en la AEAT
- POST Validar NIF en el VIES
Documento representación
- GET Documento Representación - Descargar modelo
- POST Documento Representación - Enviar documento
- GET Documento Representación - Descargar documento cargado
- DELETE Documento Representación - Revocar documento cargado
Clientes y productos (herramienta de facturación)
- GET Clientes - Buscar / consultar clientes
- POST Clientes - Nuevo cliente
- PUT Clientes - Modificar cliente
- GET Productos - Buscar / consultar productos