Match your cart

Match your app's cart lines to the dishes the AI waiter serves, by Tamr's ids or your own; unplaceable lines come back unmapped.

POST/api/v1/cart/matchClient API

Your cart's lines as the dishes of the menu the waiter serves, by Tamr's ids or yours. Lines Tamr can't place come back in unmapped, such as drinks from another system.

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

FieldTypeRequiredDescription
branchstringNoAn address: lower-case letters, digits and dashes.
modestringNoOne of dine_in, pickup, delivery.
linesarray of objectYesAt most 50 items.
lines[].dishIdstringNo1 to 200 characters.
lines[].externalIdstringNo1 to 200 characters.
lines[].variantIdstringNo1 to 200 characters.
lines[].variantExternalIdstringNo1 to 200 characters.
lines[].optionIdsarray of stringNoAt most 20 items. 1 to 200 characters.
lines[].optionExternalIdsarray of stringNoAt most 20 items. 1 to 200 characters.
lines[].quantityintegerYes1 to 99.
lines[].picksarray of objectNoAt most 120 items.
lines[].picks[].pickIdstringNo1 to 200 characters.
lines[].picks[].externalIdstringNo1 to 200 characters.
lines[].picks[].variantExternalIdstringNo1 to 200 characters.
lines[].picks[].countintegerYes1 to 20.

Response

FieldTypeDescription
linesarray of objectAt most 50 items.
lines[].dishIdstring1 to 200 characters.
lines[].namestring1 to 200 characters.
lines[].variantIdstring or null1 to 200 characters.
lines[].optionIdsarray of stringAt most 20 items. 1 to 200 characters.
lines[].quantityinteger1 to 99.
lines[].picksarray of objectMay be absent. At most 120 items.
lines[].picks[].pickIdstring1 to 200 characters.
lines[].picks[].countinteger1 to 20.
unmappedarray of objectAt most 50 items.
unmapped[].externalIdstring1 to 200 characters.

Example

curl https://tamr.link/api/v1/cart/match \
  -H "x-tamr-key: $TAMR_APP_KEY" \
  -H "x-tamr-session: $TAMR_SESSION" \
  -H "content-type: application/json" \
  -d '{
  "lines": [
    {
      "dishId": "dish_kafta",
      "quantity": 2
    },
    {
      "externalId": "SKU-1042",
      "quantity": 1
    },
    {
      "externalId": "DRINK-7",
      "quantity": 3
    }
  ]
}'

Example response

{
  "lines": [
    {
      "dishId": "dish_kafta",
      "name": "Kafta plate",
      "variantId": null,
      "optionIds": [],
      "quantity": 3
    },
    {
      "dishId": "dish_bowl",
      "name": "Build your bowl",
      "variantId": "var_large",
      "optionIds": [
        "opt_chicken"
      ],
      "quantity": 1
    }
  ],
  "unmapped": [
    {
      "externalId": "DRINK-7"
    }
  ]
}

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.
menu_unavailable404No published menu is served at that branch and service mode.
not_found404Not this diner's, or doesn't exist. The two read the same on purpose.