Beta API. See the stability policy.

Creating your own components

If a motor, propeller or battery isn't in the catalog, you can add it yourself and use it in your runs. It is private to your account. This article lists the fields each kind of part needs. To add a part on the website, see Add your own part.

You create a part with POST /v1/components. Send a type (motor, battery or propeller), a name and a spec_json with the part's numbers. The reply has an id that starts with comp_. Use that id in a run, the same as a catalog part.

python
motor = client.components.create(
    type="motor",
    name="My Custom 4260 800Kv",
    spec_json={ ... },
)

If a required field is missing, you get a 400 that names the field, says what it means and gives its unit. Keys that ThrustLab doesn't know are stored and ignored.

A successful reply can also have a warnings list. A warning means a number looks unlikely, for example a motor resistance far from what that motor's size and Kv would give. Your part is saved anyway. A warning usually means a mix-up between milliohms and ohms, so check the datasheet again.

Motor

Motor
FieldWhat it isUnitNeeded
kvHow fast the motor turns for each voltrev/min per VYes
nThe number of magnet poleswhole numberYes
RWinding resistance measured between two motor wiresohmYes
diameterDiameter of the stator or canmmYes
lengthLength of the motor bodymmYes
weightWeight of the motorgYes
u_nominalThe voltage at which the no-load current was measuredVYes
iq_nominalThe no-load current, also called idle currentAYes
iq_maxThe highest current the motor takesAYes, or power_max
power_maxThe highest power the motor takesWYes, or iq_max
LWinding inductanceHNo. Estimated if left out
inertiaHow hard it is to spin the rotorkg·m²No. Estimated if left out, but a run over time needs it
topologyoutrunner or inrunnerNo. The default is outrunner
brandThe makerNo

Use the resistance from the datasheet, the one measured between two wires. ThrustLab converts it itself. If the no-load current is much too high for a real motor, you get a 400 on spec_json.iq_nominal. That usually means a maximum current went into the wrong field.

Battery

A battery pack needs its size, how its cells are wired, its capacity and weight, and one figure for its internal resistance. A bench power supply (chemistry set to source) needs only series_cells and source_voltage.

Battery
FieldWhat it isUnitNeeded
chemistrylipo, lihv, nmc, nca, lfp, nimh or sourceYes
length_mm, width_mm, height_mmThe size of the packmm, from 1 to 2000Yes, for a pack
series_cellsCells in series (the S number)count, at most 24Yes
parallel_cellsCells in parallel (the P number)countYes, for a pack
total_capacity_mAhThe capacity of the packmAhYes, for a pack
weight_gThe weight of the packgYes, for a pack
c_ratingThe discharge rating1/hYes, for a pack, or pack_resistance_mOhm
pack_resistance_mOhmThe resistance of the whole packmΩInstead of c_rating
source_voltageThe voltage of the supplyVYes, for a source
v_min_per_cellThe lowest voltage per cell before the run stopsVNo. Each chemistry has a default
form_factorpouch or cylindricalNo. ThrustLab works it out from the chemistry
cell_modelThe cell, for example 21700No. Cylindrical packs only
pack_styleflat, hump or tNo. Cylindrical packs only
internal_resistance_mOhmThe resistance of one cellmΩNo
brandThe makerNo

Series cells times parallel cells can't be more than 256.

Propeller

A propeller is described by its blade shape. You give the radius, chord and twist at several points along the blade, from the hub to the tip. The propeller maker on the website builds these lists for you. Saving a propeller needs the Pro plan. A free account gets a 402.

Propeller
FieldWhat it isUnitNeeded
diameterThe diameter of the propellerinchYes
pitchThe pitch of the propellerinchYes
weightThe weight of the propellergYes
rotationcw, ccw or both, seen from aboveYes
radiusThe distance from the axis at each pointmYes
chordThe width of the blade at each pointmYes
twistThe twist of the blade at each pointdegreesYes
num_bladesThe number of blades, from 1 to 16countNo. The default is 2
maxRPMThe highest speed the propeller is rated forrev/minNo
inertiaHow hard it is to spin the propellerkg·m²No. Estimated if left out, but a run over time needs it
brandThe makerNo

The three lists must have the same length, with at least 2 points and at most 50. radius must increase from the hub to the tip. The tip radius must match the diameter to within 5 percent, because otherwise the numbers describe two different blades. If num_blades isn't a whole number from 1 to 16, you get a 422.

A complete example

This script creates a motor, a battery and a propeller, and prints their IDs:

