---
title: "POST order link counts for a batch of orders"
method: POST
path: "/orders/links/counts"
tags: ["Orders"]
---

# POST order link counts for a batch of orders

`POST /orders/links/counts`

## Request

- Base URL: `https://api.equipmentshare.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.equipmentshare.com/orders/links/counts`
- Auth: HTTP bearer

Link counts for many orders in one call, so the Orders table can render its linked-record columns without a request per row. Each order is returned whether or not it has links, and the linked records are included alongside the counts so the breakdown does not need a second call. A symmetric sales-order link is counted once for each of its two orders.

## Request body

- OrderLinkCountsRequest
  - `order_ids` integer[], required: Order ids to fetch link counts for. A page of the Orders grid is 100 rows; the cap of 200 leaves headroom without allowing an unbounded query.

## Response `200`

- OrderLinkCountsResponse
  - `orders` OrderLinkCountsItem[], required
    - `order_id` integer, required
    - `purchase_order_count` integer, required
    - `purchase_orders` LinkedPurchaseOrder[], required
      - `order_link_id` integer, required
      - `purchase_order_id` string, required
    - `sales_order_count` integer, required
    - `sales_orders` LinkedSalesOrder[], required
      - `branch_name` string, nullable
      - `company_id` integer, nullable
      - `company_name` string, nullable
      - `order_id` integer, required
      - `order_link_id` integer, required
      - `order_status` string, nullable
    - `work_order_count` integer, required
    - `work_orders` LinkedWorkOrder[], required
      - `description` string, nullable
      - `order_link_id` integer, required
      - `status` string, nullable
      - `work_order_id` integer, required
      - `work_order_type_id` integer, nullable

## Other responses

- `400`: Bad request - validation failed or malformed data.
- `401`: Unauthorized - valid Bearer token required.
- `403`: Forbidden - admin role required.

## Changes

- **2026-12-01** `40651e1558ac`: 1 info
  - added the media type `application/json` for the response with the status `200`
- **2026-12-01** `e598b74c6170`: 1 breaking
  - removed the media type `application/json` for the response with the status `200`
- **2026-11-30** `beba24fafb51`: 1 info
  - added the media type `application/json` for the response with the status `200`
- **2026-11-30** `c20ff16a0438`: 1 breaking
  - removed the media type `application/json` for the response with the status `200`
- **2026-11-30** `f6ee63f54e57`: 1 info
  - added the media type `application/json` for the response with the status `200`

[Operation history](https://skmtc.dev/equipmentshare/apis/es-api/changes/orders/links/counts/post.md)

---

[API](https://skmtc.dev/equipmentshare/apis/es-api.md) - [All operations](https://skmtc.dev/equipmentshare/apis/es-api/llms.txt) - [OpenAPI document](https://skmtc.dev/equipmentshare/apis/es-api/revisions/40651e1558ac?raw)
