# API for developers

> API documentation for developers. With the API you can integrate WorkPan with your own software or website

https://workpan.com/en/doc/api/  
Published: 2018-11-29  
Updated: 2026-09-11

---

The WorkPan API offers a set of callable methods.

You can integrate WorkPan with any application by accessing the database through the API.

A rate limit applies to every request: no more than 8 requests per second.

Before using the **API** you have to enable it and generate a `token` key — that is done in the “Modules” section of the control panel. After that every API request must carry this `token` parameter.

Requests can be sent with `GET|POST`.

All responses are returned in `JSON`.

`URL:` is the address of your system, for example `https://_YOUR_LOGIN_.workpan.com`.

In this guide we use the **DEMO system** with the following details

<dl>
  <dt><code>URL:</code></dt>
  <dd>https://demo.workpan.com</dd>
  <dt><code>token:</code></dt>
  <dd>wt3sctw89sl</dd>
  </dl> 
#### Contents:

- [Section 1: Getting the status of an order](#menu_orderStatus)
- [Section 2: Getting the IDs of all orders](#menu_orderIds)
- [Section 3: Getting order details by ID](#menu_orderById)
- [Section 4: Getting contact details by ID](#menu_contactById)
- [Section 5: Getting status details by ID](#menu_statusById)
- [Section 6: Getting employee details by ID](#menu_userById)
- [Section 7: Getting text data by ID (fields ending in \_tid)](#menu_textById)
- [Section 8: Getting reference book data by ID (fields ending in \_rid)](#menu_rosterById)

### Section 1: Getting the status of an order

##### Request:

|                               |                          |
|-------------------------------|--------------------------|
| `Method`                       | `/api/order-status/`     |
| `token` <sup>(required)</sup> | `(string)` token         |
| `id` <sup>(required)</sup>    | `(integer)` Order number |

##### Response:

| Key | Type | Description |
|----------|-------------|---------------------------------|
| `status` | `(boolean)` | Request status: **TRUE\|FALSE** |
| `data`   | `(object)`  | The data object                  |

The `data` object in detail.

<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>id</code></td>
<td>Order key</td>
</tr>
<tr>
<td><code>contacts_id</code></td>
<td>Contact key</td>
</tr>
<tr>
<td><code>contacts_name</code></td>
<td>Contact name</td>
</tr>
<tr>
<td><code>global_sid</code></td>
<td>Status key</td>
</tr>
<tr>
<td><code>global_status_name</code></td>
<td>Full status description</td>
</tr>
<tr>
<td><code>global_status_name_sm</code></td>
<td>Short status description</td>
</tr>
<tr>
<td><code>global_status_class</code></td>
<td>Status class: <code>('none','warning','success','important','info','inverse')</code></td>
</tr>
<tr>
<td><code>global_status_type</code></td>
<td>Status type: <code>(1 = waiting, 2 = open, 3 = in progress, 4 = success, 5 = error, 6 = closed)</code></td>
</tr>
<tr>
<td><code>gid</code></td>
<td>Device type key</td>
</tr>
<tr>
<td><code>g_name</code></td>
<td>Device type</td>
</tr>
<tr>
<td><code>bid</code></td>
<td>Brand key</td>
</tr>
<tr>
<td><code>b_name</code></td>
<td>Brand</td>
</tr>
<tr>
<td><code>models_id</code></td>
<td>Model key</td>
</tr>
<tr>
<td><code>m_name</code></td>
<td>Model</td>
</tr>
<tr>
<td><code>imei</code></td>
<td>Device IMEI</td>
</tr>
<tr>
<td><code>bt_data</code></td>
<td>Fault description</td>
</tr>
<tr>
<td><code>nt_data</code></td>
<td>Order note</td>
</tr>
<tr>
<td><code>discount_name</code></td>
<td>Discount</td>
</tr>
<tr>
<td><code>sumPrice</code></td>
<td>Total for services</td>
</tr>
<tr>
<td><code>sumDiscount</code></td>
<td>Discount amount</td>
</tr>
<tr>
<td><code>sumTotal</code></td>
<td>Grand total</td>
</tr>
<tr>
<td><code>repairs</code></td>
<td>An array of repair type objects:<br />
<br />
&#10;<ul>
<li><code>orders_repairs_id</code> — the repair ticket</li>
<li><code>products_rosters_id</code> — the repair type key</li>
<li><code>products_rosters_name</code> — the name</li>
<li><code>price</code> — the price</li>
</ul></td>
</tr>
<tr>
<td><code>details</code></td>
<td>An array of component objects:<br />
<br />
&#10;<ul>
<li><code>orders_details_id</code> — the purchasing ticket</li>
<li><code>details_rosters_id</code> — the part key</li>
<li><code>details_rosters_name</code> — the name</li>
<li><code>price</code> — the price</li>
</ul></td>
</tr>
</tbody>
</table>

#### [Request example:](#request_orderStatus)

    <?php
    $url = 'https://demo.workpan.com/api/order-status/';
    $token = 'wt3sctw89sl'; // Sample token, you can get yours in your account
    $id = 10; // Sample order key
    $postData = array(
        'token' => $token,
        'id' => $id
    );
    $post = http_build_query($postData);

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    $response = curl_exec($ch);
    curl_close($ch);

    // Output
    $obj = json_decode($response);
    var_dump($obj);

#### [Response example:](#result_orderStatus)

    {
        "data": {
            "id": "10",
            "contacts_id": "23",
            "contacts_name": "Мария",
            "global_sid": "27",
            "global_status_name": "Выдан с ремонтом",
            "global_status_name_sm": "Выдан с ремонтом",
            "global_status_class": "info",
            "global_status_type": "4",
            "gid": "2",
            "g_name": "Планшет",
            "bid": "1",
            "b_name": "3Q",
            "models_id": "17",
            "m_name": "3Q Q-pad MT0729D",
            "imei": null,
            "bt_data": "После попадания воды планшет не включается, так же разбит дисплей",
            "nt_data": null,
            "discount_name": null,
            "sumPrice": "7500.00",
            "sumDiscount": "0.00",
            "sumTotal": "7500.00",
            "repairs": [
                {
                    "orders_repairs_id": "34",
                    "products_rosters_id": "1",
                    "products_rosters_name": "Диагностика",
                    "price": "0"
                },
                {
                    "orders_repairs_id": "35",
                    "products_rosters_id": "2",
                    "products_rosters_name": "Чистка после попадания воды",
                    "price": "1500"
                },
                {
                    "orders_repairs_id": "36",
                    "products_rosters_id": "85",
                    "products_rosters_name": "Замена модуля (стекло, тачскрин и дисплей)",
                    "price": "1500"
                }
            ],
            "details": [
                {
                    "orders_details_id": "5",
                    "details_rosters_id": "48",
                    "details_rosters_name": "Модуль (стекло, тачскрин и дисплей)",
                    "price": "4500"
                }
            ]
        },
        "status": true
    }

### Section 2: Getting the IDs of all orders

##### Request:

|  |  |
|----|----|
| `Method` | `/api/get-orders-ids/` |
| `token` <sup>(required)</sup> | `(string)` token |
| `page` | `(integer)` Page number |
| `create_date_start` | `(integer)` Order creation date, from (UNIXTIMESTAMP) |
| `create_date_end` | `(integer)` Order creation date, to (UNIXTIMESTAMP) |

##### Response:

| Key | Type | Description |
|-------------|------------|-----------------------------------------------------|
| `paginator` | `(object)` | Paging data for the request              |
| `items`     | `(object)` | Order IDs, for fetching the full data afterwards |

#### [Response example:](#result_orderIds)

    {
      "paginator": {
        "pageCount": 2,
        "itemCountPerPage": 10,
        "first": 1,
        "current": 1,
        "last": 2,
        "next": 2,
        "pagesInRange": {
          "1": 1,
          "2": 2
        },
        "firstPageInRange": 1,
        "lastPageInRange": 2,
        "currentItemCount": 10,
        "totalItemCount": 11,
        "firstItemNumber": 1,
        "lastItemNumber": 10
      },
      "items": [
        "1",
        "2",
        "9",
        "22",
        "29",
        "30",
        "31",
        "32",
        "33",
        "34"
      ]
    }

### Section 3: Getting order details by ID

##### Request:

|                               |                          |
|-------------------------------|--------------------------|
| `Method`                       | `/api/get-order-by-id/`  |
| `token` <sup>(required)</sup> | `(string)` token         |
| `id` <sup>(required)</sup>    | `(integer)` Order number |

##### Response:

| Key | Type | Description |
|----|----|----|
| `id` | `(integer)` | Order ID |
| `contacts_id` | `(integer)` | Contact/client ID <sup>(see the corresponding section for the full data)</sup> |
| `models_id` | `(integer)` | Model ID |
| `models_name` | `(string)` | Model name |
| `models_gadgets_id` | `(integer)` | Device type ID |
| `models_gadgets_name` | `(string)` | Device type name |
| `models_brands_id` | `(integer)` | Brand ID |
| `models_brands_name` | `(string)` | Brand name |
| `services_id` | `(integer)` | Service centre ID |
| `create_uid` | `(integer)` | ID of the user who created the order (see the corresponding section for the data) |
| `create_date` | `(datetime)` | Order creation date |
| `create_date_u` | `(integer)` | Order creation date (UNIXTIMESTAMP) |
| `priority` | `(integer)` | Order priority `(1, 2, 3)` |
| `isService` | `(boolean)` | Whether the device is at the service centre `(0 => with the client, 1 => at the service centre)` |
| `isWarranty` | `(boolean)` | Is it a warranty order? `(0 => no, 1 => yes)` |
| `isClose` | `(boolean)` | Is the order closed? `(0 => no, it can be edited, 1 => yes, closed)` |
| `bug_tid` | `(integer)` | Fault description key <sup>(see the corresponding section for the full data)</sup> |
| `note_tid` | `(integer)` | Order note <sup>(see the corresponding section for the full data)</sup> |
| `color_rid` | `(integer)` | Device colour <sup>(see the corresponding section for the full data)</sup> |
| `discount_rid` | `(integer)` | Order discount <sup>(see the corresponding section for the full data)</sup> |
| `discount_type` | `(integer)` | Discount type `(1 => on labour, 2 => on everything)` |
| `oriented` | `(integer)` | Agreed amount |
| `imei` | `(string)` | Device serial number |
| `cond` | `(string)` | Condition |
| `appearance` | `(string)` | Appearance |
| `complete` | `(string)` | What came with it |
| `global_sid` | `(integer)` | Global order status <sup>(see the corresponding section for the full data)</sup> |
| `client_sid` | `(integer)` | Client status <sup>(see the corresponding section for the full data)</sup> |
| `acceptance_sid` | `(integer)` | Intake status <sup>(see the corresponding section for the full data)</sup> |
| `detail_sid` | `(integer)` | Parts status <sup>(see the corresponding section for the full data)</sup> |
| `repair_sid` | `(integer)` | Repairs status <sup>(see the corresponding section for the full data)</sup> |
| `delivery_sid` | `(integer)` | Handover status <sup>(see the corresponding section for the full data)</sup> |
| `acceptance_uid` | `(integer)` | ID of the employee who took the device in <sup>(see the corresponding section for the full data)</sup> |
| `acceptance_date` | `(datetime)` | Intake date |
| `acceptance_date_u` | `(integer)` | Intake date (UNIXTIMESTAMP) |
| `delivery_uid` | `(integer)` | ID of the user who handed the device over <sup>(see the corresponding section for the full data)</sup> |
| `delivery_date` | `(datetime)` | Handover date |
| `delivery_date_u` | `(integer)` | Handover date (UNIXTIMESTAMP) |
| `delivery_type` | `(integer)` | Handover type `(1 => repaired, 2 => not repaired)` |
| `expect_date` | `(date)` | Expected handover date |
| `expect_date_u` | `(integer)` | Expected handover date (UNIXTIMESTAMP) |
| `sumPrice` | `(float)` | Total for all services |
| `sumDiscount` | `(float)` | Discount amount |
| `sumTotal` | `(float)` | Grand total (services minus discount) |
| `sumExpense` | `(float)` | Total expenses |
| `sumPaid` | `(float)` | Paid |
| `sumIncome` | `(string)` | Profit |
| `guarantee_rid` | `(string)` | Warranty key ID <sup>(see the corresponding section for the full data)</sup> |

#### [Response example:](#result_orderById)

    {
      "id": "31",
      "contacts_id": "23",
      "models_id": "1928",
      "models_name": "Apple iPhone 2G",
      "models_gadgets_id": "1",
      "models_gadgets_name": "Apple",
      "models_brands_id": "5",
      "models_brands_name": "Телефон",
      "services_id": "2",
      "create_uid": "1",
      "create_date": "2018-07-05 16:30:55",
      "create_date_u": "1530790255",
      "priority": "2",
      "isService": "1",
      "isWarranty": "0",
      "isClose": "0",
      "bug_tid": "10",
      "note_tid": null,
      "color_rid": "107",
      "discount_rid": null,
      "discount_type": null,
      "oriented": "0",
      "imei": "",
      "cond": "Б/У",
      "appearance": "Потертости,Царапины",
      "complete": "Без упаковки,Без флешки,Без СЗУ,Без аккумлятора",
      "global_sid": "14",
      "client_sid": "7",
      "acceptance_sid": "10",
      "detail_sid": "14",
      "repair_sid": "21",
      "delivery_sid": null,
      "acceptance_uid": "1",
      "acceptance_date": "2019-01-19 14:36:40",
      "acceptance_date_u": "1547890600",
      "delivery_uid": null,
      "delivery_date": null,
      "delivery_date_u": null,
      "delivery_type": null,
      "expect_date": "2019-03-11",
      "expect_date_u": "1552244400",
      "sumPrice": "1000.00",
      "sumDiscount": "0.00",
      "sumTotal": "1000.00",
      "sumExpense": "0.00",
      "sumPaid": "1000.00",
      "sumIncome": "1000.00",
      "guarantee_rid": null
    }

### Section 4: Getting contact details by ID

##### Request:

|                               |                            |
|-------------------------------|----------------------------|
| `Method`                       | `/api/get-contact-by-id/`  |
| `token` <sup>(required)</sup> | `(string)` token           |
| `id` <sup>(required)</sup>    | `(integer)` Contact number |

##### Response:

| Key | Type | Description |
|----|----|----|
| `id` | `(integer)` | Contact ID |
| `name` | `(string)` | Name |
| `create_users_id` | `(integer)` | The user who created the contact |
| `date_create` | `(datetime)` | Creation date |
| `date_create_u` | `(integer)` | Creation date (UNIXTIMESTAMP) |
| `date_update` | `(datetime)` | Update date |
| `date_update_u` | `(integer)` | Update date (UNIXTIMESTAMP) |
| `types` | `(string)` | Contact type `(ENUM('client','organization','provider'))` |
| `status` | `(integer)` | Status |
| `update_users_id` | `(integer)` | ID of the user who updated the contact |
| `communications` | `(object)` | An array of the contact’s communication data (phone, website, address and so on) |

#### [Response example:](#result_contactById)

    {
      "id": "23",
      "name": "Мария",
      "create_users_id": "1",
      "date_create": "2018-06-11 18:38:11",
      "date_create_u": "1528724291",
      "date_update": "2019-03-29 16:44:23",
      "date_update_u": "1553859863",
      "types": "client",
      "status": "1",
      "update_users_id": "1",
      "communications": [
        {
          "rosters_id": "1",
          "rosters_name": "Телефон",
          "rosters_type_id": "17",
          "rosters_type_name": "Мобильный",
          "data": "78124987856"
        },
        {
          "rosters_id": "1",
          "rosters_name": "Телефон",
          "rosters_type_id": "16",
          "rosters_type_name": "Рабочий",
          "data": "7495123456"
        }
      ]
    }

### Section 5: Getting status details by ID

##### Request:

|                               |                          |
|-------------------------------|--------------------------|
| `Method`                       | `/api/get-status-by-id/` |
| `token` <sup>(required)</sup> | `(string)` token         |
| `id` <sup>(required)</sup>    | `(integer)` Status ID   |

##### Response:

| Key | Type | Description |
|----|----|----|
| `id` | `(integer)` | Status ID |
| `name` | `(string)` | Name |
| `name_small` | `(string)` | Short name |
| `status_groups_id` | `(integer)` | Status group ID |
| `status_groups_name` | `(string)` | Status group name |
| `class` | `(string)` | class `ENUM('none','warning','success','important','info','inverse')` |
| `class_i` | `(integer)` | class integer |
| `type` | `(string)` | type `ENUM(waiting, open, in progress, success, error, closed)` |
| `type_i` | `(integer)` | type integer |

#### [Response example:](#result_statusById)

    {
      "id": "14",
      "name": "Требуется назначить закупщика",
      "name_small": "Тр. назначить закупщика",
      "status_groups_id": "4",
      "status_groups_name": "Запчасти",
      "class": "warning",
      "class_i": "2",
      "type": "ожидание",
      "type_i": "1"
    }

### Section 6: Getting employee details by ID

##### Request:

|                               |                           |
|-------------------------------|---------------------------|
| `Method`                       | `/api/get-user-by-id/`    |
| `token` <sup>(required)</sup> | `(string)` token          |
| `id` <sup>(required)</sup>    | `(integer)` Employee ID |

##### Response:

| Key | Type | Description |
|------------|-------------|---------------|
| `id`       | `(integer)` | Employee ID |
| `name`     | `(string)`  | First name |
| `lastname` | `(string)`  | Last name |

#### [Response example:](#result_userById)

    {
      "id": "1",
      "create_date": "2018-04-18 19:11:42",
      "create_date_u": "1524060702",
      "create_uid": "1",
      "name": "Иван",
      "lastname": "Иванов",
      "patronymic": null,
      "login": "ivanov123",
      "auths_groups_id": "1",
      "isAdmin": "1",
      "services_id": "1",
      "status_id": "50",
      "rosters_posts_id": "1",
      "date_birth": "1989-01-01",
      "date_birth_u": "614372400",
      "note": null,
      "career_start": "2018-02-01",
      "career_end": null,
      "communications": [
        {
          "rosters_id": "1",
          "rosters_name": "Телефон",
          "rosters_type_id": null,
          "rosters_type_name": null,
          "data": "+749512346"
        },
        {
          "rosters_id": "3",
          "rosters_name": "E-mail",
          "rosters_type_id": null,
          "rosters_type_name": null,
          "data": "info@example.com"
        },
        {
          "rosters_id": "12",
          "rosters_name": "Мессенджер",
          "rosters_type_id": null,
          "rosters_type_name": null,
          "data": "skype_name"
        }
      ]
    }

### Section 7: Getting text data by ID (fields ending in \_tid)

##### Request:

|  |  |
|----|----|
| `Method` | `/api/get-text-by-id/` |
| `token` <sup>(required)</sup> | `(string)` token |
| `id` <sup>(required)</sup> | `(integer)` ID of the record \| the `_tid` fields in the requests above |

##### Response:

| Key | Type | Description |
|--------|-------------|----------|
| `id`   | `(integer)` | ID       |
| `data` | `(string)`  | The data |

#### [Response example:](#result_textById)

    {
      "id": "15",
      "data": "Не заряжается"
    }

### Section 8: Getting reference book data by ID (fields ending in \_rid)

##### Request:

|  |  |
|----|----|
| `Method` | `/api/get-roster-by-id/` |
| `token` <sup>(required)</sup> | `(string)` token |
| `id` <sup>(required)</sup> | `(integer)` ID of the record \| the `_rid` fields in the requests above |

##### Response:

| Key | Type | Description |
|--------|-------------|----------|
| `id`   | `(integer)` | ID       |
| `name` | `(string)`  | Name |

#### [Response example:](#result_rosterById)

    {
      "id": "15",
      "name": "Банковские реквизиты"
    }