Client API integration

After purchasing a subscription, users can: upload documents in Upload, view and edit parsed documents (Parsed file), assign EER codes, export tables (parsed, history, validated), send data to History by assigning it to a customer, use Validate/HP Finder and HP Finder functions. This documentation lists the endpoints needed to integrate your software with HSE Genius.

Base URL and authentication

API base URL:

https://kaimakicloud.hsegenius.com/api

Requests must include the JWT header:

Authorization: Bearer <access_token>

Login (obtain token)

POST /api/user/token/

Body (required schema):

{
  "email": str,
  "password": str
}

Response: {"access": "<JWT>", "refresh": "<refresh_token>"}. Use access in the header Authorization: Bearer <access>.

POST /api/user/token/refresh/

Returns a new access when the token has expired.

Body (required schema):

{
  "refresh": str
}
For integration, token and refresh are sufficient.

File upload

PDF file upload and confirmation to start processing. All endpoints under /api/files/.

GET /api/files/upload/

List uploaded documents (status created) for the authenticated user.

POST /api/files/upload/

Body: multipart/form-data. Schema:

{
  "pdf": file,          // optional
  "eer_codes": [str]    // optional
}

Response: created document data (e.g. id, filename).

POST /api/files/upload/confirm/

Confirm uploaded files and start processing (async task). Requires an active subscription.

Body: none.

Response: task_id, message: "Processing started!".

DELETE /api/files/upload/{id}/

Delete an uploaded document.

POST /api/files/upload/{id}/eer/

Add one or more EER codes to the document.

Body (required schema):

{
  "eer_codes": [str]
}
DELETE /api/files/upload/{id}/eer/{eer_code}/

Remove an EER code from the document.

POST /api/files/upload/eer/

Add one EER code to all documents currently in upload.

Body (required schema):

{
  "eer_code": str
}

Parsed file (parsed data)

Documents after processing (status confirmed): list, search, edit, assign EER, send to History with customer, validate to HP Finder. Endpoints under /api/files/imported/.

Record schema: parsed-record fields used in the request bodies of the validate-constraint, validate, history, hp-finder/proceed and hp-finder/export POST endpoints. All fields are optional.
{
  "nome_file": str|null,
  "nome_del_prodotto": str|null,
  "cod_art": str|null,
  "produttore": str|null,
  "zdhc": str|null,
  "data_di_revisione": str|null,
  "uso_appropriato": str|null,
  "stato_fisico": str|null,
  "h_punto_2": [int],
  "precautionary_statements": [str],
  "user_document_item_details": [{
    "composizione_punto_3": str|null,
    "cas": str|null,
    "ce_no": str|null,
    "reach": str|null,
    "h_punto_3": [int],
    "concentrazione": str|null,
    "svch": obj|null,
    "allegato_xiv": obj|null
  }],
  "ghs": [int],
  "pericoloso_per_lambiente": bool|null,
  "numero_onu": str|null,
  "gruppo_di_imballaggio": str|null,
  "classe": str|null,
  "punto_di_ebollizione": str,
  "ph": str,
  "cov": str,
  "notes": str|null,
  "seveso_code_h2": str,
  "seveso_code_p15": str,
  "sds_8_2_technical_controls": str|null,
  "sds_8_2_ppe_hands": str|null,
  "sds_8_2_ppe_skin": str|null,
  "sds_8_2_ppe_body": str|null,
  "sds_8_2_ppe_eyes": str|null,
  "sds_8_2_ppe_respiratory": str|null,
  "sds_8_2_hygiene_other": str|null,
  "sds_8_2_ppe_environmental_exposure": str|null,
  "sds_8_2_ppe_complementary_emergency_measures": str|null,
  "sds_8_2_ppe_thermal_risk": str|null
}
GET /api/files/imported/

List parsed records. Query: eer_codes (filter).

GET /api/files/imported/{id}/

Single parsed record details.

PATCH /api/files/imported/{id}/

Update record data (e.g. product name, composition, item fields). Body: fields to update, partial (see Record schema above).

POST /api/files/imported/{id}/eer/{eer_code}/

Add an EER code to the document linked to the parsed record.

Body: none (parameters in the path).

DELETE /api/files/imported/{id}/eer/{eer_code}/

Remove an EER code from the record's document.

POST /api/files/imported/validate-constraint/

Check if selected records can be validated (e.g. EER already in HP Finder).

Body (schema): record fields, all optional (see Record schema above).

POST /api/files/imported/validate/

Move records from Parsed to Validated (HP Finder). Requires EER assigned.

Body (schema):

