# Convert a canister's principal to actor

**URL:** <https://forum.dfinity.org/t/convert-a-canisters-principal-to-actor/23383>\
**Category:** Motoko\
**Created:** [September 28, 2023, 6:47pm UTC](https://forum.dfinity.org/t/convert-a-canisters-principal-to-actor/23383 "2023-09-28T18:47:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [September 28, 2023, 6:47pm UTC](https://forum.dfinity.org/t/convert-a-canisters-principal-to-actor/23383/1 "2023-09-28T18:47:37Z")

</div>

Is there a more efficient (and concise) way to convert a canister’s principal to actor than `actor(Principal.toText(canisterId))`?

---

<div class="post-metadata">

**Author:** ![claudio](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/claudio/32/322_2.png) [@claudio](https://forum.dfinity.org/u/claudio)\
**Post date:** [September 29, 2023, 5:18pm UTC](https://forum.dfinity.org/t/convert-a-canisters-principal-to-actor/23383/2 "2023-09-29T17:18:50Z")

</div>

Unless you can import it or receive it as an argument of the appropriate actor type, no, not that I can think of.

---

<div class="post-metadata">

**Author:** ![qwertytrewq](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/qwertytrewq/32/10423_2.png) [@qwertytrewq](https://forum.dfinity.org/u/qwertytrewq)\
**Post date:** [September 29, 2023, 5:52pm UTC](https://forum.dfinity.org/t/convert-a-canisters-principal-to-actor/23383/3 "2023-09-29T17:52:22Z")

</div>

`actor(canisterId)` _should_ work for `canisterId: Principal`.

Conceptually, there is no reason to first convert it to text.

Consider the above as a feature request.

---

<div class="post-metadata">

**Author:** ![claudio](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/claudio/32/322_2.png) [@claudio](https://forum.dfinity.org/u/claudio)\
**Post date:** [September 29, 2023, 6:26pm UTC](https://forum.dfinity.org/t/convert-a-canisters-principal-to-actor/23383/4 "2023-09-29T18:26:09Z")

</div>

True, but the historical reason for this is that this construct was, I believe, used internally to bind a canister imported by textual id to its translated Motoko type, IIRC, and then exposed as a documented language feature.
