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

# Dedicated Tokenization

> Tokenize text into token IDs using your Friendli Dedicated Endpoint. Useful for counting tokens and validating input length before inference.

By giving a text input, generate a tokenized output of token IDs.

To request successfully, it is mandatory to enter a **Personal API Key** (e.g. flp\_XXX) value in the **Bearer Token** field.
Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn how to acquire this variable and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.


## OpenAPI

````yaml https://github.com/friendliai/friendli-openapi/raw/refs/heads/main/openapi.yaml post /dedicated/v1/tokenize
openapi: 3.1.0
info:
  title: Friendli Suite API Reference
  description: This is an OpenAPI reference of Friendli Suite API.
  termsOfService: https://friendli.ai/terms-of-service
  contact:
    name: FriendliAI Support Team
    email: support@friendli.ai
  version: 0.1.0
servers:
  - url: https://api.friendli.ai
security: []
tags:
  - name: Serverless.Chat
  - name: Serverless.ToolAssistedChat
  - name: Serverless.Messages
  - name: Serverless.ChatRender
  - name: Serverless.Completions
  - name: Serverless.Token
  - name: Serverless.Audio
  - name: Serverless.Model
  - name: Serverless.Knowledge
  - name: Dedicated.Chat
  - name: Dedicated.Messages
  - name: Dedicated.ChatRender
  - name: Dedicated.Completions
  - name: Dedicated.Embeddings
  - name: Dedicated.TextClassification
  - name: Dedicated.Token
  - name: Dedicated.Image
  - name: Dedicated.Audio
  - name: Dedicated.Endpoint
  - name: Container.Chat
  - name: Container.Messages
  - name: Container.Completions
  - name: Container.TextClassification
  - name: Container.Token
  - name: Container.Image
  - name: Container.Audio
  - name: Cost
  - name: Dataset
  - name: File
paths:
  /dedicated/v1/tokenize:
    post:
      tags:
        - Dedicated.Token
      summary: Tokenization
      description: By giving a text input, generate a tokenized output of token IDs.
      operationId: dedicatedTokenization
      parameters:
        - name: X-Friendli-Team
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: ID of team to run requests as (optional parameter).
            title: X-Friendli-Team
          description: ID of team to run requests as (optional parameter).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DedicatedTokenizationBody'
      responses:
        '200':
          description: Successfully tokenized the text.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DedicatedTokenizationSuccess'
              examples:
                Example:
                  value:
                    tokens:
                      - 128000
                      - 3923
                      - 374
                      - 1803
                      - 1413
                      - 15592
                      - 30
        '422':
          description: Unprocessable Entity
      security:
        - token: []
components:
  schemas:
    DedicatedTokenizationBody:
      properties:
        model:
          type: string
          title: Model
          description: >-
            ID of target endpoint. If you want to send request to specific
            adapter, use the format "YOUR_ENDPOINT_ID:YOUR_ADAPTER_ROUTE".
            Otherwise, you can just use "YOUR_ENDPOINT_ID" alone.
          examples:
            - (endpoint-id)
        prompt:
          type: string
          title: Prompt
          description: Input text prompt to tokenize.
          examples:
            - What is generative AI?
      type: object
      required:
        - model
        - prompt
      title: DedicatedTokenizationBody
      example:
        model: (endpoint-id)
        prompt: What is generative AI?
    DedicatedTokenizationSuccess:
      properties:
        tokens:
          items:
            type: integer
          type: array
          title: Tokens
          description: A list of token IDs.
      type: object
      required:
        - tokens
      title: DedicatedTokenizationSuccess
  securitySchemes:
    token:
      type: http
      description: >-
        When using Friendli Suite API for inference requests, you need to
        provide a **Personal API Key** for authentication and authorization
        purposes.


        For more detailed information, please refer
        [here](https://friendli.ai/docs/openapi/introduction#authentication).
      scheme: bearer

````