Documentation Index
Fetch the complete documentation index at: https://mintlify.com/NemonInvocash/verifactu-php/llms.txt
Use this file to discover all available pages before exploring further.
ClienteVerifactu is the main entry point for the verifactuPHP library. It handles authentication against the VeriFactuAPI automatically on construction, manages the Bearer token lifecycle, and exposes every available API operation — from building invoice objects through factory methods to submitting and querying records via the REST API. All HTTP communication is performed internally using Guzzle, so you interact only with clean PHP objects and method calls.
Constructor
logIn() method. The resulting Bearer token is stored and used automatically for all subsequent requests.
Your VeriFactuAPI account email address.
Your VeriFactuAPI account password.
Configuration Methods
These methods let you read and update the core configuration of the client instance after construction.getApiURL(): string
Returns the base API URL used for all requests.
getEmail(): string / setEmail(string $newValue): void
Gets or replaces the email address stored on the client.
getPassword(): string / setPassword(string $newValue): void
Gets or replaces the password stored on the client.
getToken(): string
Returns the current Bearer token that was issued by the API during the last successful login. Useful for debugging or for passing the token to a separate HTTP client.
getDebug(): bool / setDebug(bool $newValue): void
Gets or sets debug mode. When true, the client echoes internal messages (tokens, request results, created object data) to standard output. Disable in production.
Debug mode is
false by default. Enable it temporarily during development to inspect requests and object payloads.Object Factory Methods
These methods construct the PHP model objects that represent the different components of a VeriFactu invoice. Each factory validates the supplied array and returns a typed object ready to be passed to a submission method.nuevoEmisor(array $dataEmisor): Emisor
Creates an Emisor (issuer) object representing the business or individual issuing the invoice.
Associative array containing the issuer’s data fields (e.g. NIF, name, address). See the
Emisor model reference for the full list of accepted keys.Emisor
nuevoDestinatario(array $dataDestinatario): Destinatario
Creates a Destinatario (recipient) object representing the invoice recipient.
Associative array containing the recipient’s identification and address data.
Destinatario
nuevoTercero(array $dataTercero): Tercero
Creates a Tercero (third party) object, used when a third party is involved in the invoicing process.
Associative array containing the third party’s identification data.
Tercero
nuevoDesglose(array $dataDesglose): Desglose
Creates a Desglose (tax breakdown) object that captures the VAT and tax details for a line or invoice total.
Associative array with tax breakdown fields such as tax type, rate, taxable base, and quota.
Desglose
nuevaFacturaRectificada(array $dataFacturaRectificada): FacturaRectificada
Creates a FacturaRectificada object representing an invoice being corrected (referenced in a rectification invoice).
Associative array with the identifying details of the original invoice being rectified.
FacturaRectificada
nuevaFacturaSustituida(array $dataFacturaSustituida): FacturaSustituida
Creates a FacturaSustituida object representing an invoice being replaced (used in substitution invoices).
Associative array with the identifying details of the original invoice being substituted.
FacturaSustituida
nuevoRegistroAlta(array $objetos, array $dataRegistroAlta, int $webhookID = 0): RegistroAlta
Creates a RegistroAlta (invoice registration record) object — the main payload submitted to the AEAT. Pass all previously constructed model objects in the $objetos array.
Array of model objects to embed in the registration record. May include
Emisor, Destinatario, Tercero, Desglose, FacturaRectificada, and/or FacturaSustituida instances.Associative array with the top-level invoice fields (e.g. series number, issue date, invoice type, total amounts).
Optional ID of a webhook to associate with this record. Defaults to
0 (no webhook).RegistroAlta
nuevoRegistroAnulacion(array $dataRegistroAnulacion): RegistroAnulacion
Creates a RegistroAnulacion (cancellation record) object used to void a previously submitted invoice registration.
Associative array identifying the registration record to be cancelled (issuer NIF, series number, issue date, etc.).
RegistroAnulacion
Submission Methods
These methods POST the constructed objects to the VeriFactuAPI. They all returnvoid on success and throw an Exception on failure.
altaEmisor(Emisor $emisor): void
Registers a new issuer in the system.
- Endpoint:
POST /api/emisor
A fully constructed
Emisor object returned by nuevoEmisor().altaRegistroAlta(RegistroAlta $registroAlta): void
Submits an invoice registration record to the AEAT via VeriFactuAPI.
- Endpoint:
POST /api/alta-registro-facturacion
A fully constructed
RegistroAlta object returned by nuevoRegistroAlta().altaRegistroAnulacion(RegistroAnulacion $registroAnulacion): void
Submits a cancellation record to void a previously submitted invoice.
- Endpoint:
POST /api/anulacion-registro-facturacion
A fully constructed
RegistroAnulacion object returned by nuevoRegistroAnulacion().bajaRegistro(int $id): void
Cancels a specific registration record by its numeric ID.
- Endpoint:
POST /api/anulacion-registro-facturacion/{id}
The integer ID of the registration record to cancel.
Listing Methods
These methods performGET requests to retrieve records from the API. All return an array decoded from the API’s JSON response. Pass an integer $id to fetch a single record, or omit it (pass null) to retrieve all records of that type.
listarEmisores(?int $id = null): array
Lists all registered issuers, or retrieves a single issuer by ID.
- Endpoint:
GET /api/emisororGET /api/emisor/{id}
listarEnviosAEAT(?int $id = null): array
Lists all AEAT submission records, or retrieves one by ID.
- Endpoint:
GET /api/envios-aeatorGET /api/envios-aeat/{id}
listarRegistrosAlta(?int $id = null): array
Lists all invoice registration records, or retrieves one by ID.
- Endpoint:
GET /api/alta-registro-facturacionorGET /api/alta-registro-facturacion/{id}
listarListas(string $nombre = '', string $valor = ''): array
Queries the API reference lists (lookup tables). Filter by list name and optionally by a specific value within that list.
- Endpoint:
GET /api/listas/GET /api/listas/{nombre}/GET /api/listas/{nombre}/{valor}
The name of the list to retrieve. Leave empty to get all lists.
A specific value to look up within the named list. Only used when
nombre is also provided.listarWebhooks(?int $id = null): array
Lists all registered webhooks, or retrieves one by ID.
- Endpoint:
GET /api/webhookorGET /api/webhook/{id}
Utility Methods
createWebhook(string $webhookUrl): int
Registers a new webhook endpoint with the API. The webhook will receive POST notifications when invoice records are processed.
The publicly accessible HTTPS URL that the VeriFactuAPI should call when events occur.
int — The numeric ID of the newly created webhook.
Store the returned webhook ID if you intend to pass it to
nuevoRegistroAlta() so the API can notify your endpoint when the submission is processed.idValorLista(string $nombreLista, string $valorLista): int
Resolves a human-readable list value (e.g. 'F1') to its internal numeric ID in the API’s lookup tables. Useful when building data arrays for model objects that require integer IDs rather than string codes.
The name of the reference list to query (e.g.
'TipoFactura').The string value within that list whose ID you want to look up (e.g.
'F1').int — The numeric ID corresponding to the given list value.
Error Handling
Every public method inClienteVerifactu throws a standard PHP Exception when an error occurs — including authentication failures in the constructor, API error responses, and unexpected network issues. The exception message contains a descriptive explanation of the failure returned by the API or by Guzzle.