Python
"""Create your own custom motor, battery, and propeller from spec_json.

Run it:
    export THRUSTLAB_API_KEY=key_...        # never hard-code the key
    python examples/components/create_component.py

A custom component is `POST /v1/components` with three fields: `type`
(motor | battery | propeller), `name`, and a type-specific `spec_json` map. The
create is scoped to your account (source="user", visibility="private"); the
returned resource echoes back an `id` (comp_...) you pass to a simulation.

Each create below is `client.components.create(...)`. Field names, units, and
accepted ranges come from the server-side validators — see the reference page
for the full tables.

Notes on validation:
  * Battery: a physical pack needs chemistry, cell layout, capacity, weight_g,
    one resistance figure (c_rating or pack_resistance_mOhm), and bounding-box
    dims; form_factor is derived from chemistry when omitted.
  * Propeller: per-station radius/chord/twist and rotation are required, and
    persisting a propeller needs the Pro plan — the create below reports the
    tier gate cleanly on a free account.
"""

from thrustlab import Client
from thrustlab.exceptions import APIError

client = Client()  # reads $THRUSTLAB_API_KEY from the environment

# ---- motor ---------------------------------------------------------------
# Required: kv, n (pole count), R (phase-to-phase winding resistance, ohms),
# weight, diameter, length, u_nominal, iq_nominal, and one of iq_max /
# power_max. Inductance L and rotor inertia are auto-estimated from
# kv/n/diameter/length/weight — inertia is required for runs over time,
# so give real dimensions and mass.
motor = client.components.create(
    type="motor",
    name="My Custom 4260 800Kv",
    spec_json={
        "brand": "Custom",
        "kv": 800.0,  # rpm per volt
        "n": 14,  # magnet pole count
        "R": 0.042,  # phase-to-phase winding resistance (ohm)
        "weight": 120.0,  # g
        "diameter": 42.0,  # mm (drives L / inertia estimation)
        "length": 25.0,  # mm
        "u_nominal": 10.0,  # Test voltage (V) for no-load current
        "iq_nominal": 1.1,  # No-load current (A), measured at 10 V
        "iq_max": 65.0,  # max quadrature current (A)
        "power_max": 960.0,  # max electrical power (W)
        "topology": "outrunner",
    },
)
print(f"created motor {motor['id']}")

# ---- battery -------------------------------------------------------------
# chemistry in {lipo, lihv, nmc, nca, lfp, nimh, source}. A physical pack needs
# its cell layout, capacity, weight_g, one resistance figure (c_rating or
# pack_resistance_mOhm), and length/width/height_mm (1..2000 mm). form_factor
# is derived (lipo -> pouch) when omitted. Pack cap: series <= 24, S*P <= 256.
battery = client.components.create(
    type="battery",
    name="My Custom 4S 5000mAh",
    spec_json={
        "brand": "Custom",
        "chemistry": "lipo",
        "series_cells": 4,
        "parallel_cells": 1,
        "total_capacity_mAh": 5000.0,
        "c_rating": 75.0,
        "weight_g": 480.0,
        "length_mm": 145.0,  # required for a physical chemistry
        "width_mm": 49.0,
        "height_mm": 33.0,
    },
)
print(f"created battery {battery['id']}")

# ---- propeller (hobbyist tier or higher) ---------------------------------
# Required: diameter, pitch, rotation, weight, and the per-station blade
# geometry — parallel radius/chord/twist arrays, hub -> tip (<= 50 stations;
# radius and chord in METERS, twist in degrees). inertia is required for
# runs over time and is estimated from weight + diameter when
# omitted.
try:
    prop = client.components.create(
        type="propeller",
        name="My Custom 10.5x4.5",
        spec_json={
            "brand": "Custom",
            "diameter": 10.5,  # inch
            "pitch": 4.5,  # inch
            "num_blades": 2,
            "rotation": "ccw",  # top view; "cw" | "ccw" | "both"
            "weight": 14.0,  # g
            "inertia": 8.3e-5,  # kg*m^2, required for runs over time
            # per-station geometry, hub -> tip (r/R = 0.20 .. 1.00)
            "radius": [0.0267, 0.0400, 0.0600, 0.0800, 0.1000, 0.1200, 0.1334],  # m
            "chord": [0.016, 0.019, 0.022, 0.021, 0.018, 0.014, 0.008],  # m
            "twist": [30.0, 24.0, 17.0, 12.8, 10.3, 8.6, 7.8],  # deg
        },
    )
    print(f"created propeller {prop['id']}")
except APIError as exc:
    # A free account 402s here (propeller persistence is a creator_edit gate).
    print(f"propeller create skipped: {exc}")

To use a part in a run, pass its id as motor_component_id or propeller_component_id in a rotor group, or as battery_component_id on the run. For how to read what comes back, see Test bench outputs.