Skip to content

Case

The /case endpoint converts text between 9 case formats using universal tokenization (camelCase splitting, _, -, ., spaces).

Parameters

ParameterRequiredDefaultDescription
textYesText to convert
toNocamelTarget case format

Available Targets

TargetDescriptionExample (hello_world)
camelcamelCasehelloWorld
pascalPascalCaseHelloWorld
snakesnake_casehello_world
kebabkebab-casehello-world
constantCONSTANT_CASEHELLO_WORLD
titleTitle CaseHello World
sentenceSentence caseHello world
upperUPPERCASEHELLO_WORLD
lowerlowercasehello_world

Response Fields

FieldTypeDescription
textstringThe original input text
tostringThe target case format
resultstringThe converted text

Code Examples

curl -X GET \
  "https://api.sylvain.sh/v5/case?text=hello_world&to=pascal"

Try It

Error Handling

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

Error MessageDescription
Please provide a text (?text={text})The text parameter is missing
Text cannot exceed 1000 charactersThe text exceeds the maximum length
Text must contain at least one alphanumeric characterThe text contains only separators/punctuation (e.g. ---), leaving nothing to convert
Invalid target case. Valid values: camel, pascal, snake, kebab, constant, title, sentence, upper, lowerThe to value is not valid