> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Addressing

> Reach a stateful actor instance by name. idFromName is deterministic — the same name always lands on the same instance; newUniqueId mints a fresh one. Both return a stub you call methods on.

`env.<BINDING>` is your handle to an actor class. You name an instance, get a **stub**,
and call methods on it.

## Two Ways to Name an Instance

```ts theme={null}
env.ACCOUNT.idFromName("acct_123") // deterministic — your shard key; same name, same instance
env.ACCOUNT.newUniqueId()          // random — mints a fresh, unguessable identity
```

* **`idFromName(name)`** is deterministic: the same `name` always lands on the same
  instance, from anywhere. This is the common case — pick a stable identity for the
  entity and let the platform route to its state.
* **`newUniqueId()`** mints a fresh, unguessable instance; you store the id
  (`stub.id`) yourself. It currently fails at call time on the platform (a known
  runtime issue — see [Actor Namespace](/docs/edge-compute/stateful-actors/api-reference/namespace));
  until it's fixed, mint an identity yourself and pass it to `idFromName`.

## Choosing a Name

The name *is* your shard key — choose the entity's natural identity: a caller's E.164
number, a user or account id, a room id, or a composite key (`tenant:room`). Same name →
same single-threaded instance → coherent state for that entity. Spreading load means
choosing names that spread across entities; a single hot name is one single-threaded
bottleneck (see [When to use](/docs/edge-compute/stateful-actors/guides/when-to-use)).

## Calling the Stub

Both calls return a **stub**. Calling a method on the stub is an RPC to that one
instance: the call is queued there, your method runs, the value comes back.

## Next Steps

* [How it works](/docs/edge-compute/stateful-actors/concepts/how-it-works) — why one-instance-per-name gives coherent state
* [Project structure](/docs/edge-compute/stateful-actors/guides/project-structure) — declaring the binding in `telnyx.toml`
* [Runtime API](/docs/edge-compute/stateful-actors/api-reference) — `ActorNamespace` and `ActorStub`
