API > Representation document - Authorization status

Representation document - Authorization status

GET  https://{entorno}.ticketbaiws.eus/doc-representante/estado/

Returns whether the company is authorized for TicketBAI WS to send its invoices to its tax authority in production, and how: own certificate, device certificate or representation document (authorization to act on the company's behalf). It is the same representacion object returned by GET empresas and PUT empresas with the developer token.

Authenticate with the company token: header Nif = the company's NIF (Spanish tax ID) and Token = its token for the environment (test or production). It works in all four territories (Araba, Bizkaia, Gipuzkoa and Verifactu).

Available in the test and production environments. The authorization belongs to the company, not to the environment: the result is the same with either token.

PARAMETERS

-- This method does not accept parameters --


RESPONSE

In return:

estado string
autorizada: TicketBAI WS can send the company's invoices to the tax authority in production. pendiente: the authorization is still missing.
autorizada
via string
How the company is (or has to be) authorized: certificado_propio, certificado_dispositivo or documento_representacion.
documento_representacion
fecha string | null
dd/mm/yyyy. Date of the representation document (via = documento_representacion) or of the confirmation that the device certificate has been registered (Araba and Gipuzkoa). null otherwise.
05/12/2026
caducidad_certificado string
dd/mm/yyyy. Only present when via = certificado_propio: expiry date of the company's own certificate.
31/03/2028


HOW IT IS WORKED OUT

The first rule that applies is used:

  1. Own certificate still valid (any territory): the company has uploaded its own digital certificate in the private area and it has not expired. autorizada, certificado_propio, fecha null and caducidad_certificado with its expiry date.
  2. Verifactu, Bizkaia and Gipuzkoa with a representation document uploaded: autorizada, documento_representacion and the document's fecha.
  3. Verifactu without a document: pendiente, documento_representacion. Without the document (or an own certificate) invoices cannot be sent to the AEAT (Spanish Tax Agency).
  4. Bizkaia without a document: autorizada, certificado_dispositivo (the TicketBAI WS device certificate is used).
  5. Araba and Gipuzkoa without a document: certificado_dispositivo. autorizada once the registration of the TicketBAI WS device certificate with the Provincial Council (Diputación Foral) has been confirmed in the private area (fecha = date of the confirmation); otherwise pendiente.

If the token or the NIF is wrong:

{"result": "ERROR", "return": null, "msg": "TOKEN error"}

GET https://{entorno}.ticketbaiws.eus/doc-representante/estado/
$ curl --request GET \
     --url https://api-test.ticketbaiws.eus/doc-representante/estado/ \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --header 'Token: xxx' \
     --header 'Nif: 00000014Z'
$ 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->peticion('GET', 'doc-representante/estado');

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

url = "https://api-test.ticketbaiws.eus/doc-representante/estado/"
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-test.ticketbaiws.eus/doc-representante/estado/");

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/doc-representante/estado/")
  .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": {
		"estado": "autorizada",
		"via": "documento_representacion",
		"fecha": "05/12/2026"
	},
	"msg": null 
}
{ } Response JSON (certificado_propio)
HTTP/1.1 200 OK
{ 
	"result": "OK", 
	"return": {
		"estado": "autorizada",
		"via": "certificado_propio",
		"fecha": null,
		"caducidad_certificado": "31/03/2028"
	},
	"msg": null 
}

TicketBAI / Verifactu methods

Representation document

BATUZ BIZKAIA specific methods

SII (AEAT)

Customers and products (invoicing tool)

Other methods