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

# Model APIs Detokenization

> Convert token IDs back to text using Friendli Model APIs. Decode tokenized output into a human-readable string for post-processing.

By giving a list of tokens, generate a detokenized output text string.

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 /serverless/v1/detokenize
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:
  /serverless/v1/detokenize:
    post:
      tags:
        - Serverless.Token
      summary: Detokenization
      description: By giving a list of tokens, generate a detokenized output text string.
      operationId: serverlessDetokenization
      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/ServerlessDetokenizationBody'
      responses:
        '200':
          description: Successfully detokenized the tokens.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerlessDetokenizationSuccess'
              examples:
                Example:
                  value:
                    text: What is generative AI?
        '422':
          description: Unprocessable Entity
      security:
        - token: []
components:
  schemas:
    ServerlessDetokenizationBody:
      properties:
        model:
          type: string
          title: Model
          description: >-
            Code of the model to use. See [available model
            list](https://friendli.ai/docs/guides/model-apis/pricing#billing-methods).
          examples:
            - zai-org/GLM-5.2
        tokens:
          items:
            type: integer
          type: array
          title: Tokens
          description: A token sequence to detokenize.
          examples:
            - - 128000
              - 3923
              - 374
              - 1803
              - 1413
              - 15592
              - 30
      type: object
      required:
        - model
        - tokens
      title: ServerlessDetokenizationBody
      example:
        model: zai-org/GLM-5.2
        tokens:
          - 128000
          - 3923
          - 374
          - 1803
          - 1413
          - 15592
          - 30
    ServerlessDetokenizationSuccess:
      properties:
        text:
          type: string
          title: Text
          description: Detokenized text output.
      type: object
      required:
        - text
      title: ServerlessDetokenizationSuccess
  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

````