@proconnect-gouv/proconnect.registre_national_entreprises
v4.0.0
Published
> 🏢 Registre National des Entreprises API client for ProConnect
Readme
📋 @proconnect-gouv/proconnect.registre_national_entreprises
🏢 Registre National des Entreprises API client for ProConnect
A TypeScript client for interacting with the Registre National des Entreprises (RNE) API maintained by INPI.
⚙️ Installation
npm install @proconnect-gouv/proconnect.registre_national_entreprises📖 Usage
Authentication
First, obtain an access token using your RNE credentials:
import { getRegistreNationalEntreprisesAccessTokenFactory } from "@proconnect-gouv/proconnect.registre_national_entreprises/api";
const getAccessToken = getRegistreNationalEntreprisesAccessTokenFactory({
username: "your-username",
password: "your-password",
});
const token = await getAccessToken();Create a Client
Create an API client with your access token:
import { createRegistreNationalEntreprisesOpenApiClient } from "@proconnect-gouv/proconnect.registre_national_entreprises/client";
const client = createRegistreNationalEntreprisesOpenApiClient(token);Find Company by SIREN
Use the findBySiren factory to search for companies:
import { findBySirenFactory } from "@proconnect-gouv/proconnect.registre_national_entreprises/api";
const findBySiren = findBySirenFactory(client);
try {
const company = await findBySiren("123456789");
console.log(company);
} catch (error) {
if (error instanceof RegistreNationalEntreprisesApiError) {
console.error("API Error:", error.message);
}
}🔧 API Reference
Authentication
getRegistreNationalEntreprisesAccessTokenFactory(credentials, options?)- Returns a function to get access tokenscredentials: Object withusernameandpasswordoptions: Optional client configuration
Client Creation
createRegistreNationalEntreprisesOpenApiClient(token, options?)- Creates an OpenAPI client for the RNE APItoken: Bearer token for authenticationoptions: Optional client configuration (baseUrl, etc.)
Company Lookup
findBySirenFactory(client, optionsFn?)- Returns a function to find companies by SIREN numberclient: The RNE API clientoptionsFn: Optional function returning fetch options
Error Handling
RegistreNationalEntreprisesApiError- Base API error classRegistreNationalEntreprisesApiAuthError- Authentication-specific errors
Update OpenAPI Types
[!NOTE] We are manually updating the OpenAPI types from the RNE API specification.
Regenerate TypeScript types from the OpenAPI specification:
npm run build:openapi