# getTokenIdByName()

```typescript
/**
   * Get the token ID of the Collective Portrait for a given name.
   *
   * @remarks
   * The token ID is the unique identifier of the Collective Portrait. It is used to identify the Collective Portrait in the contract, as part of ERC-1155.
   *
   * @param {CollectivePortraitName} name - The name of the Collective Portrait that the user would like to get the token ID for.
   * @returns {number} - The token ID of the Collective Portrait.
   * @beta
   * @async
   */
  getTokenIdByName(name: CollectivePortraitName): number {
    return this.portrait.portraitCollectiveContract.getTokenIdByName(name);
  }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ryan-44.gitbook.io/portrait/portrait-sdk/collective-portraits/read/gettokenidbyname.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
