def parse_timedelta_from_api(data_dict, key_root):
    """Returns a dict with the appropriate key for filling a two-part timedelta
    field where the fields are named <key_root>_number and <key_root>_units.

    Parameters
    ----------
    data_dict: dict
        API json response containing a key matching the key_root argument.
    key_root: str
        The prefix used to identify the timedelta `<input>` elements. This
        should match the metadata dictionaries key for accessing the value.

    Returns
    -------
    dict
        dict with keys <key_root>_number and <key_root>_units set to the
        appropriate values.

    Raises
    ------
    TypeError
        If the interval length key is set to a non-numeric value or does not
        exist.
    """
    interval_minutes = data_dict.get(key_root)
    # set minutes as default interval_units, as these are returned by the API
    interval_units = 'minutes'
    if interval_minutes % 1440 == 0:
        interval_units = 'days'
        interval_value = int(interval_minutes / 1440)
    elif interval_minutes % 60 == 0:
        interval_units = 'hours'
        interval_value = int(interval_minutes / 60)
    else:
        interval_value = int(interval_minutes)
    return {
        f'{key_root}_number': interval_value,
        f'{key_root}_units': interval_units,
    }