API > Representation document - Upload document
Representation document - Upload document
POST https://{entorno}.ticketbaiws.eus/doc-representante/
Uploads the digitally signed representation document (authorization to act on the company's behalf) for Verifactu, Bizkaia or Gipuzkoa. For individuals, it is signed by the holder; for legal entities, by the legal representative given when downloading the template. A recognized digital certificate (FNMT, Izenpe…) must be used. The NIF (Spanish tax ID) of the signature is checked against that of the company or the representative.
The request is sent as multipart/form-data, not as JSON.
Companies in Araba: this method is not available, because in Araba the authorization is given by registering the device certificate (see instructions). It returns an error:
{"result": "ERROR", "return": null, "msg": "El documento de representación no está disponible para empresas de Araba. Registra el certificado de dispositivo de Ticketbai WS en la sede de la Diputación Foral de Álava."}PARAMETERS
| file file required PDF of the digitally signed representation document, sent as a multipart/form-data field. | documento.pdf |
POST https://api.ticketbaiws.eus/doc-representante/
$ curl --request POST \
--url https://api.ticketbaiws.eus/doc-representante/ \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Token: xxx' \
--header 'Nif: 00000014Z'
--form 'file=@"/ruta/documento-firmado.pdf"'
$ composer require ticketbaiws/ticketbaiws-php
<?php
// Installation: composer require ticketbaiws/ticketbaiws-php
require 'vendor/autoload.php';
$tbai = new \TicketbaiWS\Client('xxx', '00000014Z', ['entorno' => 'real']);
$r = $tbai->enviarDocRepresentante('/ruta/documento-firmado.pdf');
if ($r->isError()) {
echo $r->getMessageText();
} else {
print_r($r->getData());
}
$ python -m pip install requests
import requests
url = "https://api.ticketbaiws.eus/doc-representante/"
headers = {"Accept": "application/json", "Token" : "xxx", "Nif" : "00000014Z"}
files = {
"file": ("document-firmado.pdf", open("/ruta/documento-firmado.pdf", "rb"), "application/pdf")
}
response = requests.post(url, headers=headers, files=files)
print(response.text)
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.ticketbaiws.eus/doc-representante/");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
// -------------------------
// FORMULARIO MULTIPART
// -------------------------
curl_mime *mime;
curl_mimepart *part;
mime = curl_mime_init(hnd);
// Campo "filename"
part = curl_mime_addpart(mime);
curl_mime_name(part, "filename");
curl_mime_data(part, "documento-firmado.pdf", CURL_ZERO_TERMINATED);
// Campo "file" → fichero real
part = curl_mime_addpart(mime);
curl_mime_name(part, "file");
curl_mime_filedata(part, "/ruta/documento-firmado.pdf");
// Asignar formulario al handle
curl_easy_setopt(hnd, CURLOPT_MIMEPOST, mime);
CURLcode ret = curl_easy_perform(hnd);
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
// Archivo a enviar
File file = new File("/ruta/documento-firmado.pdf");
// Construimos el body multipart
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
// Campo "file"
.addFormDataPart(
"file", // nombre del campo
file.getName(), // nombre del archivo
RequestBody.create(file, MediaType.parse("application/pdf"))
)
// You can add more fields if the endpoint requires them
.addFormDataPart("filename", file.getName())
.build();
Request request = new Request.Builder()
.url("https://api.ticketbaiws.eus/doc-representante/")
.post(RequestBody)
.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": "Documento procesado correctamente",
"msg": null
}
TicketBAI / Verifactu methods
- POST New invoice / resubmission (zuzendu) TicketBAI / Verifactu
- POST Complete a simplified invoice
- GET Get a TicketBAI / Verifactu invoice
- GET List TicketBAI / Verifactu invoices
- GET Download TicketBAI / Verifactu XML
- GET Download invoice in FacturaE format
- GET Download invoice as PDF
- GET System status
- DEL Cancel a TicketBAI / Verifactu invoice
- PUT Force TicketBAI / Verifactu resend
- POST Validate a NIF with the AEAT
- POST Validate a VAT number in VIES
Representation document
- GET Representation document - Download template
- POST Representation document - Upload document
- GET Representation document - Download uploaded document
- DELETE Representation document - Revoke uploaded document
BATUZ BIZKAIA specific methods
- GET List IAE activity codes
- POST LROE - Received invoices - Submit (BATUZ)
- PUT LROE - Received invoices - Update (BATUZ)
- GET LROE - Received invoices - Query (BATUZ)
- DEL LROE - Received invoices - Cancel (BATUZ)
- POST LROE - Expenses without invoice - Submit (BATUZ, form 140)
- PUT LROE - Expenses without invoice - Update (BATUZ, form 140)
- GET LROE - Expenses without invoice - Query (BATUZ, form 140)
- DEL LROE - Expenses without invoice - Cancel (BATUZ, form 140)
- POST LROE - Cash accounting COLLECTIONS - Submit (BATUZ)
- PUT LROE - Cash accounting COLLECTIONS - Update (BATUZ)
- GET LROE - Cash accounting COLLECTIONS - Query (BATUZ)
- DEL LROE - Cash accounting COLLECTIONS - Cancel (BATUZ)
- POST LROE - Cash accounting PAYMENTS - Submit (BATUZ)
- PUT LROE - Cash accounting PAYMENTS - Update (BATUZ)
- GET LROE - Cash accounting PAYMENTS - Query (BATUZ)
- DEL LROE - Cash accounting PAYMENTS - Cancel (BATUZ)
SII (AEAT)
Customers and products (invoicing tool)
- GET Customers - Search / get customers
- POST Customers - New customer
- PUT Customers - Update customer
- GET Products - Search / get products
