diff --git a/core/commands/routing.go b/core/commands/routing.go
index 6d0ddb1c864..99aa4a78df7 100644
--- a/core/commands/routing.go
+++ b/core/commands/routing.go
@@ -14,6 +14,7 @@ import (
 	iface "github.com/ipfs/boxo/coreiface"
 	"github.com/ipfs/boxo/coreiface/options"
 	dag "github.com/ipfs/boxo/ipld/merkledag"
+	"github.com/ipfs/boxo/ipns"
 	cid "github.com/ipfs/go-cid"
 	cmds "github.com/ipfs/go-ipfs-cmds"
 	ipld "github.com/ipfs/go-ipld-format"
@@ -451,12 +452,12 @@ identified by QmFoo.
 			options.Put.AllowOffline(allowOffline),
 		}
 
-		err = api.Routing().Put(req.Context, req.Arguments[0], data, opts...)
+		ipnsName, err := ipns.NameFromString(req.Arguments[0])
 		if err != nil {
 			return err
 		}
 
-		id, err := api.Key().Self(req.Context)
+		err = api.Routing().Put(req.Context, req.Arguments[0], data, opts...)
 		if err != nil {
 			if err == iface.ErrOffline {
 				err = errAllowOffline
@@ -466,7 +467,7 @@ identified by QmFoo.
 
 		return res.Emit(routing.QueryEvent{
 			Type: routing.Value,
-			ID:   id.ID(),
+			ID:   ipnsName.Peer(),
 		})
 	},
 	Encoders: cmds.EncoderMap{
diff --git a/test/cli/dht_legacy_test.go b/test/cli/dht_legacy_test.go
index 2b90d164cb2..cfcb4f0cd09 100644
--- a/test/cli/dht_legacy_test.go
+++ b/test/cli/dht_legacy_test.go
@@ -131,7 +131,7 @@ func TestLegacyDHT(t *testing.T) {
 			node.WriteBytes("foo", []byte("foo"))
 			res := node.RunIPFS("dht", "put", "/ipns/"+node.PeerID().String(), "foo")
 			assert.Equal(t, 1, res.ExitCode())
-			assert.Contains(t, res.Stderr.String(), "this action must be run in online mode")
+			assert.Contains(t, res.Stderr.String(), "can't put while offline: pass `--allow-offline` to override")
 		})
 	})
 }
diff --git a/test/cli/routing_dht_test.go b/test/cli/routing_dht_test.go
index 3a3adc51c51..fb0d391951e 100644
--- a/test/cli/routing_dht_test.go
+++ b/test/cli/routing_dht_test.go
@@ -111,7 +111,7 @@ func testRoutingDHT(t *testing.T, enablePubsub bool) {
 				node.WriteBytes("foo", []byte("foo"))
 				res := node.RunIPFS("routing", "put", "/ipns/"+node.PeerID().String(), "foo")
 				assert.Equal(t, 1, res.ExitCode())
-				assert.Contains(t, res.Stderr.String(), "this action must be run in online mode")
+				assert.Contains(t, res.Stderr.String(), "can't put while offline: pass `--allow-offline` to override")
 			})
 		})
 	})