Text2API
    Text2API
    • Welcome to Text-to-API 📚
    • Using TextToAPI Across Domains
    • How to Get Your Test API Key 🔑
    • How to Give Feedback 💡
    • Translations
      • Create
        POST

    Welcome to Text-to-API 📚

    📢 Transform Human Text into Actionable Data—Instantly!
    Every second wasted on manual data entry is a second lost in productivity. Businesses drown in unstructured text—emails, legal documents, expense reports, customer feedback—but what if AI could automate this entire process for you?
    🚀 Introducing Text-to-API—Your AI-Powered Bridge Between Human Language & Structured Data.

    Why Does This Matter?#

    ⌛ Save Time & Resources – Automate tedious data extraction tasks.
    📊 Gain Instant Insights – Transform raw text into structured, searchable data.
    🔗 Seamless API Integration – Connect human-driven workflows with automated systems.
    ⚡ Supercharge Your Operations – Let AI do the heavy lifting while you focus on growth.

    How Does It Work?#

    📝 Input: Any human-written text—legal agreements, financial transactions, support tickets, and more.
    🎯 AI Processing: Advanced NLP understands context, extracts key details, and structures them.
    📑 Output: Clean, structured JSON ready for API consumption.

    Who Can Benefit?#

    ✅ Legal & Compliance – Extract key clauses, dates, and obligations from contracts.
    ✅ Finance & Accounting – Automate expense tracking and transaction categorization.
    ✅ Customer Support – Instantly process and categorize support requests.
    ✅ Healthcare & Medical – Convert medical notes into structured patient records.
    ✅ E-Commerce – Analyze product reviews, refund requests, and order issues.
    🔥 No more wasted time. No more manual errors. Just AI-driven efficiency at scale.
    💡 Start Now & Unlock the Power of AI-Driven Text Processing!

    🔹 Get Your Free API Key & Start Testing!#

    Get Your FREE API Key Now!

    Let's Get Started#

    Imagine you're building the next big fintech platform, and you want to offer expense tracking without forcing users to manually input every transaction detail. In today’s AI-driven world, nobody wants to type out separate fields for every expense.
    Instead, you want a seamless experience where users simply write a natural language description like:
    "30 USD groceries"
    From that, your system should automatically extract:
    💲 Amount: 30.00
    💰 Currency: USD
    🏷 Category: Groceries
    This is exactly what Text-to-API enables. With a simple API call, you can transform unstructured expense descriptions into structured JSON data that integrates effortlessly into your app.

    Making Your First API Request#

    To process an expense description, send a POST request to the /translations endpoint, specifying the expected JSON output structure. Here’s how it works:
    When you send a request, the API will return a structured response similar to this:
    {
      "mapped_object": {
         "amount": 30,
         "description": "groceries"
      }
      // other fields that are not important at this point
    }
    Pretty cool, right? This simple example illustrates the core functionality, but we’ll explore more complex scenarios soon. First, let’s break down the request body to understand how it works.
    Breaking Down the Request Body
    1️⃣ The Input Text
    The most crucial part of your request is the input_text field. This is where you provide the human-written text that needs to be converted into structured JSON.
    2️⃣ Translation Type
    The translation_type field defines the type of translation you want. In the current API version, we only support object translations, so you must set:
    "translation_type": "object"
    3️⃣ Defining the Output Structure
    The target_object field specifies the structure of the JSON output. This is where you define the fields you expect in the response.
    "target_object"{
      "fields": [] // an array of fields
    }
    Each field is an object that contains metadata defining its properties. Here’s a basic example:
    "fields": [
        {
          "name": "amount",
          "description": "The amount of the expense",
          "type": "number"
        },
        {
          "name": "description",
          "type": "string",
          "description": "A brief description of what the expense was for."
        }
      ]
    }
    Understanding Field Metadata
    Each field has the following properties:
    name: This determines the key name in the output JSON.
    type: Defines the data type (string, number, boolean, array, or date).
    description: A short, helpful explanation of the field’s purpose.
    ⚠️ Pro Tip: Descriptions should be concise. Longer requests cost more and take longer to process. Use descriptions only when necessary for clarity.

    Let's make it a bit more interesting#

    Now, let’s add another layer of complexity. Suppose you want to define the currency of the transaction. You already know that you need to add another field inside the fields array and define its name, type, and description. But what if you want to restrict the possible values that the AI agent can choose from?
    Using allowed_values for Controlled Outputs
    Let's say we only support USD, EUR, and MXN. We can specify an array of allowed_values like this:
    {
      "name": "currency",
      "type": "string",
      "allowed_values": ["USD", "EUR", "MXN"]
    }
    Now, if we send an input text like:
    "300 Mexican pesos for tacos"
    The API response would be:
    {
      "mapped_object": {
         "amount": 300,
         "currency": "MXN",
         "description": "tacos"
      }
    }
    Handling Unrecognized Currencies
    But what happens if the input text refers to a currency that isn’t in allowed_values? This is where the description field becomes useful. You can tell the AI what to do if none of the allowed values match. For example:
    {
      "name": "currency",
      "type": "string",
      "allowed_values": ["USD", "EUR"],
      "description": "Set null if none of the allowed_values is matched"
    }
    Now, with the same input, but without MXN in the allowed values, the response would be:
    {
      "mapped_object": {
         "amount": 300,
         "currency": null,
         "description": "tacos"
      }
    }
    Important Considerations
    🚨 AI is not infallible. Since an AI agent performs the processing, it may sometimes act unpredictably. It could infer that setting MXN is valid, even if it isn’t listed in allowed_values.
    ✅ Implement safeguards in your application. Always validate API responses to ensure data consistency and handle unexpected values appropriately.
    Full Example Request
    By refining the request structure, you gain more control over the AI-generated data and improve the accuracy of structured outputs.

    Let's Make It Even More Interesting#

    Your users will benefit from knowing where their money is going, so let’s take this a step further. In addition to the fields we already have, let's make Text-to-API automatically categorize expenses based on their descriptions.
    We want to classify expenses into four categories: fixed-costs, savings, investments, and guilt-free. We already know how to define this, so we simply add a new field in target_object.fields like this:
    {
        "name": "category",
        "type": "string",
        "allowed_values": [
          "guilt-free",
          "fixed-costs",
          "savings",
          "investments"
        ]
    }
    Now, let’s see what Text-to-API returns when processing the following input:
    "60 bucks for Red Dead Redemption 2"
    The API response would be:
    "mapped_object": {
        "amount": 60,
        "category": "guilt-free",
        "currency": "USD",
        "description": "Red Dead Redemption 2"
    }

    Adding Subcategories Based on Category#

    But we can take it even further. What if we also want to specify a sub_category that depends on the selected category? 🤯
    You can define a new field named sub_category, specify its type as string, and tell Text-to-API that this field depends on another field (in this case, category) using "depends_on": "category":
    {
        "name": "sub_category",
        "type": "string",
        "depends_on": "category"
    }
    Now, we can also specify the possible subcategories, depending on the chosen value for category, by defining "dependent_allowed_values" like this:
    {
        "name": "sub_category",
        "type": "string",
        "depends_on": "category",
        "dependent_allowed_values": [
          {
            "value": "guilt-free",
            "allowed_values": ["clothes", "entertainment", "eating_out"]
          },
          {
            "value": "fixed-costs",
            "allowed_values": ["food", "rent", "internet", "phone"]
          },
          {
            "value": "savings",
            "allowed_values": ["emergency", "travel", "gifts"]
          },
          {
            "value": "investments",
            "allowed_values": ["stocks", "bonds", "crypto"]
          }
        ]
    }

    Testing More Inputs#

    "30 euros, souvenir for my girlfriend"
    API Response:
    "mapped_object": {
        "amount": 30,
        "category": "guilt-free",
        "currency": "EUR",
        "description": "souvenir for my girlfriend",
        "sub_category": "gifts"
    }
    ✔️ Correctly categorized as a guilt-free gift!

    "15 bucks at McDonald's"
    API Response:
    "mapped_object": {
        "amount": 15,
        "category": "guilt-free",
        "currency": "USD",
        "description": "at McDonald's",
        "sub_category": "eating_out"
    }
    ✔️ Recognized as guilt-free spending on eating out.

    "50 USD, Amazon gift card for my nephew"
    API Response:
    "mapped_object": {
        "amount": 50,
        "category": "guilt-free",
        "currency": "USD",
        "description": "Amazon gift card for my nephew",
        "sub_category": "gifts"
    }
    ✔️ Close enough! (Although it was an emergency purchase for me 😉)

    Endless Possibilities#

    This is just a taste of what you can do with Text-to-API. You’re not limited to expense tracking—this same logic applies to e-commerce, medical records, legal documents, and more.
    In the following sections, you’ll find more examples across different domains and a complete API reference, including:
    Using Text-to-API on different domains
    How to get your test API Key
    How to build API requests
    🚀 Let’s continue!

    🔹 Get Your Free API Key & Start Testing!#

    Get Your FREE API Key Now!
    Next
    Using TextToAPI Across Domains
    Built with