Skip to content

Token Generation

The /token endpoint generates secure strings called tokens. This endpoint is particularly useful for creating random identifiers for various applications.

Parameters

ParameterRequiredDescription
lenNoToken length (12-4096). Default: 24
typeNoToken type (see options below). Default: alpha

Available Types

TypeDescription
alphaLetters only (lowercase and uppercase)
alphanumLetters and numbers
base64Base64 encoding
hexHexadecimal digits
numNumbers only
punctPunctuation characters
urlsafeURL-safe characters
uuidUniversally Unique Identifier (UUID)

Request Example

POST /v1/token
Content-Type: application/x-www-form-urlencoded

len=24&type=alphanum

Response

json
{
  "token": "6tMdlDV90x4Sm52dRS7MuGyn"
}

cURL

bash
curl -X POST -d "len=24&type=alphanum" "https://api.sylvain.pro/v1/token"

Error Handling

If the len value is out of bounds or the type is invalid, a 12-character alphanumeric token will be generated.