Spectra Module

The spectra module parses experimental NMR data into NMRium-compatible JSON. All operations delegate to the nmr-cli parse-spectra toolchain running in the nmr-converter container.

Base path: /latest/spectra

Endpoints

POST /parse/url

Parse spectra from a remote URL.

Request body (JSON):

json
{
  "url": "https://example.com/spectra/sample.zip",
  "capture_snapshot": false,
  "auto_processing": true,
  "auto_detection": true,
  "raw_data": false
}
FieldTypeDefaultDescription
urlURLrequiredLink to NMR data (JCAMP-DX, Bruker zip, etc.)
capture_snapshotboolfalseGenerate a PNG snapshot of the spectrum
auto_processingboolfalseProcess FID → FT spectra automatically
auto_detectionboolfalseDetect ranges and zones automatically
raw_databoolfalseEmbed raw data in the output

Response: NMRium-compatible JSON (application/json).

POST /parse/file

Parse an uploaded spectra file (multipart/form-data).

Form fieldTypeDefaultDescription
filefilerequiredJCAMP-DX, Bruker zip, or other supported format
capture_snapshotboolfalseGenerate snapshot image
auto_processingboolfalseFID → FT processing
auto_detectionboolfalseRange/zone detection
raw_databoolfalseInclude raw data

POST /parse/publication-string

Reconstruct a spectrum from an ACS-style NMR publication string. Send the string as plain text (not JSON).

Example body:

1H NMR (400 MHz, CDCl3) δ 7.26 (s, 1H), 2.10 (s, 3H)

POST /parse/peaks

Convert a peak list into a simulated 1D spectrum.

Request body (JSON):

json
{
  "peaks": [
    { "x": 7.26, "y": 1, "width": 1 },
    { "x": 2.10, "y": 1, "width": 1 }
  ],
  "options": {
    "nucleus": "1H",
    "frequency": 400,
    "nbPoints": 131072,
    "from": 0,
    "to": 12
  }
}
Peak fieldRequiredDescription
xyesChemical shift (ppm)
ynoIntensity (default 1.0)
widthnoPeak width in Hz (default 1.0)

Supported input formats

  • JCAMP-DX (.jdx, .dx)
  • Bruker directories (zipped)
  • Other formats supported by nmr-load-save

Error codes

StatusMeaning
408Processing exceeded 120 s timeout
422Parse error or invalid input
500Docker or nmr-converter container unavailable

Example

bash
curl -X POST "https://dev.nmrkit.nmrxiv.org/latest/spectra/parse/url" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://cheminfo.github.io/bruker-data-test/data/zipped/aspirin-1h.zip",
    "auto_processing": true
  }' \
  -o spectrum.json

See also