---
swagger: "2.0"
info:
  title: ACC Invoice API
  description: Welcome to the ACC Query Invoice and Payment Status APIs. These provide
    the ability for the Provider to see whether invoices for the claim, or secondary
    interactions, have been accepted and paid. Discussion with your user base regards
    whjere the value lies for them is encouraged.
  termsOfService: https://developer.acc.co.nz/terms-conditions
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 2.0.0
host: apiservicesnpe.acc.co.nz
basePath: /api/v2
schemes:
  - https
securityDefinitions:
  apiKeyHeader:
    type: apiKey
    name: apikey
    in: header
security:
- apiKeyHeader: []
tags:
- name: Invoices
  description: Invoices API
- name: Query Invoices
  description: Invoices API
- name: Query Payments
  description: Invoices API
paths:
  /claims/vendors/invoice :
     post:
      tags:
      - Invoices
      summary: Create a new Invoice for the specified Vendor.
      description: '<p>The Invoice API is the mechanism ACC receives invoices from Providers for ACC funded diagnosis & / or treatment linked to a Claim. Each invoice relates to a claim. There can be multiple invoices for each claim.</p>'
      operationId: invoices/create
      consumes:
      - application/json
      produces:
      - application/json
      - '*/*'
      parameters:
      - in: body
        name: body
        required: true
        schema:
          $ref: '#/definitions/Invoice'
      responses:
        200:
          description: OK
          schema:
            $ref: '#/definitions/InvoiceCreatedResponse'
        202:
          description: Accepted
          schema:
            $ref: '#/definitions/InvoiceCreatedResponse'
        400:
          description: 'Bad Request: invalid data'
          schema:
            $ref: '#/definitions/ApiException'
        401:
          description: 'Unauthorized: authentication error'
          schema:
            $ref: '#/definitions/ApiException'
        403:
          description: 'Forbidden: authorization error'
          schema:
            $ref: '#/definitions/ApiException'
        404:
          description: Not Found
          schema:
            $ref: '#/definitions/ApiException'
          
        500:
          description: Internal Server Error
          schema:
            $ref: '#/definitions/ApiException'
      
      x-codegen-request-body-name: invoice
  /claims/vendors/invoice/{scheduleId}:
    get:
      tags:
      - Query Invoices
      summary: Returns the details of the specified invoice.
      description: '<p>The Query Invoice and Payment Status APIs provide the ability for the Provider to see whether invoices for the claim, or secondary interactions, have been accepted and paid.This specific API returns the details of the specified invoice. </p>'
      operationId: invoices/details_single_invoice
      parameters:
      - name: vendorId
        in: query
        description: vendorId
        required: true
        type: string
      - name: scheduleId
        in: path
        description: scheduleId
        required: true
        type: integer
        format: int64
      - name: providerId
        in: query
        description: providerId
        type: string
      - name: claimNumber
        in: query
        description: claimNumber
        type: string
      - name: page
        in: query
        description: page
        type: integer
        format: int32
        default: 1
      - name: pageSize
        in: query
        description: pageSize
        type: integer
        format: int32
        default: 25
      responses:
        200:
         description: Success
         schema:
          $ref: '#/definitions/InvoiceStatusDetailsResponse'
         
        400:
          description: 'Bad Request: invalid data'
          schema:
            $ref: '#/definitions/ApiException'
        401:
          description: 'Unauthorized: authentication error'
          schema:
            $ref: '#/definitions/ApiException'
        403:
          description: 'Forbidden: authorization error'
          schema:
            $ref: '#/definitions/ApiException'
        404:
          description: Not Found
          schema:
           $ref: '#/definitions/ApiException'
        500:
          description: Internal Server Error
          schema:
                $ref: '#/definitions/ApiException'
  /claims/vendors/invoices/batch:
    get:
      tags:
      - Query Invoices
      summary: Returns a summary of Invoices for the specified Vendor.
      description: '<p>The Query Invoice and Payment Status APIs provide the ability for the Provider to see whether invoices for the claim, or secondary interactions, have been accepted and paid.This specific API returns the details of Invoices for the Vendor.</p>'
      operationId: invoices/details_list_of_invoices
      consumes:
      - application/json
      produces:
      - application/json
      - '*/*'
      parameters:
      - name: vendorId
        in: query
        description: vendorId
        required: true
        type: string
      - name: providerId
        in: query
        description: providerId
        type: string
      - name: startDate
        in: query
        description: startDate
        type: string
      - name: endDate
        in: query
        description: endDate
        type: string
      - name: processingStatus
        in: query
        description: processingStatus
        required: false
        type: string
        enum:
        - Incomplete
        - Complete & Awaiting Validation
        - Invalid
        - Awaiting Authorisation
        - Authorised
        - Partially Paid
        - Paid
        - Cancelled
        - In Exception
        - Sent-to-AR
      - name: invoiceNumber
        in: query
        description: invoiceNumber
        type: string
      - name: claimNumber
        in: query
        description: claimNumber
        type: string
      - name: page
        in: query
        description: page
        type: integer
        format: int32
        default: 1
      - name: pageSize
        in: query
        description: pageSize
        type: integer
        format: int32
        default: 25
      responses:
        200:
          description: Success
          schema:
            $ref: '#/definitions/InvoiceStatusResponse'
            
        400:
          description: 'Bad Request: invalid data'
          schema:
            $ref: '#/definitions/ApiException'
        401:
          description: 'Unauthorized: authentication error'
          schema:
            $ref: '#/definitions/ApiException'
        403:
          description: 'Forbidden: authorization error'
          schema:
            $ref: '#/definitions/ApiException'
        404:
          description: Not Found
          schema:
            $ref: '#/definitions/ApiException'
        500:
          description: Internal Server Error
          schema:
            $ref: '#/definitions/ApiException'
  /claims/vendors/payments:
    get:
      tags:
      - Query Payments
      summary: Get a list of Payments for the specified Vendor.
      description: '<p>The Query Invoice and Payment Status APIs provide the ability for the Provider to see whether invoices for the claim, or secondary interactions, have been accepted and paid.This specific API returns a list of payments for the specified Vendor. </p>'
      operationId: payments/list_of_payments
      parameters:
      - name: vendorId
        in: query
        description: vendorId
        required: true
        type: string
      - name: startDate
        in: query
        description: startDate
        type: string
      - name: endDate
        in: query
        description: endDate
        type: string
      - name: paymentReference
        in: query
        description: paymentReference
        type: string
      - name: page
        in: query
        description: page
        type: integer
        format: int32
        default: 1
      - name: pageSize
        in: query
        description: pageSize
        type: integer
        format: int32
        default: 25
      responses:
        200:
          description: Success
          schema:
            $ref: '#/definitions/InvoicePaymentResponse'
            
        400:
          description: 'Bad Request: invalid data'
          schema:
            $ref: '#/definitions/ApiException'
        401:
          description: 'Unauthorized: authentication error'
          schema:
            $ref: '#/definitions/ApiException'
        403:
          description: 'Forbidden: authorization error'
          schema:
            $ref: '#/definitions/ApiException'
        404:
          description: Not Found
          schema:
            $ref: '#/definitions/ApiException'
        500:
          description: Internal Server Error
          schema:
            $ref: '#/definitions/ApiException'
          
  /claims/vendors/payments/details/{paymentReference}:
    get:
      tags:
      - Query Payments
      summary: Get the Payment details for the specified Vendor and Payment reference.
      description: '<p>The Query Invoice and Payment Status APIs provide the ability for the Provider to see whether invoices for the claim, or secondary interactions, have been accepted and paid.This specific API returns the details of payments related to specified Invoices for the Vendor. </p>'
      operationId: payments/details
      parameters:
      - name: vendorId
        in: query
        description: vendorId
        required: true
        type: string
      - name: paymentReference
        in: path
        description: paymentReference
        required: true
        type: string
      - name: page
        in: query
        description: page
        type: integer
        format: int32
        default: 1
      - name: pageSize
        in: query
        description: pageSize
        type: integer
        format: int32
        default: 25
      responses:
        200:
          description: Success
          schema:
            $ref: '#/definitions/InvoicePaymentAdviceDetailsResponse'
        400:
          description: 'Bad Request: invalid data'
          schema:
            $ref: '#/definitions/ApiException'
        401:
          description: 'Unauthorized: authentication error'
          schema:
            $ref: '#/definitions/ApiException'
        403:
          description: 'Forbidden: authorization error'
          schema:
            $ref: '#/definitions/ApiException'
        404:
          description: Not Found
          schema:
            $ref: '#/definitions/ApiException'
        500:
          description: Internal Server Error
          schema:
            $ref: '#/definitions/ApiException'
        
  /claims/vendors/payments/summary/{paymentReference}:
    get:
      tags:
      - Query Payments
      summary: Get the Payment summary for the specified Vendor and Payment reference.
      description: '<p>The Query Invoice and Payment Status APIs provide the ability for the Provider to see whether invoices for the claim, or secondary interactions, have been accepted and paid.This specific API returns the summary of a Payment for the Vendor and Payment reference.</p>'
      operationId: payments/summary
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: vendorId
        in: query
        description: vendorId
        required: true
        type: string
      - name: paymentReference
        in: path
        description: paymentReference
        required: true
        type: string
      - name: page
        in: query
        description: page
        type: integer
        format: int32
        default: 1
      - name: pageSize
        in: query
        description: pageSize
        type: integer
        format: int32
        default: 25
      responses:
        200:
          description: Success
          schema:
            $ref: '#/definitions/InvoicePaymentAdviceSummaryResponse'
        400:
          description: 'Bad Request: invalid data'
          schema:
            $ref: '#/definitions/ApiException'
        401:
          description: 'Unauthorized: authentication error'
          schema:
                $ref: '#/definitions/ApiException'
        403:
          description: 'Forbidden: authorization error'
          schema:
            $ref: '#/definitions/ApiException'
        404:
          description: Not Found
          schema:
            $ref: '#/definitions/ApiException'
        500:
          description: Internal Server Error
          schema:
            $ref: '#/definitions/ApiException'
        
  /claims/vendors/submissions:
    get:
      tags:
      - Query Invoices
      summary: Get the List of a submitted Vendor Invoices.
      description: '<p>The Query Invoice and Payment Status APIs provide the ability for the Provider to see whether invoices for the claim, or secondary interactions, have been accepted and paid.This specific API returns a list of submitted Vendor Invoices. </p>'
      operationId: invoices/list_of_submissions
      consumes:
      - application/json
      produces:
      - application/json
      parameters:
      - name: vendorId
        in: query
        description: vendorId
        required: true
        type: string
      - name: startDate
        in: query
        description: startDate
        type: string
      - name: endDate
        in: query
        description: endDate
        type: string
      - name: invoiceNumber
        in: query
        description: invoiceNumber
        type: string
      - name: documentReference
        in: query
        description: documentReference
        type: string
      - name: page
        in: query
        description: page
        type: integer
        format: int32
        default: 1
      - name: pageSize
        in: query
        description: pageSize
        type: integer
        format: int32
        default: 25
      responses:
        200:
          description: Success
          schema:
            $ref: '#/definitions/InvoiceSubmissionResponse'
        400:
          description: 'Bad Request: invalid data'
          schema:
            $ref: '#/definitions/ApiException'
        401:
          description: 'Unauthorized: authentication error'
          schema:
            $ref: '#/definitions/ApiException'
        403:
          description: 'Forbidden: authorization error'
          schema:
            $ref: '#/definitions/ApiException'
        404:
          description: Not Found
          schema:
            $ref: '#/definitions/ApiException'
        500:
          description: Internal Server Error
          schema:
            $ref: '#/definitions/ApiException'
       
