Input_number view changing to box view when using REST API

I am trying to find a way/to understand why when I sent a post request to update its value, it reverts from a slider view to box view.

I’ve attempted to add min and max. But no luck:

def set_input_number(state_id, state):
    url = f"http://127.0.0.1:8123/api/states/{state_id}"
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {auth_token}"
    }
    data = {
        "state": state,
        "min": 0,
        "max": 100,
        "mode": "slider"
    }
    response = requests.post(url, headers=headers, data=json.dumps(data))
    return response.json()
    data = {
        "state": state,
        "attributes": {
          "min": 0,
          "max": 100,
          "mode": "slider"
         }
    }