Transcribe a voice note

Turn the diner's voice note into text, with the menu's dish names as hints, before sending it as a message.

POST/api/v1/transcribeClient API

A voice note of up to 30 seconds and 2 MB, as multipart/form-data, comes back as text (with the menu's dish names as hints) for the app to send as the diner's message. It takes audio/webm, audio/mp4, audio/ogg, audio/mpeg, audio/wav and audio/x-m4a.

Authentication

Client API. Send your publishable key in x-tamr-key and the diner's session in x-tamr-session, from Start a session. For a guest's session, also send its device id in x-tamr-device. A browser may call it only from an origin listed on the key.

Headers

NameTypeRequiredDescription
x-tamr-devicestringNoGuest sessions only: the device id the session was exchanged with. Matches ^[A-Za-z0-9_-]{8,128}$.
x-tamr-appstringNoNative apps only: the app's iOS bundle id or Android package name. A key used from an app it doesn't list is logged, never refused. Matches ^[A-Za-z][A-Za-z0-9_-]*(\.[A-Za-z0-9_-]+)+$.

Request body

Send it as multipart/form-data, the recording in audio.

FieldTypeRequiredDescription
branchstringNoAn address: lower-case letters, digits and dashes.
modestringNoOne of dine_in, pickup, delivery.
audiofileYes
durationMsintegerNo0 to 30,000.

Response

FieldTypeDescription
textstring
languagestring or nullAt most 35 characters.
secondsnumber

Example

curl -X POST https://tamr.link/api/v1/transcribe \
  -H "x-tamr-key: $TAMR_APP_KEY" \
  -H "x-tamr-session: $TAMR_SESSION" \
  -F "[email protected];type=audio/webm"

Example response

{
  "text": "Do you have anything vegan?",
  "language": "en",
  "seconds": 2.4
}

Errors

Every error has the same body; switch on data.code. See Errors and rate limits.

data.codeStatusWhat to do
app_key_invalid401The key is wrong, revoked or of another kind. Check it in the dashboard.
sdk_disabled403The SDK isn't switched on for this restaurant. Ask Tamr.
origin_not_allowed403A browser called from an origin the key doesn't list. Add the origin to the key.
session_expired401Start a new session with a fresh token or code, then send the call again once.
invalid_request400A field doesn't match the spec. The message says which.
rate_limited429Wait retryAfter seconds (also in the Retry-After header), then try again.
nothing_heard422A voice note with no words in it. Ask the diner to try again.
menu_unavailable404No published menu is served at that branch and service mode.
unavailable503Tamr can't serve this now. Try again later.