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

Create

POST
https://api.seniorgo.io/v1/translations
The POST /translations endpoint processes a human-written text and transforms it into a structured JSON object based on the schema defined in the request body. This allows users to specify the desired format, structure, and constraints of the output JSON.
You'll need to provide a valid API Key to test this request. Visit "How to Get Your Test API Key" to get one!

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Header Params

Body Params application/json

Example
{
  "translation_type": "object",
  "input_text": "150 USD in groceries at walmart",
  "target_object": {
    "fields": [
      {
        "allowed_values": [],
        "name": "description",
        "type": "string"
      },
      {
        "type": "number",
        "allowed_values": [],
        "name": "amount"
      },
      {
        "type": "string",
        "allowed_values": [
          "usd",
          "eur",
          "mxn"
        ],
        "name": "currency"
      },
      {
        "type": "string",
        "allowed_values": [
          "guilt-free",
          "fixed-costs",
          "savings",
          "investments"
        ],
        "name": "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"
            ]
          }
        ],
        "name": "sub_category"
      },
      {
        "type": "date",
        "format": "ISO-8601",
        "description": "Date when the expense was made",
        "name": "created_at"
      }
    ]
  },
  "lang": "english"
}

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.seniorgo.io/v1/translations' \
--header 'User-Id: user_2' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "translation_type": "object",
  "input_text": "150 USD in groceries at walmart",
  "target_object": {
    "fields": [
      {
        "allowed_values": [],
        "name": "description",
        "type": "string"
      },
      {
        "type": "number",
        "allowed_values": [],
        "name": "amount"
      },
      {
        "type": "string",
        "allowed_values": [
          "usd",
          "eur",
          "mxn"
        ],
        "name": "currency"
      },
      {
        "type": "string",
        "allowed_values": [
          "guilt-free",
          "fixed-costs",
          "savings",
          "investments"
        ],
        "name": "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"
            ]
          }
        ],
        "name": "sub_category"
      },
      {
        "type": "date",
        "format": "ISO-8601",
        "description": "Date when the expense was made",
        "name": "created_at"
      }
    ]
  },
  "lang": "english"
}'

Responses

🟢200Successful Response
application/json
Body

Example
{
    "id": "abc",
    "mapped_object": {
        "amount": 150,
        "category": "fixed-costs",
        "created_at": "2025-01-16",
        "currency": "usd",
        "description": "150 USD in groceries at walmart",
        "sub_category": "food"
    }
}
🟠400Invalid Request
Modified at 2025-01-25 02:19:11
Previous
How to Give Feedback 💡
Built with