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.Authorization: Bearer ********************
"object"
is supported{
"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"
}
curl --location --request POST 'https://api.seniorgo.io/v1/translations' \
--header 'User-Id: user_2' \
--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"
}'
{
"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"
}
}