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

# Get an invoice

> One invoice by id, a voided one included, with every one of its lines. An invoice of another entity is not found. Needs a key holding `invoices:read`.



## OpenAPI

````yaml https://app.synthetic.ai/api/v1/openapi.json get /invoices/{id}
openapi: 3.1.0
info:
  title: Synthetic API
  description: Read access to your Synthetic data.
  version: 0.1.0
servers:
  - url: https://app.synthetic.ai/api/v1
security: []
paths:
  /invoices/{id}:
    get:
      tags:
        - Invoices
      summary: Get an invoice
      description: >-
        One invoice by id, a voided one included, with every one of its lines.
        An invoice of another entity is not found. Needs a key holding
        `invoices:read`.
      operationId: invoices-get
      parameters:
        - in: path
          name: id
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            description: The invoice id.
          required: true
          description: The invoice id.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
        '400':
          description: Input validation failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '404':
          description: The record does not exist for your business.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.NOT_FOUND'
        '500':
          description: An unexpected error occurred.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
      security:
        - BearerAuth: []
components:
  schemas:
    Invoice:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        customerId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        customerName:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            The customer's name on the invoice. Issuing copies it onto the
            invoice, so renaming the customer later leaves an issued invoice as
            it was; until then it is the customer's current name.
        contractId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        number:
          type: string
          description: >-
            The invoice number, unique among the entity's invoices, voided ones
            included. It can change up to the moment the invoice is issued, and
            not after.
        status:
          type: string
          enum:
            - DRAFT
            - APPROVED
            - ISSUING
            - ISSUED
            - VOIDED
          description: >-
            DRAFT: not approved yet. APPROVED: approved before periodStartAt,
            the day Synthetic will issue it. ISSUING: being issued; it becomes
            ISSUED shortly. ISSUED: issued; what it charges no longer changes.
            VOIDED: withdrawn before it was issued; nothing is owed on it. Until
            an invoice is issued, Synthetic may change or void it when the
            contract's terms change. Whether it has been paid is not a status:
            compare appliedAmount with totalAmount.
        notes:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            A note for the entity's own staff. It is never printed on the
            invoice, and can change until the invoice is issued.
        approvedByUserId:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            - type: 'null'
          description: >-
            The id of the person who approved the invoice, if a person did;
            otherwise null.
        approvedByUser:
          anyOf:
            - type: object
              properties:
                id:
                  type: string
                  format: uuid
                  pattern: >-
                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                email:
                  type: string
                firstName:
                  type: string
                  description: >-
                    The person's first name, or their email when their identity
                    provider has no name for them.
                lastName:
                  anyOf:
                    - type: string
                    - type: 'null'
                role:
                  type: string
                  enum:
                    - ADMIN
                    - MEMBER
                  description: The person's role in the entity.
              required:
                - id
                - email
                - firstName
                - lastName
                - role
              additionalProperties: false
            - type: 'null'
          description: >-
            The person who approved the invoice, if a person did; otherwise
            null. Their role is their current one, not the one they had when
            they approved.
        approvedByApiKeyId:
          anyOf:
            - type: string
              format: uuid
              pattern: >-
                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
            - type: 'null'
          description: The API key that approved the invoice, if one did; otherwise null.
        approvedAt:
          anyOf:
            - type: string
            - type: 'null'
          description: When the invoice was approved; null when it has not been.
        issuedAt:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            When the invoice was issued; null until it is. An invoice issued
            backdated carries the earlier date it was issued with, and has it
            already while ISSUING. An invoice not issued yet is planned to issue
            on periodStartAt.
        dueAt:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            When payment is due: issuedAt plus paymentTermsDays days. Null while
            issuedAt is.
        paymentTermsDays:
          anyOf:
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
          description: >-
            How many days the customer has to pay once the invoice is issued,
            from the contract terms the invoice bills.
        lastPaidAt:
          anyOf:
            - type: string
            - type: 'null'
          format: date-time
          description: >-
            The calendar date the latest payment with status POSTED applied to
            this invoice was received, carried at UTC midnight; null when none
            has been applied. The time is not data.
        paidAt:
          anyOf:
            - type: string
            - type: 'null'
          format: date-time
          description: >-
            Once payments with status POSTED cover totalAmount, the calendar
            date the latest of them was received, carried at UTC midnight; null
            while anything is owed or no payment has been applied. The time is
            not data.
        voidedAt:
          anyOf:
            - type: string
            - type: 'null'
          description: When the invoice was voided; null unless its status is VOIDED.
        periodStartAt:
          format: date-time
          description: >-
            The first calendar day the invoice bills for, carried at UTC
            midnight. The time is not data.
          type: string
        periodEndAt:
          format: date-time
          description: >-
            The calendar date the billed period ends, carried at UTC midnight:
            it covers the days before this date, not the date itself. The time
            is not data.
          type: string
        lastSentAt:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            When Synthetic last started emailing the invoice to the customer,
            whether or not the email went out; null if it never has.
        deliveryMethod:
          anyOf:
            - type: string
              enum:
                - EMAIL
                - MANUAL
            - type: 'null'
          description: >-
            How the invoice reaches the customer. EMAIL: Synthetic emails it
            when it is issued. MANUAL: the entity sends it itself. The person
            who approves the invoice chooses; an invoice Synthetic issues on its
            own, under a contract with autoIssue on, is EMAIL. Null when no
            delivery method was recorded, such as an invoice that is not
            approved yet or one issued with a backdated date; Synthetic does not
            email those.
        totalAmount:
          type: object
          properties:
            value:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            currencyCode:
              type: string
              enum:
                - USD
                - CAD
                - EUR
                - USDC
          required:
            - value
            - currencyCode
          additionalProperties: false
          description: >-
            The sum of the invoice's lines. Its value is a whole number of the
            currency's smallest unit, so { "value": 200000, "currencyCode":
            "USD" } is $2,000.00.
        appliedAmount:
          type: object
          properties:
            value:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            currencyCode:
              type: string
              enum:
                - USD
                - CAD
                - EUR
                - USDC
          required:
            - value
            - currencyCode
          additionalProperties: false
          description: >-
            How much of the total payments with status POSTED have paid, a bank
            fee charged on one of them included.
        pendingPaymentAmount:
          type: object
          properties:
            value:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            currencyCode:
              type: string
              enum:
                - USD
                - CAD
                - EUR
                - USDC
          required:
            - value
            - currencyCode
          additionalProperties: false
          description: >-
            How much of the total card payments with status PENDING will pay
            once their money arrives. It is not part of appliedAmount.
        remainingAmount:
          type: object
          properties:
            value:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            currencyCode:
              type: string
              enum:
                - USD
                - CAD
                - EUR
                - USDC
          required:
            - value
            - currencyCode
          additionalProperties: false
          description: >-
            totalAmount less appliedAmount and pendingPaymentAmount. Payments
            apply only to issued invoices, so it equals totalAmount until then,
            and stays equal to it on a voided invoice, though nothing is owed on
            one.
        lines:
          anyOf:
            - type: array
              items:
                $ref: '#/components/schemas/InvoiceLineItem'
            - type: 'null'
          description: Every line of the invoice when it is read by id; null in a list.
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - customerId
        - customerName
        - contractId
        - number
        - status
        - notes
        - approvedByUserId
        - approvedByUser
        - approvedByApiKeyId
        - approvedAt
        - issuedAt
        - dueAt
        - paymentTermsDays
        - lastPaidAt
        - paidAt
        - voidedAt
        - periodStartAt
        - periodEndAt
        - lastSentAt
        - deliveryMethod
        - totalAmount
        - appliedAmount
        - pendingPaymentAmount
        - remainingAmount
        - lines
        - createdAt
        - updatedAt
      additionalProperties: false
      description: >-
        A bill the entity raises for a customer for one period of a contract:
        what it charges, how far it has got towards being issued, and how much
        of it has been paid.
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Input validation failed
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Input validation failed error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Input validation failed
        issues: []
    error.UNAUTHORIZED:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Unauthorized
        code:
          type: string
          description: The error code
          example: UNAUTHORIZED
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: Unauthorized error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Unauthorized
        issues: []
    error.NOT_FOUND:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: The record does not exist for your business.
        code:
          type: string
          description: The error code
          example: NOT_FOUND
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: The record does not exist for your business. error (404)
      description: The error information
      example:
        code: NOT_FOUND
        message: The record does not exist for your business.
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: An unexpected error occurred.
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          description: An array of issues that were responsible for the error
          example: []
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
            additionalProperties: false
      required:
        - message
        - code
      additionalProperties: false
      title: An unexpected error occurred. error (500)
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: An unexpected error occurred.
        issues: []
    InvoiceLineItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        invoiceId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        contractBillableId:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: The billable on the contract that this line charges for.
        description:
          type: string
          description: >-
            The line's own description, or its billable's current description
            when it has none.
        billingStartAt:
          format: date-time
          description: >-
            The first calendar day this line bills for, carried at UTC midnight.
            The time is not data.
          type: string
        billingEndAt:
          format: date-time
          description: >-
            The calendar date this line's billing ends, carried at UTC midnight:
            it covers the days before this date, not the date itself. The time
            is not data.
          type: string
        amount:
          type: object
          properties:
            value:
              type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            currencyCode:
              type: string
              enum:
                - USD
                - CAD
                - EUR
                - USDC
          required:
            - value
            - currencyCode
          additionalProperties: false
          description: >-
            What this line charges. Its value is a whole number of the
            currency's smallest unit.
        createdAt:
          type: string
        updatedAt:
          type: string
      required:
        - id
        - invoiceId
        - contractBillableId
        - description
        - billingStartAt
        - billingEndAt
        - amount
        - createdAt
        - updatedAt
      additionalProperties: false
      description: >-
        One charge on an invoice: what it is for, the days it covers and its
        amount.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'An API key created in Settings, sent as `Authorization: Bearer <key>`.'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.