Create
POST
https://api.seniorgo.io/v1/translations
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.Request
Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.Example:
Authorization: Bearer ********************
Header Params
User-Id
stringÂ
required
Example:
user_2
Body Params application/json
translation_type
stringÂ
required
"object"
is supportedDefault:
object
target_object
array[object (ObjectField) {8}]Â
required
id
stringÂ
required
type
stringÂ
required
description
stringÂ
optional
allowed_values
array[string]
optional
format
stringÂ
optional
fields
object (ObjectField)Â
optional
depends_on
stringÂ
optional
dependent_allowed_values
array[object (DependentAllowedValues) {2}]Â
optional
input_text
stringÂ
required
Example:
50 usd, amazon gift card for my nephew
lang
stringÂ
optional
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 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 '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
id
stringÂ
optional
mapped_object
objectÂ
required
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