{
  "id": [int],        // optional, ids of the records to validate
  ...record fields    // optional, see "Record schema"
}
POST /api/files/imported/history/

Assign records to a customer and send to History.

Body (schema):

{
  "id": [int],                 // optional, record ids
  "customer": int|null,        // customer id
  "remove_from_parsed": bool,  // true to move to history and remove from parsed
  ...record fields             // optional, see "Record schema"
}
GET /api/files/imported/export/

Export parsed file table to Excel (with filters). Query: language (optional).

Validated / HP Finder

Validated data (after validate from Parsed): list, export table, mark as processed and move to History.

GET /api/files/hp-finder/

List validated records. Query: eer_codes (EER filter).

POST /api/files/hp-finder/proceed/

Mark records as processed and move to history. Required query: eer_codes.

Body (schema):

{
  "id": [int],                   // optional, record ids
  "language": enum("it", "en"),  // optional
  "customer": int|null,          // optional, customer id
  ...record fields               // optional, see "Record schema"
}
POST /api/files/hp-finder/export/

Export validated filtered data to Excel. Query: eer_codes (required), language (optional, default en). Response: Excel file as attachment.

Body (schema):

{
  "id": [int],                   // optional, record ids
  "language": enum("it", "en"),  // optional
  "customer": int|null,          // optional, customer id
  ...record fields               // optional, see "Record schema"
}

HP Finder (H/P codes)

List of Hazard/Process codes used for search and HP Finder functions.

GET /api/files/hp/

List of all HP ordered by h_punto.

History

Document history (company-wide: all company users).

GET /api/files/archive/

List documents in history.

GET /api/files/archive/export/

Export filtered history to Excel. Query: language (optional). Response: Excel file as attachment.

DELETE /api/files/archive/{id}/

Delete a record from history. This endpoint is only available for admin.

Export

Excel export from parsed data, validated data and history.

GET /api/files/imported/export/

Export parsed data (status confirmed) to Excel. Query: language (optional). Response: Excel attachment.

GET /api/files/archive/export/

Export history to Excel. Query: language. Response: Excel attachment.

POST /api/files/hp-finder/export/

Export validated data to Excel. Query: eer_codes, language. Body: see the schema in the Validated / HP Finder section. Response: Excel attachment.

EER codes

List of available EER codes (for upload, filters and validation). Under /api/eer/.

GET /api/eer/eer/

List EER codes. Useful for dropdowns when assigning EER to documents or filtering parsed/validated.

Customers

Company customers: for assigning documents sent to History. Under /api/customer/.

GET /api/customer/

List company customers. Use the id in the body of POST /api/files/imported/history/ (field customer).

Users

Company user management (company admin only). Under /api/company/.

GET /api/company/user/

List users in the authenticated user's company.

POST /api/company/user/

Create or invite user.

Body (required schema):

{
  "email": str,
  "first_name": str,
  "last_name": str,
  "phone": str,
  "country_code": str,
  "role": enum("admin", "employee", "viewer", "auditor")
}
GET /api/company/user/{id}/

Single user details.

PATCH /api/company/user/{id}/

Update user (e.g. role).

DELETE /api/company/user/{id}/

Remove user from company.

Subscription

Active company subscription details.

GET /api/payment/subscription/

Returns the company's active subscription (plan, limits, status). 404 if no active subscription.

Analytics (admin only)

Analytical dashboard on the company's SDS inventory. Accessible only to company admins (CompanyAdminPermission). All endpoints under /api/files/.

These endpoints require the authenticated user to be a company admin. They return 403 Forbidden for users with role employee or viewer.
GET /api/files/analytics/

Returns aggregated metrics for the SDS inventory. Optional query: user_id (filter by a specific company user).

Response (JSON object):

  • kpi — total, validated, in_progress, svch, this_month, trend
  • ghs — top GHS pictograms with document count
  • hp — top HP hazard classes (section 2) with count
  • dpi — % SDS per required PPE type (sec. 8.2)
  • clienti — SDS distribution by customer/site
  • heatmap — monthly uploads over the last 12 months
  • alerts — regulatory alerts (svch, allegato_xiv, env_hazard)
  • extra_alerts — special alerts: cmr, alert_conc, seveso, old_sds
  • eer — hazardous vs non-hazardous waste count
  • produttori — top manufacturers by SDS count
  • users — company user list with document count (for filter bar)
GET /api/files/analytics/export/

Exports the same dashboard metrics as a downloadable file.

Query:

  • formatcsv (default) or xlsx
  • user_id — optional, filter by user

Response: .csv or .xlsx attachment with separate sheets for KPI, GHS, HP, DPI, Customers, Uploads, Compliance, EER, Manufacturers.