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

# Preview an invoice

> Render an invoice's PDF or email preview as an HTML string, or its SMS preview as a plain-text string.



## OpenAPI

````yaml https://dev.tight.com/v3/api-docs post /v6/invoicing/invoices/preview
openapi: 3.0.1
info:
  title: Tight API
  contact:
    name: Hurdlr, Inc. (dba Tight)
    url: https://www.tight.com
    email: api@tight.com
  version: 6.0.0
servers:
  - url: https://sandbox.tight.com
    description: Staging Environment
  - url: https://prod.tight.com
    description: Production Environment
security:
  - EmbedToken: []
paths:
  /v6/invoicing/invoices/preview:
    post:
      tags:
        - Invoicing - Invoices
      summary: Preview an invoice
      description: >-
        Render an invoice's PDF or email preview as an HTML string, or its SMS
        preview as a plain-text string.
      operationId: previewInvoice
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoicePreviewGetDto'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponseString'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: REQUIRED
                    message: Amount is required
                    param: amount
        '401':
          description: Not authenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: INVALID_TOKEN
                    message: Invalid access token
        '403':
          description: Not authorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: FORBIDDEN
                    message: Expired access token
        '404':
          description: Endpoint not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: BAD_REQUEST
                    message: Resource not found
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                result: FAILURE
                error:
                  - type: UNKNOWN_ERROR
                    message: Something went wrong. Please try again later.
      security:
        - EmbedToken: []
