All Case Conversions API: Convert Text to Every Case Format

Need text converted to multiple case formats? The All Case Conversions API transforms any input text into every common case format in a single API call - camelCase, snake_case, PascalCase, kebab-case, SCREAMING_SNAKE, and more.

Why Convert to All Cases at Once?

Different programming languages and contexts require different naming conventions. When building code generators, migration tools, or documentation systems, you often need the same identifier in multiple formats.

Instead of making multiple API calls for each format, get all conversions in one efficient request.

Supported Case Formats

The API returns text in all these formats:

Format Example Common Use
camelCase userAccountId JavaScript, Java variables
PascalCase UserAccountId Classes, types, React
snake_case user_account_id Python, Ruby, SQL
SCREAMING_SNAKE USER_ACCOUNT_ID Constants, env vars
kebab-case user-account-id CSS, URLs, CLI
Title Case User Account Id Display labels
Sentence case User account id UI text
dot.case user.account.id Configuration keys
Efficiency: One API call gives you 8+ formats - far more efficient than separate requests for each conversion.

Using the All Case Conversions API

TinyFn provides a comprehensive endpoint for bulk case conversion:

API Request
POST https://api.tinyfn.io/v1/transform/case/all
Headers: X-API-Key: your-api-key
Content-Type: application/json

{
  "text": "user account settings"
}
Response
{
  "original": "user account settings",
  "conversions": {
    "camelCase": "userAccountSettings",
    "PascalCase": "UserAccountSettings",
    "snake_case": "user_account_settings",
    "SCREAMING_SNAKE_CASE": "USER_ACCOUNT_SETTINGS",
    "kebab-case": "user-account-settings",
    "Title Case": "User Account Settings",
    "Sentence case": "User account settings",
    "dot.case": "user.account.settings",
    "lowercase": "useraccountsettings",
    "UPPERCASE": "USERACCOUNTSETTINGS"
  },
  "words": ["user", "account", "settings"],
  "word_count": 3
}

Parameters

Parameter Type Description
text string The text to convert (required)
preserve_acronyms boolean Keep acronyms like HTTP, API (default: false)
formats array Specific formats to include (default: all)

Code Examples

JavaScript / Node.js

const response = await fetch(
  'https://api.tinyfn.io/v1/transform/case/all',
  {
    method: 'POST',
    headers: {
      'X-API-Key': 'your-api-key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ text: 'get_user_by_id' })
  }
);
const { conversions } = await response.json();
console.log(`camelCase: ${conversions.camelCase}`);     // getUserById
console.log(`PascalCase: ${conversions.PascalCase}`);   // GetUserById
console.log(`kebab-case: ${conversions['kebab-case']}`); // get-user-by-id

Python

import requests

response = requests.post(
    'https://api.tinyfn.io/v1/transform/case/all',
    headers={'X-API-Key': 'your-api-key'},
    json={'text': 'UserProfileComponent'}
)
data = response.json()
for case_name, converted in data['conversions'].items():
    print(f"{case_name}: {converted}")

cURL

curl -X POST "https://api.tinyfn.io/v1/transform/case/all" \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"text": "user account settings"}'

Common Use Cases

  • Code Generation: Generate identifiers for multiple languages simultaneously
  • API Scaffolding: Create endpoints, types, and database fields from one name
  • Documentation: Show the same concept in different naming conventions
  • IDE Plugins: Offer quick conversion between formats
  • Schema Migration: Convert field names between systems

Best Practices

  1. Cache results: Store conversions if the same text is converted repeatedly
  2. Handle special cases: Acronyms and numbers may need special treatment
  3. Validate identifiers: Ensure converted names are valid for target language
  4. Filter formats: Request only needed formats if you do not need all
  5. Document conventions: Be consistent about which format to use where

Try the All Case Conversions API

Get your free API key and start converting text to all case formats.

Get Free API Key

Ready to try TinyFn?

Get your free API key and start building in minutes.

Get Free API Key