## 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](https://ticketbaiws.eus/en/empresas-get/) and [PUT empresas](https://ticketbaiws.eus/en/empresas-put/) 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.) Ejemplo: `autorizada`
- `via` (string, How the company is (or has to be) authorized: `certificado_propio`, `certificado_dispositivo` or `documento_representacion`.) Ejemplo: `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.) Ejemplo: `05/12/2026`
- `caducidad_certificado` (string, dd/mm/yyyy. Only present when `via` = `certificado_propio`: expiry date of the company's own certificate.) Ejemplo: `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](https://ticketbaiws.eus/es/registro-de-certificado-de-dispositivo/) 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/`

```bash
$ 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'
```

Respuesta:

```json
HTTP/1.1 200 OK
{
	"result": "OK",
	"return": {
		"estado": "autorizada",
		"via": "documento_representacion",
		"fecha": "05/12/2026"
	},
	"msg": null
}
```

Response  (certificado_propio):

```json
HTTP/1.1 200 OK
{
	"result": "OK",
	"return": {
		"estado": "autorizada",
		"via": "certificado_propio",
		"fecha": null,
		"caducidad_certificado": "31/03/2028"
	},
	"msg": null
}
```

Fuente: https://ticketbaiws.eus/en/doc-representante-estado-get/