components:
  schemas:
    InvoicePreviewGetDto:
      required:
        - lineItems
        - previewType
      type: object
      properties:
        previewType:
          type: string
          description: Which rendering of the invoice to return
          example: INVOICE
          enum:
            - INVOICE
            - EMAIL
            - SMS
        invoiceNumber:
          type: string
          description: The invoice number; auto-derived when omitted
          example: HAR-1
        date:
          type: string
          description: The invoice date; defaults to today
          format: date
          example: '2025-07-26'
        term:
          $ref: '#/components/schemas/InvoiceTermPostDto'
        discount:
          $ref: '#/components/schemas/DiscountPostDto'
        deposit:
          $ref: '#/components/schemas/DepositPostDto'
        paymentMethods:
          type: array
          description: Payment methods accepted for the invoice
          items:
            type: string
            description: Payment methods accepted for the invoice
            enum:
              - CREDIT
              - ACH
              - DIRECT
        notes:
          type: string
          description: Notes for the invoice
        lineItems:
          minItems: 1
          type: array
          description: The invoice's line items
          items:
            $ref: '#/components/schemas/InvoicePreviewLineItemGetDto'
        customer:
          $ref: '#/components/schemas/InvoicePreviewCustomerGetDto'
        attachments:
          type: array
          description: Attachments included on the invoice
          items:
            $ref: '#/components/schemas/InvoicePreviewAttachmentGetDto'
        installments:
          type: array
          description: Installments for the invoice
          items:
            $ref: '#/components/schemas/InvoicePreviewInstallmentGetDto'
        dimensionValueIds:
          type: array
          description: Dimension values assigned to the invoice
          items:
            type: string
            description: Dimension values assigned to the invoice
    SuccessResponseString:
      type: object
      properties:
        result:
          type: string
          description: The result of the action performed.
          enum:
            - SUCCESS
            - FAILURE
        data:
          type: string
          description: The data generated by the action performed.
    ErrorResponse:
      type: object
      properties:
        result:
          type: string
          description: The result of the action performed.
          enum:
            - SUCCESS
            - FAILURE
        data:
          type: object
          description: The data generated by the action performed.
          nullable: true
        error:
          type: array
          items:
            $ref: '#/components/schemas/ErrorItem'
    InvoiceTermPostDto:
      type: object
      properties:
        type:
          type: string
          description: The payment term type
          example: NET_30
          enum:
            - DUE_NOW
            - NET_10
            - NET_15
            - NET_30
            - NET_60
            - OTHER
        dueDate:
          type: string
          description: The due date for payment
          format: date
          example: '2025-07-26'
      description: Payment term for the invoice
      nullable: false
    DiscountPostDto:
      required:
        - type
        - value
      type: object
      properties:
        value:
          type: number
          description: The discount value
          example: 5
        type:
          type: string
          description: The type of the discount value
          example: PERCENT
          enum:
            - AMOUNT
            - PERCENT
        calculateBeforeSalesTax:
          type: boolean
          description: Whether to calculate the discount before sales tax
          example: true
      description: Discount applied to the invoice
      nullable: false
    DepositPostDto:
      required:
        - type
        - value
      type: object
      properties:
        value:
          type: number
          description: The deposit value
          example: 50
        type:
          type: string
          description: The type of the deposit value
          example: PERCENT
          enum:
            - AMOUNT
            - PERCENT
      description: Deposit required for the invoice
      nullable: false
    InvoicePreviewLineItemGetDto:
      type: object
      properties:
        description:
          type: string
          description: Description of the line item
          example: Consulting services
        quantity:
          type: number
          description: Quantity of the line item
          example: 2
        rate:
          type: integer
          description: Rate of the line item (in cents)
          format: int32
          example: 5000
        salesTax:
          $ref: '#/components/schemas/SalesTaxPostDto'
        expenseId:
          type: string
          description: Id of the expense billed by this line item
          example: btxn_28868401
        timeId:
          type: string
          description: Id of the time entry billed by this line item
          example: tme_28868401
      description: The invoice's line items
    InvoicePreviewCustomerGetDto:
      required:
        - id
      type: object
      properties:
        id:
          minLength: 1
          type: string
          description: The id of the customer
          example: cus_28868401
        email:
          type: string
          description: Email to show for the customer
          example: client@example.com
        phoneWork:
          type: string
          description: Work phone to show for the customer
          example: 555-123-4567
      description: The customer being billed
    InvoicePreviewAttachmentGetDto:
      required:
        - publicFileUrl
      type: object
      properties:
        publicFileUrl:
          minLength: 1
          type: string
          description: Public URL of the attachment file
          example: https://example.com/files/receipt.pdf
        caption:
          type: string
          description: Caption for the attachment
          example: Receipt
      description: Attachments included on the invoice
    InvoicePreviewInstallmentGetDto:
      required:
        - dueDate
        - type
        - value
      type: object
      properties:
        dueDate:
          type: string
          description: The due date for this installment
          format: date
          example: '2025-08-26'
        type:
          type: string
          description: The type of the installment value
          example: PERCENT
          enum:
            - AMOUNT
            - PERCENT
        value:
          type: number
          description: The installment value
          example: 5000
      description: Installments for the invoice
    ErrorItem:
      type: object
      properties:
        type:
          type: string
          description: The type of the error. Safe for programmatic use.
          enum:
            - UNKNOWN_ERROR
            - INVALID_TOKEN
            - EXPIRED_TOKEN
            - FORBIDDEN
            - BAD_REQUEST
            - CONFLICT
            - JSON_ERROR
            - DUPLICATE
            - REQUIRED
            - INVALID_VALUE
            - NOT_MODIFIABLE
            - INVALID_FORMAT
            - NOT_FOUND
        message:
          type: string
          description: >-
            A human-readable message providing more details about the error.
            Safe for displaying to a user.
        param:
          type: string
          description: >-
            If the error is parameter-specific, the parameter related to the
            error. This can be used to display a message near the correct form
            field.
      description: Errors associated with the action performed, if applicable.
    SalesTaxPostDto:
      required:
        - type
        - value
      type: object
      properties:
        value:
          type: number
          description: The sales tax value
          example: 8.875
        type:
          type: string
          description: The type of the sales tax value
          example: PERCENT
          enum:
            - AMOUNT
            - PERCENT
      description: Sales tax applied to the invoice item template
      nullable: false
  securitySchemes:
    EmbedToken:
      type: http
      description: >-
        Bearer authentication header of the form `Bearer <token>`, see
        [Authentication for more
        detail](/api-reference/authentication#partner-level-authentication).
      scheme: bearer

````

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