On a Tuesday morning, the labor inspectorate arrives at a renovation site and asks for the Subcontracting Book (Libro de Subcontratación) and the paperwork of the three trades working there. One trade's insurance is in the site manager's inbox, another's Social Security certificate expired last month, and nobody knows whether the third is registered in the accredited companies register. The job is running fine, but the contractor cannot prove it complies.
Spanish law makes the contractor answerable for what the companies it subcontracts do, or fail to do. This article covers which documents a small construction company has to control, what each rule says, what penalties the law provides and how much of that control can be automated with artificial intelligence while keeping human review. The rules cited were read in the consolidated text of the Spanish Official Gazette (BOE), consulted on November 24, 2026. This is not legal advice: your labor advisor or prevention technician validates how it applies to your specific site.
1. Why the contractor answers for its subcontractors
Four rules overlap. It helps to keep them apart.
| Rule | What it regulates | Who answers |
|---|---|---|
| Law 32/2006, regulating subcontracting in the construction sector | Company requirements, subcontracting levels, the Subcontracting Book and the accredited companies register | The contractor and the subcontractor that hired in breach |
| Workers' Statute (Estatuto de los Trabajadores), art. 42 | Social Security debts and wages of contractors | The principal company |
| General Tax Law (Ley General Tributaria), art. 43.1.f | Withholdings and VAT charged by subcontractors | The company that pays |
| Royal Decree 171/2004 and Royal Decree 1627/1997 | Coordination of business activities and safety on construction sites | The principal employer or the contractor |
Joint liability under Law 32/2006
Article 7 of the law requires contractors and subcontractors to watch that the companies they contract with comply with it, in particular with the accreditation and registration of article 4.2 and the subcontracting limits of article 5. If a subcontractor breaches those obligations, that subcontractor and the contractor are jointly liable for the labor and Social Security obligations of the contract that fall to the subcontractor at fault.
Liability for Social Security debts
Article 42 of the Workers' Statute sets two periods worth keeping in mind. The principal company is jointly liable for the Social Security debts of its contractors and subcontractors during the term of the contract and the three years after it ends. For wage debts it is liable during the year after the assignment ends. The same article offers a way to protect yourself: ask the Social Security Treasury (Tesorería General de la Seguridad Social) in writing for a certificate that the company has no arrears. The Treasury must issue it within thirty non-extendable days and, if it does not, the requesting company is released from liability.
The article excludes liability when the work is construction or repair of a person's own home, or when the owner does not commission the work for a business activity.
Liability for tax debts
Article 43.1.f of the General Tax Law makes anyone who contracts or subcontracts works within their main economic activity secondarily liable for the withholdings and taxes charged on the contracted part. That liability cannot be claimed if the contractor gave the payer a specific certificate of being up to date with tax obligations, issued in the 12 months before each invoice payment. The liability is limited to the amount of payments made without a valid certificate. The tax agency has three days from the request to issue the certificate or deny it.
2. The documents each subcontractor must keep up to date
This is the checklist that comes out of the rules above. Each row shows the legal basis and the deadline to watch.
| Document | Legal basis | What to watch |
|---|---|---|
| Registration in the Accredited Companies Register (REA, Registro de Empresas Acreditadas) | Law 32/2006, art. 4.2.b and 6. Royal Decree 1109/2007, art. 6 | Registration lasts three years and is renewed by applying within the six months before it expires. If it is not requested in time, it is cancelled automatically |
| Certificate of REA registration | Royal Decree 1109/2007, art. 6.3 and 6.4 | Requested within the month before the contract starts and must be issued within ten calendar days |
| Proof of prevention training and preventive organization | Law 32/2006, art. 4.2.a. Royal Decree 1109/2007, art. 4.2 | A declaration signed by the legal representative, plus documents on the preventive organization |
| Social Security certificate of no arrears | Workers' Statute, art. 42.1 | The Treasury has 30 days to issue it. Keep the date of the request |
| Tax agency certificate of being up to date | General Tax Law, art. 43.1.f | Covers invoices paid in the 12 months after its issue |
| Risk assessment, preventive planning, and information and training of workers | Royal Decree 171/2004, art. 10.2 | Written proof before starting at the workplace. On construction sites, this duty of the principal employer falls on the contractor (first additional provision) |
| Health and safety plan | Royal Decree 1627/1997, art. 7 | Each contractor prepares its own, and the coordinator must approve it before the work starts |
| Documents proving ownership of the machinery the company uses | Law 32/2006, art. 8.2 | Must be available on site |
| Share of permanent employees | Law 32/2006, art. 4.4. Royal Decree 1109/2007, art. 11 | For companies regularly hired for construction work, no less than 30 percent of the workforce |
Two clarifications on this table. First, the REA certificate has a concrete effect. Under article 6.3 of the regulation, when the commissioning company obtains a certificate that its subcontractor is registered, it is deemed to have met its duty to watch over the accreditation and registration requirements, and it is released from the liability of article 7.2 of the law for the duration of the contract and for a single construction site. The release does not cover the liabilities of articles 42 and 43 of the Workers' Statute. Second, the share of permanent employees and the machinery documents depend on each company. Confirm with your advisor what you must require in each contract.
Limits on the subcontracting chain
Article 5 of the law lets the contractor subcontract, lets the first and second subcontractors subcontract again, and prohibits the third subcontractor and the self-employed worker from subcontracting. Subcontractors whose organization consists mainly of supplying labor, with hand tools as their only own equipment, cannot subcontract either. Exceptionally, one additional level is allowed in justified unforeseen cases, with prior approval from the site management (dirección facultativa) recorded in the Subcontracting Book. The contractor must report it to the labor authority within five working days of the approval.
3. The Subcontracting Book
Each contractor must keep a Subcontracting Book on every site. Under article 8 of the law, it must remain on site at all times and record, in chronological order, each subcontract, its level, the commissioning company, the subject of the contract, who exercises management at each subcontractor and the dates the safety plan was delivered. It also records the coordinator's instructions and the site management's approvals.
Royal Decree 1109/2007 adds practical details:
- The labor authority of the territory of the site authorizes the Book. This step comes before the first subcontract.
- The contractor records each subcontract before the work starts and tells the safety and health coordinator and the workers' representatives.
- It must keep the Book on site until its assignment ends and for the five years after its participation in the site ends.
- On building works, at completion it hands a copy to the project director for the Building Book (Libro del Edificio).
- Access to the Book is open to the developer, the site management, the coordinator, the companies and self-employed workers on site, prevention technicians and delegates, the labor authority and the workers' representatives.
The Book is not something artificial intelligence automates: it is a document authorized by the labor authority. What can be automated is making sure the data that feeds its entries is complete before you subcontract.
4. What penalties the law provides
The Law on Infractions and Sanctions in the Social Order (LISOS) classifies these breaches as occupational risk prevention infractions. See the consolidated text for the detail of each case. Some examples from article 12, serious infractions:
- By the subcontractor (art. 12.27): failing to prove prevention training, preventive organization and registration, or failing to verify it in the subcontractors it hires. Also failing to provide the data the contractor needs to keep the Book, and exceeding the subcontracting levels without approval from the site management.
- By the contractor (art. 12.28): not keeping the Subcontracting Book in order and up to date, or not keeping it as the regulation requires.
- By the developer (art. 12.29): allowing, through the site management, the exceptional extension of the chain when the grounds clearly do not exist.
Article 13 turns these breaches into very serious infractions when the work involves special risks, and also classifies as very serious a subcontractor falsifying the data it reports to the contractor and leading to work done in breach of the subcontracting rules.
Under article 40.2 of the same law, serious prevention infractions are fined between 2,451 and 49,180 euros and very serious ones between 49,181 and 983,736 euros, graded by circumstances. In addition, article 42.3 provides that the principal company is jointly liable with its contractors and subcontractors for the obligations of the prevention law regarding the workers they employ at the principal company's workplace, when the infraction occurs there.
5. Where manual control fails
These are the usual reasons a construction company cannot prove compliance and all of them are organizational in origin:
- Scattered documents. They arrive by email, WhatsApp or on paper, with names like "scan_0042.pdf".
- Dates nobody watches. Each document has its own expiry and deadline: three years for the REA, 12 months for the tax certificate, 30 days for the Treasury to answer.
- Subcontractor changes without checks. A crew joins mid-job and starts work before anyone reviews its papers.
- Multiplication per site. A small firm with four sites and five subcontractors per site, for example, manages twenty files in parallel.
6. What AI can and cannot do
The solution we offer at IA4PYMES for construction companies follows a simple logic: the system reads the documents that arrive, sorts them by subcontractor and site, extracts the dates and shows the status of each in words and color: Up to date, Expires in 12 days or Missing. A person on your team reviews whatever the system flags as doubtful.
What it does well
- Read and classify. A language model with vision identifies whether a PDF or a photo is a tax agency certificate, an insurance policy or a training record, and extracts the issue date, holder and validity.
- Compare against a list. Each site has its list of required documents, like the one in section 2, and the system detects what is missing before the subcontractor starts.
- Warn in time. Expiry alerts go out with the margin you configure, to the internal manager and to the subcontractor, instead of finding the problem on inspection day.
- Leave a trail. It records which document was received, when and who reviewed it, which helps if you need to show a third party that you exercised oversight.
What it does not do
- It does not decide whether a document is legally valid. It can misread a date or confuse two similar certificates. That is why the proposal includes human review: a person confirms what is doubtful.
- It does not replace the safety coordinator or the prevention technician. Approving the safety plan falls to the coordinator under article 7 of Royal Decree 1627/1997.
- It does not obtain the official certificates. They are issued by the tax agency, the Treasury or the labor authority. The system reminds you when to request them, but the company files the request.
- It does not authorize the Subcontracting Book. The labor authority does.
Personal data
These documents contain data about people: names, training, sometimes ID numbers. Processing falls under the European data protection regulation. Before uploading documents to any cloud system, check where they are processed and what data processing agreement the provider signs. In our case, data is stored on European servers and we sign a data processing agreement with each client. That point is reviewed with each client before starting.
7. How to start in one week
- Pick one active site. You do not need to migrate the whole archive.
- List the subcontractors and self-employed workers on it and note which documents each one has.
- Use three statuses in a spreadsheet: up to date, expires in under 30 days, missing. It is the minimum viable version and already shows the real picture.
- Note each subcontractor's REA renewal date. It is the date most often forgotten: renewal must be requested in the six months before expiry.
- Request certificates with the legal calendar in mind: the REA certificate within the month before the contract starts, the tax certificate within the 12 months before each payment and the Social Security one with enough margin for the Treasury's 30 days.
- When the spreadsheet falls short, that is the moment to automate reading and alerts.
To see how this fits with the rest of a construction company's processes, read our article on AI for construction companies, where we cover estimates, delivery notes and certifications.
Book the free 30-minute diagnostic for your construction company here and we will tell you which part of your subcontractor control can be automated on your own sites.
Frequently asked questions
Which documents must a construction company request from its subcontractors?
At a minimum: registration in the Accredited Companies Register, proof of prevention training and preventive organization, the Social Security certificate of no arrears, the tax agency certificate of being up to date, written proof of risk assessment and training, and its part of the health and safety plan.
How long is REA registration valid?
Three years, renewable for equal periods. Renewal is requested within the six months before expiry. If it is not requested in time, the registration is cancelled automatically.
How long is the tax certificate for contractors valid?
Under article 43.1.f of the General Tax Law, the certificate covers invoices paid in the 12 months after its issue. If 12 months pass without renewal, the payer loses protection for later payments.
How many subcontracting levels does the law allow on a construction site?
The contractor, the first subcontractor and the second may subcontract. The third subcontractor and the self-employed worker may not. One exceptional additional level is allowed, with prior approval from the site management recorded in the Subcontracting Book.
What is the fine for not keeping the Subcontracting Book properly?
Not keeping the Book in order and up to date is a serious infraction by the contractor. Serious prevention infractions are fined between 2,451 and 49,180 euros under article 40.2 of the LISOS. The exact amount depends on the circumstances.
Can artificial intelligence replace the person in charge of documents?
No. It can read, classify and alert, and it reduces manual work, but validating each document and deciding who enters the site stay with a person.
