Developer Portal

R 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).

library(httr)
library(jsonlite)

base_url <- "https://api.bionexusdiscovery.com"

# Single-endpoint prediction
resp <- POST(
  paste0(base_url, "/predict"),
  body = list(smiles = "CC(=O)Nc1ccc(O)cc1", endpoint = "hepatotox"),
  encode = "json"
)
result <- content(resp, as = "parsed")
print(result$label)
print(result$probability)

# Full integrated assessment
resp <- POST(
  paste0(base_url, "/predict/integrated"),
  body = list(
    smiles = "CC(=O)Nc1ccc(O)cc1",
    include_interpretation = TRUE,
    top_k = 8
  ),
  encode = "json"
)
result <- content(resp, as = "parsed")
print(result$integrated_assessment$overall_risk_level)