code: func (api UsersAPI) AddPublicKey(w http.ResponseWriter, r *http.Request) {
  	username := mux.Vars(r)["username"]
  	body := user.PublicKey{}
  
  	if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
  		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
  		return
  	}
  
  	if !strings.HasPrefix(body.PublicKey, "ssh-rsa AAAAB3NzaC1yc2E") {
  		http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
  		return
  	}
  
  	mgr := user.NewManager(r)
  
  	usr, err := mgr.GetByName(username)
  	if err != nil {
  		if err == mgo.ErrNotFound {
  			http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
  			return
  		}
  		log.Error("Error while getting user: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  
  	_, err = usr.GetPublicKeyByLabel(body.Label)
  	if err == nil {
  		http.Error(w, http.StatusText(http.StatusConflict), http.StatusConflict)
  		return
  	}
  
  	err = mgr.SavePublicKey(username, body)
  	if err != nil {
  		log.Error("error while saving public key: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  	w.Header().Set("Content-type", "application/json")
  	w.WriteHeader(http.StatusCreated)
  	json.NewEncoder(w).Encode(body)
  }
docs: // AddPublicKey Add a public key