MGBI provides a comprehensive API for retrieving data from public registers and records, including the National Court Register (KRS). You can find a list of data sources available through this service at:
👉 Public Registers API
This guide covers the API for the KRS entity search tool, which we provide as part of the following product:
👉 National Court Register API (KRS API) - Entity Search Tool
Below, we describe how you can use the API to download a current extract from the National Court Register (KRS) in PDF format for a specific entity based on its KRS number.
Step 1: Obtain an API authorization key
To obtain the authorization key required to call endpoints available in the MGBI API, please contact us using the contact form on the product page:
👉 National Court Register API (KRS API) - Entity Search
Step 2: Call the Get Records endpoint
We make the data available in the KRS entity search engine accessible via the MGBI API in a data model with the identifier pl-krs-wp-record.
The API provides a Get Records endpoint for this model, which returns records containing the content of the current and full extracts from the National Court Register (KRS) for entities that meet the specified criteria.
👉 Documentation for the Get Records endpoint for the pl-krs-wp-record model
To retrieve data for a single entity from the KRS, you must provide its registration number—KRS, NIP, or REGON—in the Get Records endpoint. Example of calling the Get Records endpoint with a KRS number:
GET /v1/models/pl-krs-wp-record/records?identifiers.pl_krs=[KRS number] HTTP/1.1
Host: api.mgbi.pl
Authorization: [authorization key]
Step 3: Find the download link in the response
A successful call to the Get Records endpoint returns a list of records that meet the specified criteria.
In the example above, the endpoint should return a list of results containing a single record:
{
"count": 1,
"pages": 1,
"results": [
{
"id": [identyfikator rekordu],
"identifiers": [identyfikatory podmiotu i powiązanych osób],
"content": [treść odpisu aktualnego i pełnego],
"files": [pliki odpisów w formacie PDF],
"relations": [relacje podmiotu z innymi podmiotami i osobami],
"meta": [metadane rekordu]
}
]
}
You can find the URL for the PDF file containing the current extract from the National Court Register (KRS) for the searched entity in the ` files.current_excerpt_pdf_file.url` field.
Step 4: Download the file contents and save them or send them to your browser
To download the content of the file containing the current excerpt, send an HTTP GET request using the URL retrieved from the `files.current_excerpt_pdf_file.url ` field and the API authorization key:
GET [file path] HTTP/1.1
Host: api.mgbi.pl
Authorization: [authorization key]
You can also send the file content directly to your app user’s web browser. In this case, set the value of the HTTP Content-Type header—which informs the browser of the file format—based on the content of the ` files.current_excerpt_pdf_file.content_type` field.
Learn more:
👉 Data structure in the pl-krs-wp-record model
👉 Endpoint documentation for the pl-krs-wp-record model