---
title: "tokenToId"
sidebar_label: "tokenToId"
description: "Kotlin binding reference: tokenToId."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Tokenizer](index.md)/[tokenToId](tokenToId.md)

# tokenToId

[common]\
fun [tokenToId](tokenToId.md)(token: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)): [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)

The id of a surface token; a token outside the vocabulary fails with `NOT_FOUND`.