Official libraries for PHP, Node.js and Python, examples for calling the API without them, and a Postman collection to try every endpoint.
Base URL: https://spaincompanyapi.com/api/v1 · API key in the X-API-KEY header · Get a free API key (100 requests, no card) · Full documentation
15. Official SDKs (Published)
Speed up integration in your applications using our official libraries with static typing and native error handling. These SDKs are production-ready.
PHP SDK
Official
Install via Composer:
composer require apiempresas/apiempresas-php
Usage example:
require_once 'vendor/autoload.php';
use ApiEmpresas\ApiEmpresas;
$api = new ApiEmpresas('your_api_key');
$company = $api->companies->get('B12345678');
echo $company['name'];
Node.js / TS
Official
Install via NPM:
npm install apiempresas
TypeScript usage example:
import { ApiEmpresas } from 'apiempresas';
const api = new ApiEmpresas({ apiKey: 'your_api_key' });
const company = await api.companies.get('B12345678');
console.log(company.name);
Python SDK
Official
Install via PIP:
pip install apiempresas
Usage example:
from apiempresas import ApiEmpresas
api = ApiEmpresas('your_api_key')
company = api.companies.get('B12345678')
print(company['name'])
What's new in version 1.6.0
All three SDKs now include bulk validation of your customers' tax IDs before invoicing (POST /companies/verify/batch): companies.verifyBatch in PHP and Node and companies.verify_batch in Python. Up to 1,000 tax IDs per call, plain or with the legal name you have on file and your own reference; each one comes back with invoice_hint (ok, revisar or no_facturar) and its reasons. Update with npm install apiempresas@latest, pip install -U apiempresas or composer update apiempresas/apiempresas-php.
All three SDKs now cover the October endpoints: subsidies (companies.subsidies), the changes feed (companies.changes, plus a helper that walks every page), BORME statistics (stats), the IBAN in KYB verification (checks.iban) and the filters of the company.created webhook. In Node, the types also include size, address_density and sources. Update with npm install apiempresas@latest or pip install -U apiempresas.
import { ApiEmpresas, constructWebhookEvent } from 'apiempresas';
const api = new ApiEmpresas({ apiKey: 'your_api_key' });
// KYB verification with IBAN (Pro, 2 requests)
const v = await api.companies.verify('A46103834', { name: 'Mercadona SA', iban: 'ES9121000418450200051332' });
console.log(v.decision_hint, v.checks.iban?.valid); // pass | review | fail
// Subsidies (Business, 1 request)
const s = await api.companies.subsidies('A46103834', { year: 2025 });
console.log(s.summary.total_grants, s.summary.total_amount);
// BORME changes feed, every page (Business, 1 request per page)
for await (const c of api.companies.iterateChanges({ since: '2026-10-19', types: ['address', 'officers'] })) {
console.log(c.cif, c.change_types);
}
// BORME statistics (all plans, 1 request)
const st = await api.stats({ metrics: ['incorporations'], province: 'MADRID', from: '2025-01', to: '2025-12' });
// New companies, filtered (Business)
await api.webhooks.create({ url: 'https://your-server.com/new', event: 'company.created', filters: { province: ['MADRID'], keywords: ['software'] } });
// On your server, verify the signature with the raw body:
const evento = constructWebhookEvent(rawBody, req.headers['x-apiempresas-signature'], secret);
In Python: companies.subsidies(), companies.changes() and iter_changes(), api.stats(from_=...) and from apiempresas import construct_webhook_event. In PHP: $api->companies->subsidies(), changes() and changesAll(), $api->stats() and ApiEmpresas\Resources\Webhooks::constructEvent($raw, $firma, $secret).
16. Manual Code Examples
Implement the connection in minutes with these ready-to-use examples.
¡Hola! Soy el asistente de APIEmpresas. ¿En qué puedo ayudarte hoy?
Consultando...
Legal
Privacy Policy
How we collect, use, and protect your information.
1. Identity of the Data Controller
The data controller of the personal data collected on this platform is Ariel Martinez Hernandez (hereinafter, "SpainCompanyAPI"), with NIF 54994158P and address at República Dominicana 40, Bajo E, 28983, Parla (Madrid). You can contact us at soporte@apiempresas.es.
2. Purposes and Legal Basis
We process your personal data for the following purposes and legal bases:
Provision of the service and account management: Necessary for the performance of the contract (Terms of Use) upon registration.
Billing and collections: Compliance with legal and tax obligations.
Fraud prevention and security: Based on our legitimate interest to keep the platform secure.
Commercial communications and marketing: We rely on our legitimate interest to send you information about products or services similar to those contracted. You can object to this processing by checking the corresponding box during registration or unsubscribing at any time.
3. Data Retention
The data will be kept as long as you maintain your account active and it is necessary to provide the service. Once canceled, they will be kept duly blocked for the period required by applicable legislation (generally up to 5 years for tax and legal reasons).
4. Recipients and International Transfers
We do not sell your data to third parties. We may transfer them to strictly necessary providers (hosting, analytics, payment gateway such as Stripe). Some of these providers (e.g., Google, GitHub) may transfer data outside the EEA. We ensure they comply with the GDPR through standard contractual clauses or equivalent agreements.
Cloudflare Turnstile: We use Cloudflare Turnstile to protect our forms against spam and automated abuse. The use of Turnstile is subject to the Cloudflare Privacy Policy and Terms.
5. Your Rights (ARCO-POL)
You have the right to obtain confirmation as to whether we are processing your data. You also have the right to:
Access your personal data.
Request its rectification if it is inaccurate.
Request its deletion when it is no longer necessary.
Request the limitation or object to its processing.
Request data portability.
You can exercise them by sending an email to soporte@apiempresas.es. Likewise, if you consider that your data has not been properly processed, you have the right to file a claim with the Spanish Data Protection Agency (AEPD).
Last updated: 11/16/2026
Legal
Legal Notice & Terms of Use
Legal conditions for accessing and using the platform.
1. General Information (LSSI-CE)
In compliance with Law 34/2002 on Information Society Services and Electronic Commerce (LSSI-CE), it is reported that the owner of the SpainCompanyAPI web platform is:
Owner: Ariel Martinez Hernandez
NIF: 54994158P
Address: República Dominicana 40, Bajo E, 28983, Parla (Madrid)
Contact: soporte@apiempresas.es
2. Acceptance
By accessing or registering on the service, you acquire the status of User and accept these terms of use in their entirety. If you do not agree, do not use the platform.
3. Permitted Use Conditions
You agree to make appropriate and lawful use of the service. It is strictly prohibited to:
Attempt to access systems or data without authorization.
Interfere with operation by abusing rate limits, malicious scraping, or cyber attacks.
Use the service for illegal purposes or those that harm the rights of third parties.
4. Account and Security
You are solely responsible for maintaining the confidentiality of your credentials (password, API keys) and for all activity that occurs under your account.
5. Intellectual Property
All content on the platform (design, code, structure, and databases) is the exclusive property of Ariel Martinez Hernandez or has the corresponding licenses. Reproduction, distribution, or modification is not allowed without express authorization.
6. Limitation of Liability
The platform is provided "as is." Within the applicable legal framework, SpainCompanyAPI is not liable for direct or indirect damages derived from the use of information obtained through the API, nor for potential service interruptions due to external causes.
7. Jurisdiction and Applicable Law
These conditions are governed by Spanish law. For the resolution of any dispute derived from the use of the service, the parties submit to the courts and tribunals of the city of Madrid, expressly waiving any other jurisdiction that may apply.