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

# Send progress counters for selected expense reports

> Counts the selected expense reports by status, so that a client can follow the progress of a bulk send by calling it before the send and then again while the reports are being sent.

When the organization has more than one recipient, a report is sent to each recipient in its send chain, and the endpoint counts those sends grouped by report status and chain status. Sends to recipients removed from the organization are left out. A selected report without sends to active recipients, for example one with no send chain yet, is counted once, with `chainStatus` repeating `reportStatus`. A failed send stays TRANSFER_TO_RECIPIENT while the report goes to ERROR. When the organization has at most one recipient, it counts the reports by report status, and `chainStatus` repeats `reportStatus`.

Supports the external id of the organization in `organizationId`.




## OpenAPI

````yaml /openapi/findity-admin-api.json get /organizations/{organizationId}/reports/chaincounters
openapi: 3.1.0
info:
  title: Findity Admin API
  description: Findity Admin API
  version: 1.0.0
servers:
  - url: https://stage-api.findity.com/api/v1/admin
  - url: https://api.findity.com/api/v1/admin
security:
  - bearerAuth: []
paths:
  /organizations/{organizationId}/reports/chaincounters:
    get:
      tags:
        - Expense Reports
      summary: Send progress counters for selected expense reports
      description: >
        Counts the selected expense reports by status, so that a client can
        follow the progress of a bulk send by calling it before the send and
        then again while the reports are being sent.


        When the organization has more than one recipient, a report is sent to
        each recipient in its send chain, and the endpoint counts those sends
        grouped by report status and chain status. Sends to recipients removed
        from the organization are left out. A selected report without sends to
        active recipients, for example one with no send chain yet, is counted
        once, with `chainStatus` repeating `reportStatus`. A failed send stays
        TRANSFER_TO_RECIPIENT while the report goes to ERROR. When the
        organization has at most one recipient, it counts the reports by report
        status, and `chainStatus` repeats `reportStatus`.


        Supports the external id of the organization in `organizationId`.
      operationId: getOrganizationReportChainCounters
      parameters:
        - $ref: '#/components/parameters/organizationIdOrExternalIdInPath'
        - $ref: '#/components/parameters/chainCounterExpenseReportIds'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportChainCounters'
        '400':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400Error'
              examples:
                missingExpenseReportIds:
                  summary: expenseReportIds was left out
                  value:
                    result: error
                    code: MISSING_PARAMETER
                    description: >-
                      expenseReportIds is required for action
                      'getReportChainCounters'
                tooManyReports:
                  summary: More reports than the batch limit
                  value:
                    result: error
                    code: INVALID_PARAMETER
                    description: A maximum of 100 reports can be handled at once, got 101
        '401':
          description: >
            The caller lacks the `adminApiExpenseReports:getReportChainCounters`
            permission. A caller who has the permission but no access to the
            organization gets 404 `ORGANIZATION_NOT_FOUND` instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/401Error'
              examples:
                unauthorized:
                  summary: The caller lacks the permission the endpoint requires
                  value:
                    result: unauthorized
        '404':
          description: The organization does not exist or the caller has no access to it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/404Error'
              examples:
                organizationNotFound:
                  summary: Organization not found
                  value:
                    result: error
                    code: ORGANIZATION_NOT_FOUND
                    description: Organization not found
components:
  parameters:
    organizationIdOrExternalIdInPath:
      in: path
      name: organizationId
      required: true
      description: >-
        Unique identifier of the organization. String in UUID without dashes
        (32-character hex string) if access is done via values from Findity
        system otherwise, id of external system can be used
      schema:
        type: string
      examples:
        Findity unique id:
          value: 05b8daba9ba14a49846fe77883248cf0
        External system unique id:
          value: a31a7372-3397-3924-ffcd-b7b4795e42eb
    chainCounterExpenseReportIds:
      name: expenseReportIds
      in: query
      description: >
        The expense reports to count, as a comma separated list

        (`expenseReportIds=05b8daba9ba14a49846fe77883248cf0,7c1f0a3b9d2e4f5a8b6c0d1e2f3a4b5c`).
        The

        endpoint also accepts the parameter repeated once per id, but the comma
        separated form is the one

        this contract describes and the one generated clients will send.


        Ids that do not belong to the organization are left out of the counts.
        Duplicates are counted

        once. Array of strings, UUID format (32-character hexadecimal), 1-100
        items. Required.
      required: true
      style: form
      explode: false
      schema:
        type: array
        minItems: 1
        maxItems: 100
        items:
          $ref: '#/components/schemas/Uuid'
      example:
        - 05b8daba9ba14a49846fe77883248cf0
        - 7c1f0a3b9d2e4f5a8b6c0d1e2f3a4b5c
  schemas:
    ReportChainCounters:
      type: object
      required:
        - counts
      properties:
        counts:
          type: array
          description: >-
            One counter per combination of report status and chain status.
            Combinations without reports are left out.
          items:
            type: object
            required:
              - reportStatus
              - chainStatus
              - count
            properties:
              reportStatus:
                type: string
                description: >-
                  Lifecycle status of the expense report, for example
                  READY_TO_SEND, ERROR, TRANSFER or SENT.
              chainStatus:
                type: string
                description: >
                  With more than one recipient, the status of one send in the
                  report's send chain: TRANSFER_TO_RECIPIENT (waiting to be
                  sent, also after a failed send), TRANSFER or SENT. A failed
                  send keeps TRANSFER_TO_RECIPIENT, so it is found by
                  `reportStatus` ERROR. With at most one recipient, or for a
                  report without sends to active recipients, the same value as
                  `reportStatus`.
              count:
                type: integer
                minimum: 1
                description: >
                  With more than one recipient, the number of sends in this
                  combination; a report is counted once per send in its send
                  chain (normally one per recipient). Sends to recipients
                  removed from the organization are left out, and a report
                  without sends to active recipients is counted once. With at
                  most one recipient, the number of reports.
      example:
        counts:
          - reportStatus: READY_TO_SEND
            chainStatus: SENT
            count: 2
          - reportStatus: READY_TO_SEND
            chainStatus: TRANSFER_TO_RECIPIENT
            count: 2
          - reportStatus: ERROR
            chainStatus: TRANSFER_TO_RECIPIENT
            count: 1
    400Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
    401Error:
      type: object
      properties:
        result:
          type: string
      example:
        result: unauthorized
    404Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
      example:
        result: error
        code: ORGANIZATION_NOT_FOUND
        description: 'Failed to get organization for id: {orgId}'
    Uuid:
      type: string
      pattern: ^[0-9a-fA-F]{32}$
      description: UUID without dashes (32-character hex string)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````