> ## 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.

# Process export

> When you have fetched all expense data from the voucher endpoint, you need to update the status of each voucher to mark the export as processed. The status of a voucher can be `SUCCESS` or `FAILED`.

For the successful flow, the export package and its expense reports are moved forward in the process, either to the next recipient or to the status `SENT`. You can also provide a voucher number when updating the status for additional control and security. This will make sure that the voucher can only be sent once.

```json
{
  "voucherUpdates": [
    {
        "id": "84bd3279bada45bfa97b0a3fd06fa775",
        "status": "SUCCESS",
        "bookingDate": "2024-11-21T08:29:00Z",
        "voucherNumber": "377",
        "informationText": "External System says OK"
    }
  ]
}
```

If an error occurs in the external system for some reason and you want to abort the import, you can report an error on a voucher, this will make the report(s) remain in status Ready to send. Ideally, you should also send a message highlighting the error and how to solve it.

```json
{
  "voucherUpdates":
  [
   {
        "id": "9cfefc3a60f641aea631cf573ea15e6f",
        "status": "FAILED",
        "errorText": "Processing error please correct"
   }
  ]
}
```



## OpenAPI

````yaml /openapi/findity-connect-api.json put /organizations/{organizationId}/exports/{exportId}/updatestatus
openapi: 3.0.3
info:
  title: Findity Connect API
  description: Findity Connect API
  version: 1.0.0
servers:
  - url: https://stage-api.findity.com/api/v1/connect
  - url: https://api.findity.com/api/v1/connect
security:
  - bearerAuth: []
paths:
  /organizations/{organizationId}/exports/{exportId}/updatestatus:
    put:
      tags:
        - Exports
      summary: Process export
      description: >-
        When you have fetched all expense data from the voucher endpoint, you
        need to update the status of each voucher to mark the export as
        processed. The status of a voucher can be `SUCCESS` or `FAILED`.


        For the successful flow, the export package and its expense reports are
        moved forward in the process, either to the next recipient or to the
        status `SENT`. You can also provide a voucher number when updating the
        status for additional control and security. This will make sure that the
        voucher can only be sent once.


        ```json

        {
          "voucherUpdates": [
            {
                "id": "84bd3279bada45bfa97b0a3fd06fa775",
                "status": "SUCCESS",
                "bookingDate": "2024-11-21T08:29:00Z",
                "voucherNumber": "377",
                "informationText": "External System says OK"
            }
          ]
        }

        ```


        If an error occurs in the external system for some reason and you want
        to abort the import, you can report an error on a voucher, this will
        make the report(s) remain in status Ready to send. Ideally, you should
        also send a message highlighting the error and how to solve it.


        ```json

        {
          "voucherUpdates":
          [
           {
                "id": "9cfefc3a60f641aea631cf573ea15e6f",
                "status": "FAILED",
                "errorText": "Processing error please correct"
           }
          ]
        }

        ```
      parameters:
        - $ref: '#/components/parameters/organizationId'
        - $ref: '#/components/parameters/exportId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoucherUpdates'
            example:
              voucherUpdates:
                - id: 70673d31e9704f768d70748c173ad7c1
                  status: SUCCESS
                  bookingDate: '2023-02-21T13:58:00Z'
                  voucherNumber: '123'
                  informationText: null
                  errorText: null
      responses:
        '202':
          description: Accepted
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400Error'
              example:
                export missing voucher json property:
                  value:
                    result: error
                    code: EXPORT_MISSING_EXPORT_VOUCHER_JSON
                    description: No voucher information for export
                recipient maybe deleted in organization:
                  value:
                    result: error
                    code: RECIPIENT_NOT_FOUND
                    description: Recipient not found in organization
                failed to parse json body:
                  value:
                    result: error
                    code: INVALID_JSON_BODY
                    description: Failed to parse json body
                body is missing voucher updates field:
                  value:
                    result: error
                    code: INVALID_JSON_BODY
                    description: Missing voucher updates
                missing voucher id:
                  value:
                    result: error
                    code: INVALID_JSON_BODY
                    description: Missing voucher id
                wrong status field:
                  value:
                    result: error
                    code: UNRECOGNIZED_STATUS
                    description: Wrong or missing status value
                booking date could not be parsed:
                  value:
                    result: error
                    code: INVALID_DATE
                    description: Booking date was sent but could not be parsed
                unknown properties in body:
                  value:
                    result: error
                    code: NO_KNOWN_JSON_PROPERTIES
                    description: No known, or only read-only properties received
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/401Error'
              example:
                you are not authorized to access this endpoint:
                  value:
                    result: error
                    description: Not authorized
        '404':
          description: Not found error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400Error'
              examples:
                organization not found:
                  value:
                    result: error
                    code: ORGANIZATION_NOT_FOUND
                    description: Organization not found
                export not found:
                  value:
                    result: error
                    code: EXPORT_NOT_FOUND
                    description: Export not found
components:
  parameters:
    organizationId:
      in: path
      name: organizationId
      required: true
      description: The id of the organization of the user
      schema:
        $ref: '#/components/schemas/Uuid'
      example: 05b8daba9ba14a49846fe77883248cf0
    exportId:
      in: path
      name: exportId
      required: true
      description: The external export id
      schema:
        $ref: '#/components/schemas/Uuid'
      example: 5872b62a126d458cb385b955c52bc5b2
  schemas:
    VoucherUpdates:
      type: object
      properties:
        voucherUpdates:
          type: array
          items:
            type: object
            properties:
              errorText:
                type: string
              voucherNumber:
                type: string
              bookingDate:
                type: string
                format: date-time
              id:
                type: string
              informationText:
                type: string
              status:
                type: string
      example:
        voucherUpdates:
          - id: 70673d31e9704f768d70748c173ad7c1
            status: SUCCESS
            bookingDate: '2023-02-21T13:58:00Z'
            voucherNumber: '123'
            informationText: null
            errorText: null
    400Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
    401Error:
      type: object
      properties:
        result:
          type: string
        description:
          type: string
    Uuid:
      type: string
      pattern: ^[0-9a-fA-F]{32}$
      description: UUID without dashes (32-character hex string)
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````