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

# Accept Invoices



## OpenAPI

````yaml post /api/v1/invoices
openapi: 3.1.0
info:
  title: Nest Data Pipeline - Webhooks
  version: 0.3.0
servers:
  - url: https://webhooks.nest.vet
security: []
paths:
  /api/v1/invoices:
    post:
      tags:
        - invoices
      summary: Accept Invoices
      operationId: accept_invoices_api_v1_invoices_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            description: >-
              Unique key for this webhook delivery used to deduplicate
              scheduling. Recommended to use a UUID. Maximum length 36
              characters.
            title: Idempotency-Key
          description: >-
            Unique key for this webhook delivery used to deduplicate scheduling.
            Recommended to use a UUID. Maximum length 36 characters.
        - name: X-Organization-Id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Identifier of the organization/tenant that owns the invoices. Used
              for routing, logging, and idempotent task naming.
            title: X-Organization-Id
          description: >-
            Identifier of the organization/tenant that owns the invoices. Used
            for routing, logging, and idempotent task naming.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebhookInvoicesRequest'
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebhookInvoicesResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    WebhookInvoicesRequest:
      properties:
        invoices:
          items:
            $ref: '#/components/schemas/WebhookInvoice'
          type: array
          title: Invoices
          description: >-
            List of invoice payloads to process. A single request may contain up
            to 100 invoices; larger payloads will be rejected.
      type: object
      title: WebhookInvoicesRequest
    WebhookInvoicesResponse:
      properties:
        status:
          type: string
          enum:
            - scheduled
            - duplicate
            - completed
            - error
          title: Status
          description: >-
            Scheduling outcome for this webhook: 'scheduled' when a new Task is
            enqueued, 'duplicate' when a task already exists for the same
            Idempotency-Key, 'completed' (reserved for future use and not
            currently emitted), or 'error' when Cloud Tasks rejected the
            request.
        task_id:
          type: string
          title: Task Id
          description: >-
            Deterministic Tasks identifier derived from organization and
            Idempotency-Key.
        scheduled_for:
          type: string
          format: date-time
          title: Scheduled For
          description: UTC timestamp when the Task is scheduled to run.
        idempotency_key:
          type: string
          maxLength: 36
          minLength: 1
          title: Idempotency Key
          description: >-
            Opaque key supplied by the caller to deduplicate webhook deliveries
            (max 36 chars).
        invoices_count:
          type: integer
          title: Invoices Count
          description: Number of invoices accepted from the request payload.
        received_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Received At
          description: UTC timestamp when the webhook was received by the service.
      type: object
      required:
        - status
        - task_id
        - scheduled_for
        - idempotency_key
        - invoices_count
      title: WebhookInvoicesResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WebhookInvoice:
      properties:
        invoice_id:
          type: string
          title: Invoice Id
          description: Stable identifier for the invoice in the source system.
        invoice_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Invoice Code
          description: Human-readable invoice number or code.
        created_date:
          type: string
          format: date-time
          title: Created Date
          description: When the invoice was created (UTC).
        due_date:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Due Date
          description: When payment for the invoice is due (UTC).
        last_modified:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Modified
          description: When the invoice was last updated in the source (UTC).
        subtotal:
          type: number
          title: Subtotal
          description: Subtotal amount for the invoice, excluding tax.
        tax:
          type: number
          title: Tax
          description: Total tax amount for the invoice.
        deleted:
          type: boolean
          title: Deleted
          description: True if the invoice has been deleted in the source.
          default: false
        clinic_id:
          type: string
          title: Clinic Id
          description: Identifier for the clinic/location associated with the invoice.
        client_id:
          type: string
          title: Client Id
          description: Identifier for the client/customer associated with the invoice.
        team_member_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Team Member Id
          description: Optional staff or provider identifier associated with the invoice.
        invoice_lines:
          items:
            $ref: '#/components/schemas/WebhookInvoiceLine'
          type: array
          title: Invoice Lines
          description: Collection of line items included in this invoice.
      type: object
      required:
        - invoice_id
        - created_date
        - subtotal
        - tax
        - clinic_id
        - client_id
      title: WebhookInvoice
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    WebhookInvoiceLine:
      properties:
        invoice_line_id:
          type: string
          title: Invoice Line Id
          description: Stable identifier for the invoice line in the source system.
        invoice_line_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Invoice Line Code
          description: Optional human-friendly code or external reference for the line.
        date:
          type: string
          format: date-time
          title: Date
          description: Timestamp associated with the line item (e.g., service date).
        last_modified:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Modified
          description: When this line was last updated in the source.
        product_name:
          type: string
          title: Product Name
          description: Display name of the product or service.
        product_id:
          type: string
          title: Product Id
          description: Stable product identifier from the source system.
        product_code:
          type: string
          title: Product Code
          description: SKU or product code from the source system.
        quantity:
          anyOf:
            - type: number
            - type: 'null'
          title: Quantity
          description: Quantity for this line item.
        total:
          type: number
          title: Total
          description: Total monetary amount for this line item, excluding taxes.
        total_tax:
          type: number
          title: Total Tax
          description: Tax amount attributed to this line item.
        standard_price:
          anyOf:
            - type: number
            - type: 'null'
          title: Standard Price
          description: Base unit price for the product/service before taxes.
        patient_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Patient Id
          description: Patient identifier associated with the line.
        team_member_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Team Member Id
          description: Staff or provider identifier responsible for the line.
        is_payment:
          type: boolean
          title: Is Payment
          description: True if this line represents a payment or charge.
          default: false
        deleted:
          type: boolean
          title: Deleted
          description: True if this line has been deleted in the source.
          default: false
        finalized:
          type: boolean
          title: Finalized
          description: True if the line belongs to an invoice that has been finalized.
          default: true
        voided:
          type: boolean
          title: Voided
          description: True if this line item has been voided.
          default: false
        voided_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Voided At
          description: Timestamp when the line item was voided (if applicable).
        tip:
          type: number
          title: Tip
          description: Tip amount associated with this line item (if applicable).
          default: 0
      type: object
      required:
        - invoice_line_id
        - date
        - product_name
        - product_id
        - product_code
        - quantity
        - total
        - total_tax
        - standard_price
      title: WebhookInvoiceLine

````