China Company Registration API in PostgreSQL

Store the company registration response as dated evidence in PostgreSQL and create a queryable view of company, shareholder, and change fields.

ArticlesPublished by ChinaValidatePublished December 3, 2026Last updated December 3, 2026

Retrieve company registration details and available shareholder, personnel and change records.

View API documentationAPI workspace
China Company Registration API in PostgreSQL

A verification service obtains a Chinese company's registration details twice in one year. The first result informed a purchasing decision. The second result comes after a name change. A database that keeps only one mutable profile can answer what the application shows today. It can no longer explain which record the first reviewer saw. The storage design needs an original observation with a date and a practical way to query the most recent usable fields.

Use the ChinaValidate Company Registration Details API for the identified company. Keep the exact response text in a protected evidence record and a PostgreSQL JSON representation for querying. Project a small number of identifiers to columns where they support reliable joins. The API also documents groups for shareholder records, personnel and registration changes. Those groups belong to the observation that returned them, even when the database shows a current company row separately. ChinaValidate company registration details API · PostgreSQL JSON types

A verified identity and a dated result

Begin with a company you can identify using the registered Chinese name or Unified Social Credit Code. Save the source of that identity. The registration details endpoint accepts the identifier in company_name_or_credit_code. A usable company item exposes registration_data and may have other groups such as shareholder_data, employee_data or change_record_data. A confirmed credit code is a good join key among records for one legal company. Where the returned identity remains uncertain, save the result in the request's review record until someone can make the link.

The root of a company group and the account that buys from it are different identifiers in a procurement system. Let separate vendor accounts point to one confirmed legal company when appropriate. Keep the observations tied to the scope in which the data was acquired. A tenant or organization boundary belongs in the storage model and queries, along with the authority to see any underlying evidence. In particular, a local database can hold retrieved company data without granting every user access to the original response. Review the product's conditions for using and distributing the results before sharing an export. ChinaValidate terms of service

There are at least three timestamps an analyst can encounter. The time the company was registered is a reported fact in the record. A registration change can have its own reported date. The observation timestamp is the time your integration actually received the data. A connection timeout might have an attempt timestamp without a result. Capturing these times separately prevents an analyst from reading the database load date as the legal date of an event.

Raw response text and a JSON query column

PostgreSQL documents different behavior for its JSON types. jsonb uses a decomposed representation that supports indexing and query operations. It does not retain the original whitespace or order of object keys. If you need the response verbatim for audit or exact comparisons, keep the received text or its controlled object reference. Treat the query column as a representation for reading and projection. That distinction matters if you plan to compare raw response hashes or preserve how the original payload was returned. PostgreSQL JSON and JSONB behavior

Here is a narrow database example for one verified company per completed observation. The application provides an internal submission ID that is stable for its own recovery process. An observed result for a real new request gets a new submission ID. For a request that failed or where the expected company's identity could not be confirmed, keep a separate attempt record in your workflow. The evidence table below only takes the path where the caller has a usable registered identity.

CREATE TABLE company_registration_observations (
    organization_id bigint NOT NULL,
    submission_id text NOT NULL,
    credit_code text NOT NULL,
    observed_at timestamptz NOT NULL,
    original_response text NOT NULL,
    response_json jsonb NOT NULL,
    PRIMARY KEY (organization_id, submission_id),
    CHECK (jsonb_typeof(response_json) = 'object')
);

CREATE INDEX company_registration_latest_idx
    ON company_registration_observations
       (organization_id, credit_code, observed_at DESC, submission_id DESC);

PREPARE save_company_observation(bigint, text, text, timestamptz, text) AS
INSERT INTO company_registration_observations (
    organization_id, submission_id, credit_code, observed_at,
    original_response, response_json
) VALUES ($1, $2, $3, $4, $5, $5::jsonb)
ON CONFLICT (organization_id, submission_id) DO NOTHING;

PREPARE latest_company_registration(bigint, text) AS
SELECT submission_id, observed_at,
       response_json #>> '{data,items,0,registration_data,company_name}' AS company_name,
       response_json #> '{data,items,0,shareholder_data,items}' AS shareholder_items,
       response_json #> '{data,items,0,change_record_data,items}' AS change_items
FROM company_registration_observations
WHERE organization_id = $1 AND credit_code = $2
ORDER BY observed_at DESC, submission_id DESC
LIMIT 1;

The example reads the first item because the caller only writes a response after checking that it has one selected company and that this item is the stated company. If your application allows several items, store the selected item index or materialize the verified item in a separate projection. Keep the complete authorized original response in the evidence record. Do not assume a first list item was the company you intended to check merely because a query returned records.

The unique submission key is also useful after a network or database interruption. If a worker retries just the database write, an existing row under the same key means the submission was already recorded. Read that row and confirm its company, time and evidence match the data expected for the submission. A conflict is safe to ignore only when it is a repeat of the same work. If the submission key points to different content, surface the inconsistency. PostgreSQL's conflict handling supplies the atomic write behavior. Your application still defines what the identity means. PostgreSQL INSERT and conflict handling

Design indexes around the retrievals that exist. The sample's B-tree supports an organization-scoped query for the most recent observation of one company. An analyst who often queries many observations for a field inside the JSON may need a different index or a deliberately populated column for that field. Test the query with representative data before adding an index on all of the evidence. Keep the row-level identifiers and original documents under the access rules even if a derived table is created for reporting.

It can also help to show the difference between missing evidence and a present empty collection directly in a database query. For example, have the application check whether the parent key is present before deriving a count from an array. An explicit null, an empty array and an object with a reported count each preserve different facts. When a report uses a fallback display label, keep the underlying value and state available for a later reader.

Related fields without lost context

A company may have a returned shareholder group with a count that exceeds the number of list items available in a response. Preserve both the count and the actual set when present. A reporting table that adds one row for each observed shareholder can also carry the originating observation ID. If the source provides an empty response or the shareholder section is absent, give the reviewer that exact distinction. Avoid making the absence of data a claim that the company has no shareholders.

Evidence element A useful database representation
Confirmed legal identity Original legal name and credit code, with the source and date
One retrieved response Observation tied to a stable submission ID and original response text
Shareholders present in the response Rows or a JSON collection tied to that observation
No usable identity or completed empty result Dated attempt outcome outside the confirmed company projection
Reported registration change Original fields for the item, date, before value and after value
Purchasing decision made using one version Link to the exact observation that informed the decision

The regulator's disclosure rules describe separate categories of publicly disclosed enterprise information. Registration details, filings and enterprise-reported information should stay attributable to their original record when the reviewer opens the data later. When viewing a shareholder percentage, for example, show the date and source of the record carrying it. A database join can help bring the evidence together, but the meaning comes from the source and time of each value. SAMR enterprise information disclosure rules

Read back the decision

Acceptance testing can start with synthetic observations. Save a first record, simulate a later company name change for the same confirmed credit code, and assert that a new check shows the latest value. Open a purchase that used the first observation and prove its evidence link still opens that version. Test an empty shareholder group and a missing shareholder group. If a reporting query collapses both to the same denial or zero value, adjust it to preserve the distinction. Test an attempt with a mismatched company code and ensure it cannot update the confirmed view.

For the insert path, replay one submission with identical contents and confirm there is still one observation for it. Replay the same identifier with different contents and make sure the application checks the existing evidence. Test those cases through the normal client path rather than directly bypassing its validation. Lastly, try the common retrievals under a real reviewer role. The team should be able to go from a company to the latest usable observation, or from an older decision to the exact original response that supported it. Both routes should remain reliable after another lookup is performed.