Get CropBox.Id

def get_cropbox_id(view):
    """Function to get cropbox_id of a given view."""
    provider     = ParameterValueProvider(ElementId( int(BuiltInParameter.ID_PARAM)) )
    rule         = FilterElementIdRule(provider, FilterNumericEquals(), view.Id)
    param_filter = ElementParameterFilter(rule)
    collector    = FilteredElementCollector(doc).WherePasses(param_filter).ToElementIds()
    if collector:
        for id in collector:
            if id != view.Id:
                return id

⌨️ Happy Coding!
Erik Frits