🔌 Server API
What is the Server API?
What is the Server API?
This section is the integration manual for embedding the Legit.Health iframe into native iOS apps, progressive web apps, Wordpress sites and any other host that can render an ``.
The iframe fires analysis_completed after the image has been processed and the diagnostic report is available.
The anamnesisGeneral field captures the structured patient history collected before the image is submitted for analysis, modelled as a FHIR QuestionnaireResponse.
The anamnesisGeneral field captures the structured patient history collected before the image is submitted for analysis. It rides at the top level of the data payload alongside bodySite and pathology.
On Android the iframe communicates with the host application through an injected JavaScript object called legitHealthJsObject. Use WebViewCompat.postWebMessage to wire it up.
Post an anonymous diagnostic report
Once the iframe posts an analysis_completed message, your backend uses the report identifier to fetch the full DiagnosticReport from the API.
This page explains how the iframe authenticates and how to load it securely in production. Three credentials are involved. Keep them straight and everything else follows.
The condition block describes the suspected or most likely pathology together with the body site where the lesion was photographed. Both fields use FHIR coding[] arrays so the same condition or location can be expressed in the proprietary catalog and in ICD-11 simultaneously.
These fields describe where the lesion is located (bodySite) and what condition the device suspects (pathology). They appear at the top level of the data payload and are the primary keys you use to route a report to downstream workflows.
The iframe communicates with the host application by posting callback messages. Every callback has a stable shape and is delivered through a transport that depends on where the iframe is embedded.
No, currently we only admit creating EpisodeOfCare with an assigned condition. This eases the tracking of the condition inside the application.
No, we do not accept images in .HEIC format. We accept .JPG and .PNG.
The result.conclusions array represents the list of possible conditions identified, each with a probability and standardized coding. Every entry follows the same coding[] shape as condition.pathology: a proprietary entry plus an ICD-11 mapping.
The conclusions field lives under result and lists the ranked diagnostic hypotheses the device considered for the case. Each entry pairs a pathology type with its associated probability, and the array is sorted by probability descending, so the most likely outcome is always at index 0. Probabilities are percentages from 0 to 100.
The iframe URL accepts a number of query parameters that control its behaviour and appearance. This page is the canonical reference: every parameter the iframe supports is listed below, and each one is explained in detail in the sections that follow.
Get a diagnostic report
Once the iframe finishes processing an upload and emits the analysis_completed callback with the report identifier, your backend retrieves the diagnostic report on demand from the API. To obtain it as a FHIR-compliant payload, call the endpoint with the ?format=fhir parameter; see the API Endpoint page.
Here, you will find some of the most common questions asked by our clients. If you have any other questions, please feel free to contact us.
The most important feature of the API integration is receiving a DiagnosticReport with the information created by the Artificial Intelligence.
Besides getting the DiagnosticReports linked to patients between your system and our, you can also fetch the AnonymousDiagnosticReports that you had sent, ie, those which are not linked to any patient.
If you are receiving the following message when consuming our API,
Interpreting the results requires careful consideration of the image quality and the context in which it was taken. By following the recommended guidelines, you can ensure more accurate and reliable results.
The iframe fires image_rejected when an uploaded image does not meet the quality threshold (DIQA score below 60 by default; see the Customize page, Image quality section).
Integrating Legit.Health through the medical device's own API, without the app, is possible, and it puts the work the app does on the integrator.
How to integrate Legit.Health into your healthcare systems. Legit.Health is integrated as an app (an iframe) embedded in your system, with its own API for the reports.
The iframe fires invalidcompanykey when it cannot load because the company query parameter is invalid.
On iOS the iframe communicates with the host application through the webkit bridge. Configure a WKWebView with a script-message handler named bridge and decode the JSON string the iframe posts.
In this section, we present practical examples of workflows that can be integrated into your systems, utilizing the data provided by our device's API.
In this section, we present practical examples of workflows that can be integrated into your systems, utilizing the data provided by our device's API.
In order to begin the Server API integration, the first step is to provide information about the organisation that will manage the account.
Two fields in the FHIR payload carry imagery for the case: macroscopicMedia at the top level of data (the lesion photo submitted for analysis, as a FHIR Media resource), and result.observations (the array of every media that was actually sent to the algorithm for analysis).
Two fields in the payload carry imagery for the case: macroscopicMedia at the top level of data (the lesion photo submitted for analysis, plus any detection annotations drawn over it), and result.observations (the array of every media that was actually sent to the algorithm for analysis).
The result field captures the diagnostic process output. Three sibling fields describe the classifier's behaviour for this case: performanceIndicators, clinicalIndicators, and analysisDuration.
The result field encapsulates the comprehensive results of the diagnostic process. Three subfields describe the classifier's behaviour for this case: metrics, preliminaryFindings, and iaSeconds.
Once the user finishes uploading images, the iframe runs the analysis and produces a DiagnosticReport. You have three options for consuming the result, depending on how deeply you want to integrate the output into your product.
Connect a patient
Each completed analysis produces a downloadable PDF report that mirrors the on-screen UI. The PDF is intended for archival in EHR systems that expect document attachments and for sharing the report with parties outside the iframe session.
Connect a practitioner
Diga-nos do que você precisa. Para um problema com uma integração existente, o assistente responde com base neste manual de integração sempre que pode e encaminha à nossa equipe de suporte, como um ticket, tudo o que não conseguir resolver.
This page walks you through the minimum work required to embed the iframe in your application, run an analysis, and retrieve the resulting DiagnosticReport. Everything described here can be customised further; see the Configure → Customize page for the full parameter reference.
The result.questionnaires array carries the scoring systems applied to the imagery, each modelled as a FHIR QuestionnaireResponse. Every entry records the scoring methodology, the computed score and severity band, the facet answers that fed into it, and an optional explainability media overlay.
The scoringSystems field lives under result and houses one or more scoring models for the identified pathology. These models come into play when the likelihood of the most probable conclusion surpasses a certain threshold, and they are used to estimate the severity of that condition.
Once the iframe finishes processing an upload and emits the analysis_completed callback with the report identifier, your backend retrieves the diagnostic report on demand from the API. See the API Endpoint page for the request format.
The iframe returns a JSON payload through the analysis_completed callback, and the full diagnostic report can be pulled from the API using the anonymousDiagnosticReportId it carries. That JSON is the raw material your host application uses to drive workflows.
The fastest way to surface a result is to let the iframe render the report itself. As soon as the analysis completes, the components below appear inside the iframe, with no additional rendering work required on the integrator side.
Embedding the iframe in a regular web page is the most common scenario. You drop an ` tag into your markup and listen for messages on window`.
In the scope of the domain of programming the integration of the device, the term condition is a pathology, as define in FHIR, in a body site of a patient.
Only the image of the skin lesion is required for the API to return a value.
The Swagger contains the full list of codes for selecting a body site or a pathology in the description of the corresponding properties.