API > Cancel TicketBAI invoice

Cancel TicketBAI invoice

DEL  https://{entorno}.ticketbaiws.eus/tbai/

This method cancels a TicketBAI invoice sent by mistake, BUT no other invoice can be sent with the same number afterwards. See the Batuz FAQ here

PARAMETERS

serie string required
Invoice series
A
numero string required
Invoice number
2021000123
fecha string optional
Issue date of the invoice to cancel. If no date is provided, the most recently issued invoice with that series and number is used
25/01/2026

DEL https://{entorno}.ticketbaiws.eus/tbai/
$ curl --request DELETE \
     --url https://api-test.ticketbaiws.eus/tbai/ \
     --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
// Installation: composer require ticketbaiws/ticketbaiws-php
require 'vendor/autoload.php';

$tbai = new \TicketbaiWS\Client('xxx', '00000014Z', ['entorno' => 'test']);

$r = $tbai->anularFactura('A', '2021000123');

if ($r->isError()) {
    echo $r->getMessageText();
} else {
    print_r($r->getData());
}
$ python -m pip install requests
import requests

url = "https://api-test.ticketbaiws.eus/tbai/"
headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
response = requests.request("DELETE", url, headers=headers)
print(response.text)
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-test.ticketbaiws.eus/tbai/");

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-test.ticketbaiws.eus/tbai/")
  .delete()
  .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": {}, 
	"msg": "TicketBAI anulado" 
}

TicketBAI / Verifactu methods

Representation document

BATUZ BIZKAIA specific methods

SII (AEAT)

Customers and products (invoicing tool)

Other methods