Developer Portal

JavaScript Examples

A single-endpoint prediction and a full integrated assessment, matching the current deployed API contract exactly (field names verified against the backend source, not guessed).

const BASE_URL = "https://api.bionexusdiscovery.com";

// Single-endpoint prediction
const res = await fetch(`${BASE_URL}/predict`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ smiles: "CC(=O)Nc1ccc(O)cc1", endpoint: "hepatotox" }),
});
const data = await res.json();
console.log(data.label, data.probability);

// Full integrated assessment
const integrated = await fetch(`${BASE_URL}/predict/integrated`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    smiles: "CC(=O)Nc1ccc(O)cc1",
    include_interpretation: true,
    top_k: 8,
  }),
}).then((r) => r.json());

console.log(integrated.integrated_assessment.overall_risk_level);