definitions:
  ApiError:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
  ApiException:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/definitions/ApiError'
  Billing:
      required:
      - billingMethod
      type: object
      properties:
        billingMethod:
          type: string
          enum:
          - time
          - distance
          - units
          - flat fee
        hoursClaimed:
          type: integer
          description: Only required when billingMethod is 'time'. For a date range,
            use separate line items.
          format: int32
        minutesClaimed:
          type: integer
          description: Only required when billingMethod is 'time'. Value 0-59; hours
            or minutes (or both) must be greater than 0.
          format: int32
        travelClaimed:
          type: integer
          description: Only required when billingMethod is 'distance'. Whole kilometres
            from 1 to 100,000.
          format: int32
        unitsClaimed:
          type: number
          description: Only required when billingMethod is 'units' (flat fee). Normally
            a whole number, 2 decimal places allowed.
          format: double
  Declaration:
      required:
      - declarationDate
      type: object
      properties:
        declarationDate:
          type: string
          description: The date the invoice is submitted.
          format: date
  FormError:
      type: object
      properties:
        error_location:
          type: string
        error_message:
          type: string
        error_type:
          type: string
  FormResponseError:
      type: object
      properties:
        formErrors:
          type: array
          items:
            $ref: '#/definitions/FormError'
        xml:
          type: string
  Invoice:
      required:
      - declaration
      - lines
      - pmsSoftwareName
      - pmsSoftwareVersion
      - vendor
      type: object
      properties:
        invoiceId:
          type: string
          description: The schedule (invoice) number must be unique for the vendor
            ID.  It must start with a digit or a letter.  Each remaining
            character, up to 10 in all, can be a letter, digit, space, hyphen, or
            underscore.
        pmsSoftwareName:
          type: string
        pmsSoftwareVersion:
          type: string
        vendor:
          $ref: '#/definitions/Vendor'
        comment:
          type: string
          description: Applies to the whole schedule.
        lines:
          type: array
          description: The ACC contract ID for the service
          items:
            $ref: '#/definitions/LineItem'
        contractId:
          type: string
          description: The ACC contract ID (if there is one) for the service or services.
        declaration:
          $ref: '#/definitions/Declaration'
  InvoiceCreatedResponse:
      type: object
      properties:
        createdAt:
          type: string
          format: date
        invoice:
          $ref: '#/definitions/Invoice'
        invoiceId:
          type: string
        invoiceStatus:
          type: string
        lastUpdate:
          type: string
          format: date
  InvoicePayment:
      type: object
      properties:
        downloadedDate:
          type: string
          format: date
        paymentDate:
          type: string
          format: date
        paymentReference:
          type: string
        totalPaymentAmount:
          type: number
        totalWTaxDeductions:
          type: number
        userId:
          type: string
        vendorId:
          type: string
  InvoicePaymentAdviceDetails:
      type: object
      properties:
        acc45Reference:
          type: string
        accClaimNumber:
          type: string
        amountInvoiced:
          type: number
        amountPaid:
          type: number
        clientName:
          type: string
        facility:
          type: string
        invoiceDate:
          type: string
          format: date
        invoiceNumber:
          type: string
        paymentReference:
          type: string
        paymentType:
          type: string
        providerId:
          type: string
        reason:
          type: string
        serviceCode:
          type: string
        serviceDate:
          type: string
          format: date
        vendorId:
          type: string
        wtDeduction:
          type: number
        wtRate:
          type: number
  InvoicePaymentAdviceDetailsResponse:
      type: object
      properties:
        generatedAt:
          type: string
          format: date
        invoicePaymentAdviceDetailsList:
          type: array
          items:
           $ref: '#/definitions/InvoicePaymentAdviceDetails'
        message:
          type: string
        page:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        totalPages:
          type: integer
          format: int32
  InvoicePaymentAdviceSummary:
      type: object
      properties:
        amountInvoiced:
          type: number
        amountPaid:
          type: number
        bankAccountNumber:
          type: string
        comments:
          type: string
        gstPaid:
          type: number
        invoiceDate:
          type: string
          format: date
        invoiceNumber:
          type: string
        paymentDate:
          type: string
          format: date
        paymentReference:
          type: string
        vendorId:
          type: string
        wtDeduction:
          type: number
  InvoicePaymentAdviceSummaryResponse:
      type: object
      properties:
        generatedAt:
          type: string
          format: date
        invoicePaymentAdviceSummaryList:
          type: array
          items:
            $ref: '#/definitions/InvoicePaymentAdviceSummary'
        message:
          type: string
        page:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        totalPages:
          type: integer
          format: int32
  InvoicePaymentResponse:
      type: object
      properties:
        generatedAt:
          type: string
          format: date
        invoicePaymentList:
          type: array
          items:
            $ref: '#/definitions/InvoicePayment'
        message:
          type: string
        page:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        totalPages:
          type: integer
          format: int32
  InvoiceStatus:
      type: object
      properties:
        claimNumber:
          type: string
        claimedAmount:
          type: number
        comments:
          type: string
        invoiceNumber:
          type: string
        processingStatus:
          type: string
        scheduleId:
          type: number
        submittedOn:
          type: string
          format: date-time
        vendorId:
          type: string
  InvoiceStatusDetails:
      type: object
      properties:
        awarded:
          type: number
        claimNumber:
          type: string
        claimed:
          type: number
        claimedAmount:
          type: number
        compensationDeduction:
          type: number
        compensationTotalAmount:
          type: number
        paymentDate:
          type: string
          format: date-time
        paymentReference:
          type: string
        paymentStatus:
          type: string
        providerId:
          type: string
        scheduleId:
          type: number
        scheduleLineId:
          type: number
        serviceCode:
          type: string
        serviceDate:
          type: string
          format: date-time
        statusReason:
          type: string
        withholdingTax:
          type: number
  InvoiceStatusDetailsResponse:
      type: object
      properties:
        generatedAt:
          type: string
          format: date
        invoiceStatusDetailsList:
          type: array
          items:
            $ref: '#/definitions/InvoiceStatusDetails'
        message:
          type: string
        page:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        totalPages:
          type: integer
          format: int32
  InvoiceStatusResponse:
      type: object
      properties:
        generatedAt:
          type: string
          format: date
        invoiceStatusList:
          type: array
          items:
            $ref: '#/definitions/InvoiceStatus'
        message:
          type: string
        page:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        totalPages:
          type: integer
          format: int32
  InvoiceSubmission:
      type: object
      properties:
        documentReference:
          type: string
        invoiceNumber:
          type: string
        invoicedAmount:
          type: number
        response:
          $ref: '#/definitions/FormResponseError'
        status:
          type: string
        submittedOn:
          type: string
          format: date-time
        vendorId:
          type: string
  InvoiceSubmissionResponse:
      type: object
      properties:
        generatedAt:
          type: string
          format: date
        invoiceSubmissionList:
          type: array
          items:
            $ref: '#/definitions/InvoiceSubmission'
        message:
          type: string
        page:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        totalPages:
          type: integer
          format: int32
  LineDetails:
      required:
      - billing
      - invoiceAmount
      - serviceCodes
      - serviceDate
      type: object
      properties:
        serviceCodes:
          type: array
          description: Enter 1-5 ACC service codes, valid for the given contract ID
            if there is one.
          items:
            type: string
        serviceDate:
          type: string
          description: Date the service took place
          format: date
        purchaseOrderNumber:
          type: string
          description: Enter the purchase order number if relevant (6-10 digits).
        billing:
          $ref: '#/definitions/Billing'
        invoiceComment:
          type: string
          description: Enter any extra details needed, such as tooth numbers for dental
            services.
        invoiceAmount:
          type: number
          description: Amount claimed for this service line.
  LineItem:
      required:
      - claimId
      type: object
      properties:
        claimId:
          type: string
          description: The ACC45 claim number. Letters and numbers only, 1-12 characters.
          example: AB1234567890, 123456789012, VF00455
        accidentDate:
          type: string
          description: ISO8601 complete date format YYYY-MM-DD
          format: date
        lineDetails:
          $ref: '#/definitions/LineDetails'
        patient:
          $ref: '#/definitions/PatientDetails'
        provider:
          $ref: '#/definitions/ProviderDetails'
  PatientDetails:
      required:
      - firstName
      - surname
      type: object
      properties:
        nhi:
          type: string
        dateOfBirth:
          type: string
          format: date
        firstName:
          type: string
        middleName:
          type: string
        surname:
          type: string
  ProviderDetails:
      type: object
      properties:
        providerId:
          type: string
        firstName:
          type: string
        middleName:
          type: string
        surname:
          type: string
        facilityId:
          type: string
          description: ID of the facility where the service was provided; needed for
            some contracts such as elective surgery.
          example: F2C051, 87
  Vendor:
      required:
      - vendorID
      - vendorName
      type: object
      properties:
        vendorName:
          type: string
        vendorGST:
          type: string
          description: GST number, if the vendor is registered for GST.
        vendorID:
          type: string
        vendorPhone:
          type: string
