Developers
ENPT

Date resolver (Crono)

Turn what a customer said about dates, such as "next Tuesday at 2pm", into an exact date and time.

Customers rarely give exact dates. They say "tomorrow afternoon", "next Monday", "on the 15th" or "every Monday". Crono reads the dialogue and returns the date and time they meant, ready for a calendar or a booking system.

It considers:

  • The reference date: "tomorrow" depends on when the conversation happened.
  • Time zone and default time: when the customer gives a day but no time, a default time is used and the answer says so.
  • Business days and holidays: by country and state.
  • Recurrence: "every Monday" comes back as a repeating rule.

Crono understands Portuguese. When it is not confident, it does not guess: the date comes back empty and you can ask the customer to confirm.

ReferenceTechnical details

POST /api/externalAPIs/public/dateResolverFromDialogue with a host token (Authorization: Bearer $TOLKY_TOKEN).

NameTypeRequiredDescription
dialoguestring or arrayYesThe customer's text, or a list of { "role", "content" } messages (role is user, assistant or system).
nowISOstringNoReference date and time, ISO 8601. Default: now.
options.tzstringNoTime zone. Default America/Sao_Paulo.
options.defaultTimestringNoTime used when none is mentioned. Default 09:00.
options.holidaysCountrystringNoCountry for holidays, for example BR.
options.holidaysStatestringNoState for regional holidays, for example SP.
curl -X POST "https://api.tolky.to/api/externalAPIs/public/dateResolverFromDialogue" \
  -H "Authorization: Bearer $TOLKY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "dialogue": "Pode marcar para terça que vem às 14h?",
    "nowISO": "2026-03-05T10:00:00-03:00",
    "options": { "tz": "America/Sao_Paulo", "defaultTime": "09:00", "holidaysCountry": "BR", "holidaysState": "SP" }
  }'
{
  "code": 200,
  "message": "OK",
  "data": {
    "extraction": { "relative": "...", "explicit_time": "14:00", "confidence_score": 92 },
    "resolved_date": "terça, 10/03/2026 14:00",
    "resolution": {
      "kind": "single",
      "start_local": "2026-03-10T14:00:00-03:00",
      "start_utc": "2026-03-10T17:00:00.000Z",
      "tz": "America/Sao_Paulo",
      "assumed_time": false,
      "needs_confirmation": false
    },
    "insights": { },
    "trust": { "score": 90, "reason": "..." },
    "realtime_instruction": "..."
  }
}
FieldDescription
resolution.kindsingle for one date, recurrence for a repeating rule.
resolution.start_localDate and time in the chosen time zone, with offset.
resolution.start_utcThe same moment in UTC.
resolution.assumed_timetrue when no time was said and defaultTime was used.
resolution.needs_confirmationtrue when the request was ambiguous. ambiguity_reason explains. Confirm with the customer.
resolved_dateFriendly text in Portuguese, or null when nothing was resolved.
extractionWhat was understood from the dialogue, including confidence_score.
trustscore and reason of the final result.
realtime_instructionA short summary in Portuguese, ready to give to the avatar, or null.

Errors

Crono answers HTTP 200 even when it cannot resolve a date. Check the body:

  • error: "invalid_payload" when dialogue is missing or empty.
  • error with a reason when the analysis failed.
  • resolved_date: null when there was no date in the dialogue or confidence was too low.

Unexpected failures answer 500.

Previous

Smart Split and Smart Cut