> ## 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.

# decodeAgentName()

> **decodeAgentName**(`id`): `string`

Recover the routing name an actor id was encoded from — the exact inverse of
[encodeAgentName](/docs/agent-sdk/internals/mount/encodeAgentName).

`decodeAgentName(encodeAgentName(name))` is `name`, for every name
`encodeAgentName` accepts. Use it to render an id back as something a person
reads: a log line, an admin listing, a dashboard row.

```ts theme={null}
decodeAgentName("alice");              // "alice"
decodeAgentName(":2b:15550100");       // "+15550100"
decodeAgentName("user:40:ex.com");     // "user@ex.com"
decodeAgentName("caf:c3a9:-:e29895:"); // "café-☕"
```

It is strict on purpose: an id [encodeAgentName](/docs/agent-sdk/internals/mount/encodeAgentName) could not have
produced is refused rather than half-read. That is what makes it safe to
point at an id of unknown provenance — an id from an older encoding, or one
a caller hand-assembled, is reported instead of being passed off as a name
it never was.

**Parameters**

| Parameter | Type | Description |
| - | - | - |
| `id` | `string` | An actor id produced by [encodeAgentName](/docs/agent-sdk/internals/mount/encodeAgentName). |

**Returns**

`string`

The routing name it was built from.

**Throws**

`TypeError` when `id` is not something [encodeAgentName](/docs/agent-sdk/internals/mount/encodeAgentName) could
have produced: an empty id, a character outside the addressable set sitting
unescaped, a `.` or `..` (which the encoder always escapes), two escapes in
a row, an unterminated escape, an escape that is not whole bytes of hex, or
hex that is not valid UTF-8.
