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

# Get Invoice

> Get a Invoice by id.



## OpenAPI

````yaml get /invoices/{invoiceId}
openapi: 3.0.0
info:
  title: Vayu API
  version: 1.0.0
  description: >-
    The Vayu API is a RESTful API that allows you to submit events for
    processing and storage & manage billing related entities.
              The API is secured using the Bearer Authentication scheme with JWT tokens.
              To obtain a JWT token, please contact Vayu at team@withvayu.com
  contact:
    email: dev@withvayu.com
    name: Vayu, Inc
    url: https://withvayu.com
servers:
  - url: https://connect.withvayu.com
    description: Production server
  - url: https://staging-connect.withvayu.com
    description: Sandbox server
security: []
tags:
  - name: auth
    description: >-
      The auth tag is used for endpoints related to authentication and
      authorization.
  - name: events
    description: The events tag is used for endpoints related to event ingestion.
  - name: customers
    description: The customers tag is used for endpoints related to customer management.
  - name: meters
    description: The meters tag is used for endpoints related to meter management.
  - name: contracts
    description: The contracts tag is used for endpoints related to contract management.
  - name: invoices
    description: The invoices tag is used for endpoints related to invoice management.
  - name: credits
    description: The credits tag is used for endpoints related to credit management.
  - name: webhooks
    description: The webhooks tag is used for endpoints related to webhook management.
paths:
  /invoices/{invoiceId}:
    get:
      tags:
        - invoices
      summary: Get Invoice
      description: Get a Invoice by id.
      operationId: getInvoice
      parameters:
        - schema:
            $ref: '#/components/schemas/InvoiceId'
          required: true
          in: path
          name: invoiceId
      responses:
        '200':
          $ref: '#/components/responses/GetInvoiceResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitErrorResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - BearerAuthorizer: []
components:
  schemas:
    InvoiceId:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
    ValidationErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
        code:
          type: string
          description: Specific machine-readable error code
        message:
          type: string
          description: Human-readable error explanation
        param:
          type: string
          description: Single parameter that failed validation
        params:
          type: array
          items:
            type: object
            properties:
              param:
                type: string
                description: The parameter that failed validation
              message:
                type: string
                description: Why validation failed for this parameter
            required:
              - param
              - message
          description: Multiple parameters that failed validation
      required:
        - type
        - code
        - message
    UnauthorizedErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - authentication_error
        code:
          type: string
          enum:
            - authentication_failed
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    NotFoundErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - invalid_request_error
        code:
          type: string
          enum:
            - resource_not_found
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    RateLimitErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - rate_limit_error
        code:
          type: string
          enum:
            - rate_limit_exceeded
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    InternalServerErrorResponse:
      type: object
      properties:
        type:
          type: string
          enum:
            - api_error
        code:
          type: string
          enum:
            - internal_error
        message:
          type: string
          description: Human-readable error explanation
      required:
        - type
        - code
        - message
    GetInvoiceResponse:
      type: object
      properties:
        invoice:
          type: object
          properties:
            customerId:
              type: string
              pattern: ^[0-9a-fA-F]{24}$
              description: The id of the customer that the invoice is associated with
            contractId:
              type: string
              pattern: ^[0-9a-fA-F]{24}$
              description: The id of the contract that the invoice is associated with
            name:
              type: string
              minLength: 1
              description: >-
                The name of the invoice, usually a description of the billing
                period
            billingCycle:
              $ref: '#/components/schemas/FullDayPeriod'
            revenueBreakdown:
              type: object
              properties:
                total:
                  type: number
                subtotal:
                  type: number
                overage:
                  type: number
                discount:
                  type: number
                creditsUsed:
                  type: number
                tax:
                  type: number
              required:
                - total
                - subtotal
                - overage
                - discount
                - creditsUsed
                - tax
              description: The breakdown of the revenue for the invoice
            billingStatus:
              $ref: '#/components/schemas/InvoiceBillingStatus'
            paymentInfo:
              $ref: '#/components/schemas/PaymentInfo'
            dueDate:
              type: string
              nullable: true
              description: The due date of the invoice
              format: date-time
            accountId:
              type: string
              description: The id of the account that the invoice is associated with
            lineItems:
              type: array
              items:
                $ref: '#/components/schemas/LineItem'
            amount:
              type: number
              description: The total amount of the invoice
            id:
              type: string
            createdAt:
              type: string
              format: date-time
            updatedAt:
              type: string
              format: date-time
          required:
            - customerId
            - name
            - billingCycle
            - revenueBreakdown
            - billingStatus
            - dueDate
            - accountId
            - lineItems
            - amount
            - id
            - createdAt
            - updatedAt
      required:
        - invoice
    FullDayPeriod:
      type: object
      properties:
        startTime:
          type: string
          format: date-time
        endTime:
          type: string
          format: date-time
      required:
        - startTime
        - endTime
      description: The billing cycle of the invoice, consists of a start and end date
    InvoiceBillingStatus:
      type: string
      enum:
        - None
        - Paid
        - Rejected
        - PendingPayment
        - Overdue
      description: The billing status of the invoice
    PaymentInfo:
      type: object
      properties:
        transactionId:
          type: string
        date:
          type: string
          format: date-time
        paymentMethod:
          type: string
        paymentMethodId:
          type: string
        amount:
          type: number
          minimum: 0
          exclusiveMinimum: true
        currency:
          $ref: '#/components/schemas/Currency'
        status:
          type: string
        note:
          type: string
        customerId:
          type: string
        depositTo:
          type: object
          properties:
            id:
              type: string
            name:
              type: string
          required:
            - name
      description: The payment information of the invoice
    LineItem:
      type: object
      properties:
        invoiceId:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the invoice that the line item is a part of
        revenueBreakdown:
          type: object
          properties:
            total:
              type: number
            subtotal:
              type: number
            overage:
              type: number
            discount:
              type: number
            creditsUsed:
              type: number
            tax:
              type: number
          required:
            - total
            - subtotal
            - overage
            - discount
            - creditsUsed
            - tax
          description: The revenue breakdown of the line item
      required:
        - invoiceId
        - revenueBreakdown
    Currency:
      type: string
      nullable: true
      enum:
        - USD
        - EUR
        - GBP
        - ILS
        - CAD
        - AUD
        - COP
        - BRL
      description: The billing currency of the customer
  responses:
    GetInvoiceResponse:
      description: RequestSuccess
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GetInvoiceResponse'
  securitySchemes:
    BearerAuthorizer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````