Skip to content

Waveforms & Schematics

POST /api/waveforms/svg

Renders waveform data as an SVG plot, returned inside a JSON wrapper.

Request body:

{
"waveform": { "...WaveformData from simulation response..." },
"title": "Output Voltage",
"width": 800,
"height": 500,
"signals": ["v(2)"]
}
FieldTypeDefaultDescription
waveformWaveformData(required)Simulation result data
titlestring""Plot title
widthinteger800SVG width in pixels
heightinteger500SVG height in pixels
signalsstring[]allSignals to include in the plot

Response 200:

{
"svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" ...>...</svg>"
}
POST /api/waveforms/svg/raw

Same request body as above, but returns the raw SVG string with Content-Type: image/svg+xml. Useful for piping directly to a file:

Terminal window
curl -X POST https://spicebook.warehack.ing/api/waveforms/svg/raw \
-H "Content-Type: application/json" \
-d '{
"waveform": { ...waveform data... },
"title": "DC Sweep",
"signals": ["v(2)"]
}' \
-o plot.svg
POST /api/notebooks/{notebook_id}/cells/{cell_id}/schematic

No request body. The cell must be type spice. Parses the cell’s netlist and renders a circuit diagram.

Response 200:

{
"svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" ...>...</svg>",
"success": true,
"error": null,
"component_map": {
"R1": "resistor",
"V1": "voltage_source",
"C1": "capacitor"
}
}
FieldTypeDescription
svgstringSVG markup of the circuit diagram
successbooleanWhether generation succeeded
errorstring | nullError message if generation failed
component_mapobjectComponent reference → type mapping

The SVG includes standard IEEE symbols for components. Resistors with parseable values (0.01Ω–1GΩ) render with color-coded bands on the zigzag symbol.

Simulate a circuit and generate both a waveform plot and schematic:

Terminal window
# 1. Create a notebook with a SPICE cell and run it
RESPONSE=$(curl -s -X POST https://spicebook.warehack.ing/api/notebooks/compose \
-H "Content-Type: application/json" \
-d '{
"title": "RC Filter",
"cells": [
{"type": "spice", "source": "V1 in 0 AC 1\nR1 in out 1k\nC1 out 0 1u\n.ac dec 100 1 1meg\n.end"}
],
"run": true
}')
# 2. Extract IDs
NB_ID=$(echo $RESPONSE | jq -r '.id')
CELL_ID=$(echo $RESPONSE | jq -r '.cells[0].id')
# 3. Generate schematic
curl -s -X POST "https://spicebook.warehack.ing/api/notebooks/$NB_ID/cells/$CELL_ID/schematic" \
| jq -r '.svg' > schematic.svg
# 4. Generate waveform plot from simulation results
WAVEFORM=$(echo $RESPONSE | jq '.cells[0].outputs[0].data.waveform')
curl -s -X POST https://spicebook.warehack.ing/api/waveforms/svg/raw \
-H "Content-Type: application/json" \
-d "{\"waveform\": $WAVEFORM, \"title\": \"Bode Plot\"}" \
-o bode.svg