Skip to content

Encode

The /encode endpoint encodes or decodes text in various formats.

Parameters

ParameterRequiredDescription
methodYesEncoding method (see available methods below)
textYesText to encode or decode
shiftNoShift value for Caesar cipher (default: 13)

Available Methods

MethodDescription
base64encodeEncode to Base64
base64decodeDecode from Base64
urlencodeURL encode
urldecodeURL decode
morseText → Morse code
unmorseMorse code → Text
rot13ROT-13 cipher
caesarCaesar cipher (requires shift)
binaryText → 8-bit binary
unbinaryBinary → Text

Response Fields

FieldTypeDescription
methodstringThe encoding method used
resultstringThe encoded or decoded output

Code Examples

curl -X GET \
  "https://api.sylvain.sh/v4/encode?method=base64encode&text=hello"

Try It

Error Handling

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
A value is requiredThe text parameter is missing
Please provide a valid method (?method={base64encode|base64decode|morse|…})The method parameter is missing or invalid
Invalid Base64 inputThe text is not valid Base64 (for base64decode)
Invalid Morse codeThe text is not valid Morse code (for unmorse)
Invalid binary inputThe text is not valid binary (for unbinary)
Please provide a valid shift valueThe shift value is missing or invalid (for caesar)