> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.useopenwrench.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Count purchase request line items

> Returns the number of purchase request line items matching the supplied filters, scoped to the API key's supplier company/facility. Any query-string parameter other than the paging parameters is passed to the data layer as an equality filter on the corresponding entity column (e.g. `status=requested`, `stockLocationId=42`). Results are always restricted to the supplier company/facility associated with the API key.



## OpenAPI

````yaml /openapi/partners.json get /v1/partners/inventory/purchase_request_line_items/count_by
openapi: 3.1.0
info:
  title: OpenWrench Internal Teams API
  version: 1.0.0
  description: >-
    External partners API for OpenWrench supplier inventory: purchase requests,
    purchase orders, receipts, parts, equipment types, vendors, stock locations,
    per-stock-location inventory, and work order part/equipment usage.


    ## Authentication

    Every request must include an API key in the `X-API-KEY` header. Requests
    with a missing or invalid key receive `401 Unauthorized`. All data is scoped
    to the supplier company/facility of the contact the API key belongs to.


    ## Rate limiting

    Each API key is limited to 10 requests per 20-second window. Requests beyond
    that receive `429 Too Many Requests`.


    ## Response envelope

    Single-entity responses are wrapped as `{ "type": "<EntityName>", "data": {
    ... }, "status": "ok" }`. List responses are wrapped as `{ "type":
    "<EntityName>", "data": [ ... ], "count": <total>, "status": "ok" }` where
    `count` is the total number of matching records. Count endpoints return `{
    "type": "Count", "data": <integer>, "status": "ok" }`. Errors are returned
    as `{ "message": "...", "type": "<ExceptionType>", "status": "error",
    "traceId": "..." }` with HTTP status 400 (bad input), 401 (missing/invalid
    key), 404 (not found), or 429 (rate limited).


    ## Pagination and filtering

    List endpoints accept `offset`, `limit` (default 10, max 25), `sort_by`, and
    `order` (`asc`|`desc`) query parameters. Any other query parameter is passed
    through as an equality filter on the corresponding entity column.


    ## Date formats

    Date-time fields serialize as strings in one of two shapes depending on the
    underlying type: ISO 8601 with offset (e.g. `2026-08-14T13:05:22.000-07:00`)
    for most timestamps, or `yyyy-MM-dd HH:mm:ss.S` (space-separated, no offset)
    for database timestamp fields. Plain dates are `yyyy-MM-dd`. When sending
    date-times, ISO 8601 is accepted.


    ## API keys

    These endpoints require a **partner API key**, which is separate from buyer
    and supplier API keys. A buyer API key will not authenticate against
    `/v1/partners/` endpoints. Contact support@useopenwrench.com to have a
    partner key issued.


    ## Required headers

    Every request must carry BOTH `X-API-KEY` (your API key) and `OW-KEY` (the
    OpenWrench shared secret issued with it). Requests missing either return
    401.
servers:
  - url: https://api.useopenwrench.com/api/external
security:
  - ApiKeyAuth: []
    OwKeyAuth: []
tags:
  - name: Ping
    description: Health/authentication check
  - name: Purchase Requests
    description: Supplier inventory purchase requests
  - name: Purchase Request Line Items
    description: Line items on purchase requests
  - name: Purchase Orders
    description: Supplier inventory purchase orders
  - name: Purchase Order Line Items
    description: Line items on purchase orders
  - name: Purchase Order Receipts
    description: Receipts recorded against purchase order line items
  - name: Parts
    description: Supplier part catalog
  - name: Equipment Types
    description: Supplier equipment type catalog
  - name: Vendors
    description: Part/equipment vendors
  - name: Stock Locations
    description: Warehouses and mobile stock locations
  - name: Parts Per Stock Location
    description: Part stocking records per stock location
  - name: Equipment Per Stock Location
    description: Individual equipment held per stock location
  - name: Work Order Parts and Equipment
    description: Parts and equipment used on work orders
paths:
  /v1/partners/inventory/purchase_request_line_items/count_by:
    get:
      tags:
        - Purchase Request Line Items
      summary: Count purchase request line items
      description: >-
        Returns the number of purchase request line items matching the supplied
        filters, scoped to the API key's supplier company/facility. Any
        query-string parameter other than the paging parameters is passed to the
        data layer as an equality filter on the corresponding entity column
        (e.g. `status=requested`, `stockLocationId=42`). Results are always
        restricted to the supplier company/facility associated with the API key.
      operationId: countPurchaseRequestLineItems
      parameters:
        - $ref: '#/components/parameters/Offset'
        - $ref: '#/components/parameters/Limit'
        - $ref: '#/components/parameters/SortBy'
        - $ref: '#/components/parameters/Order'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CountResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    Offset:
      name: offset
      in: query
      required: false
      schema:
        type: integer
        minimum: 0
        default: 0
      description: Number of records to skip
    Limit:
      name: limit
      in: query
      required: false
      schema:
        type: integer
        minimum: 1
        maximum: 25
        default: 10
      description: Page size (default 10, max 25)
    SortBy:
      name: sort_by
      in: query
      required: false
      schema:
        type: string
      description: Field name to sort by
    Order:
      name: order
      in: query
      required: false
      schema:
        type: string
        enum:
          - asc
          - desc
      description: Sort direction
  schemas:
    CountResponse:
      type: object
      description: Envelope whose data is an integer count.
      properties:
        type:
          type: string
          description: '"Count"'
        data:
          type: integer
          format: int64
          description: The count
        status:
          type: string
          enum:
            - ok
      required:
        - type
        - data
        - status
    Error:
      type: object
      description: Standard error envelope.
      properties:
        message:
          type: string
          description: Human-readable error message
        type:
          type: string
          description: >-
            Exception type, e.g. badRequestException, unauthorizedException,
            notFoundException
        status:
          type: string
          enum:
            - error
        traceId:
          type: string
          description: >-
            Server-generated trace identifier (11 alphanumeric characters) for
            support/debugging
      required:
        - message
        - type
        - status
        - traceId
  responses:
    Unauthorized:
      description: Missing or invalid X-API-KEY
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Rate limit exceeded (10 requests per 20-second window per key)
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Supplier partner API key. Rate limited to 10 requests per 20-second
        window.
    OwKeyAuth:
      type: apiKey
      in: header
      name: OW-KEY
      description: >-
        OpenWrench shared secret. Required on every request alongside X-API-KEY;
        issued together with your API key.

````