---
title: "PlantUML source -> URL token"
method: POST
path: "/api/encode"
tags: ["encoding"]
---

# PlantUML source -> URL token

`POST /api/encode`

## Request

- Base URL: `https://uml.singsk.com`
- URL: `https://uml.singsk.com/api/encode`
- Auth: none declared

Token algorithm: UTF-8 -> raw DEFLATE (level 9, no zlib header) -> every 3 bytes mapped to 4 characters of PlantUML's own 64-character alphabet "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_", no padding. This is PlantUML's custom encoding — NOT base64; a base64 codec will not produce valid tokens. Verified against the reference encoder, the local engine, and the official plantuml.com server. The returned urls render directly.

## Request body

- EncodeRequest
  - `text` string, required

## Response `200`

Token + ready URLs

- EncodeResponse
  - `encoded` string: PlantUML URL token
  - `token_length` integer
  - `url_ok` boolean: true when the token fits the GET URL limit (url_limit). When false the urls will answer 414 - use POST /api/render instead.
  - `url_limit` integer: Maximum token length accepted on GET ?src= URLs (16000)
  - `urls` object
    - `svg` string
    - `png` string
  - `warning` string: Present only when url_ok is false

## Other responses

- `400`: Missing text

---

[API](https://skmtc.dev/singsk/apis/uml-singsk-com-plantuml-service-api.md) · [All operations](https://skmtc.dev/singsk/apis/uml-singsk-com-plantuml-service-api/llms.txt) · [OpenAPI document](https://skmtc.dev/singsk/apis/uml-singsk-com-plantuml-service-api/revisions/44cfa55d273f?raw)
