# Get the table

> Read whether the seated diner may send an order now, and the table's rounds so far.

Source: https://tamr.link/docs/api/get-table

`GET https://tamr.link/api/v1/table`

Whether the seated diner can send an order now (and if not, why), and the table's rounds so far with their status.

## Authentication

**Client API.** Send your publishable key in `x-tamr-key` and the diner's session in `x-tamr-session`, from [Start a session](https://tamr.link/docs/api/start-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.

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `branch` | string | No | An address: lower-case letters, digits and dashes. |

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `x-tamr-device` | string | No | Guest sessions only: the device id the session was exchanged with. Matches `^[A-Za-z0-9_-]{8,128}$`. |
| `x-tamr-app` | string | No | Native 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_-]+)+$`. |

## Response

| Field | Type | Description |
| --- | --- | --- |
| `table` | object or null |  |
| `table.code` | string | 1 to 40 characters. |
| `table.zone` | string or null | At most 80 characters. |
| `branch` | string or null | An address: lower-case letters, digits and dashes. |
| `canSend` | boolean |  |
| `blockedBy` | string or null | One of `unknown_table`, `table_off_plan`, `no_table`, `table_cleared`, `stale`, `ordering_off`, `paused`, `closed`, `unavailable`, `test_key`, `other`. An open list: read a value you don't know as `other`. |
| `pausedUntil` | string (date-time) or null |  |
| `allergenDisclaimer` | string or null | At most 2,000 characters. |
| `rounds` | array of object | At most 50 items. |
| `rounds[].orderId` | string | 1 to 200 characters. |
| `rounds[].number` | integer | The short number staff call out, per branch and service day. -9,007,199,254,740,991 to 9,007,199,254,740,991. |
| `rounds[].status` | string | One of `awaiting_payment`, `sent`, `accepted`, `served`, `declined`, `cancelled`, `expired`, `unknown`. An open list: read a value you don't know as `unknown`. |
| `rounds[].branch` | string | An address: lower-case letters, digits and dashes. |
| `rounds[].table` | string or null | 1 to 40 characters. |
| `rounds[].currency` | string | A three-letter currency code (ISO 4217). |
| `rounds[].subtotal` | string | An amount in minor units, as a string. |
| `rounds[].lines` | array of object | 1 to 100 items. |
| `rounds[].lines[].dishId` | string or null | 1 to 200 characters. |
| `rounds[].lines[].externalId` | string or null | 1 to 200 characters. |
| `rounds[].lines[].title` | string | 1 to 200 characters. |
| `rounds[].lines[].variantLabel` | string or null | 1 to 80 characters. |
| `rounds[].lines[].quantity` | integer | -9,007,199,254,740,991 to 9,007,199,254,740,991. |
| `rounds[].lines[].unitPrice` | string | An amount in minor units, as a string. |
| `rounds[].fulfilment` | string | May be absent. One of `dine_in`, `pickup`, `unknown`. An open list: read a value you don't know as `unknown`. |
| `rounds[].pickupAt` | string (date-time) or null | May be absent. |
| `rounds[].pickupCode` | string or null | May be absent. 1 to 12 characters. |
| `rounds[].test` | boolean | May be absent. |

## Example

curl:

```bash
curl "https://tamr.link/api/v1/table?branch=achrafieh" \
  -H "x-tamr-key: $TAMR_APP_KEY" \
  -H "x-tamr-session: $TAMR_SESSION"
```

Node:

```js
import { createClient } from "@tamr/api";

const tamr = createClient({ appKey: process.env.TAMR_APP_KEY });
// Sign the diner in first, with a token your backend signed (or a launch code).
await tamr.startSession({ token: dinerToken });

const result = await tamr.tableGet({ branch: "achrafieh" });
console.log(result);
```

Python:

```python
import os

import requests

API = "https://tamr.link/api/v1"
headers = {
    "x-tamr-key": os.environ["TAMR_APP_KEY"],
    "x-tamr-session": os.environ["TAMR_SESSION"],  # from POST /api/v1/sdk/session
}

response = requests.get(
    f"{API}/table",
    headers=headers,
    params={"branch": "achrafieh"},
    timeout=30,
)
response.raise_for_status()
print(response.json())
```

## Example response

```json
{
  "table": {
    "code": "12",
    "zone": "Terrace"
  },
  "branch": "achrafieh",
  "canSend": true,
  "blockedBy": null,
  "pausedUntil": null,
  "rounds": [
    {
      "orderId": "ord_01",
      "number": 17,
      "status": "sent",
      "branch": "achrafieh",
      "table": "12",
      "currency": "USD",
      "subtotal": "2450",
      "lines": [
        {
          "dishId": "dish_kafta",
          "externalId": "SKU-KAFTA",
          "title": "Kafta skewers",
          "variantLabel": "Large",
          "quantity": 2,
          "unitPrice": "900"
        },
        {
          "dishId": "dish_fattoush",
          "externalId": null,
          "title": "Fattoush",
          "variantLabel": null,
          "quantity": 1,
          "unitPrice": "650"
        }
      ]
    }
  ],
  "allergenDisclaimer": "Tell your server about any allergy before you order."
}
```

## Errors

Every error has the same body; switch on `data.code`. See [Errors and rate limits](https://tamr.link/docs/errors).

| `data.code` | Status | What to do |
| --- | --- | --- |
| `app_key_invalid` | 401 | The key is wrong, revoked or of another kind. Check it in the dashboard. |
| `sdk_disabled` | 403 | The SDK isn't switched on for this restaurant. Ask Tamr. |
| `origin_not_allowed` | 403 | A browser called from an origin the key doesn't list. Add the origin to the key. |
| `session_expired` | 401 | Start a new session with a fresh token or code, then send the call again once. |
| `invalid_request` | 400 | A field doesn't match the spec. The message says which. |
| `rate_limited` | 429 | Wait `retryAfter` seconds (also in the `Retry-After` header), then try again. |
| `not_found` | 404 | Not this diner's, or doesn't exist. The two read the same on purpose. |
