Unable to place Family Instance

Hello, I am trying to place a family instance, following is my code snippet. My family is OneLevelBased but I am getting error on the instance creation line that a Curve is expected instead of a XYZ. Not sure how to resolve this.

if familyPlacementType == FamilyPlacementType.OneLevelBased or familyPlacementType == FamilyPlacementType.TwoLevelsBased :
        if category == "Doors":  
          print(fname + " avoided placement: Curtain Wall Door avoided")
          continue
        if category == "Curtain Panels":
          print(fname + " avoided placement: Curtain Panel avoided")
          continue
        p1 = p1 + XYZ(symbolWidth/2,0,0)
        instance = doc.Create.NewFamilyInstance(p1,
                                                ftype,
                                                selectedLevel,
                                                structuralType)

Hard to say without seeing how p1, ftype, selectedLevel, and structuralType are defined.
One of the inputs is wrong, and revit is displaying the Exception from the last ‘overload’ constructor that it tried and failed on.

Just a guess, but you may be passing in FamilySymbol.Id, or Level.Id instead of the full element itself.

I’m trying to mirror and replace a window family this way. It’s not 100%, but Create works. Maybe it can help you:

def insert_and_mirror_instanse(doc, element, new_symbol, data):
    try:
        point = data['location']
        host = data['host']
        level = data['host_level']
        facing_flipped = data['facing_flipped']
        hand_flipped = data['hand_flipped']
        original_element_id = data['id']

        host_id = host.Id if host else None
        actual_host = doc.GetElement(host_id) if host_id else None

        if not actual_host or not actual_host.IsValidObject or not isinstance(actual_host, Wall):
            print("❌ Host ikke gyldig. Hopper over speiling.")
            return

        wall_curve = actual_host.Location.Curve
        start = wall_curve.GetEndPoint(0)
        end = wall_curve.GetEndPoint(1)
        wall_direction = (end - start).Normalize()
        wall_normal = XYZ(-wall_direction.Y, wall_direction.X, 0)

        # Speil punktet i stedet for å speile objektet
        vector_to_plane = point - start
        distance = vector_to_plane.DotProduct(wall_normal)
        mirror_point = point - wall_normal.Multiply(2 * distance)

        with revit_transaction(doc, "Insert mirrored window safely"):
            new_window = doc.Create.NewFamilyInstance(
                mirror_point, new_symbol, actual_host, level, StructuralType.NonStructural
            )

            if facing_flipped:
                new_window.flipFacing()
            if hand_flipped:
                new_window.flipHand()

            doc.Delete(element.id_instance)
            print("✅ Speilvindu plassert:", new_symbol.Family.Name)

    except Exception as e:
        print("Error:", e)

Do not include structuralType argument, it is confusing the API.

Try this method.
Revit API Documentation