> ## 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 a link to an invoice preview's PDF

> A link to download one invoice a change would bill, as a PDF. It looks like an invoice, with PREVIEW in place of its number and a note that nothing has been billed. Send exactly one of these in the body, with the invoice's `scheduledIssueAt`:

- `contractId`: an invoice the contract will bill once its draft amendment is agreed, addressed to the contract's customer.
- `terms`: an invoice that terms would bill before they are saved, addressed to the customer in `terms.customerId`.
- `cancellation`: the invoice that would still be billed if the contract were cancelled from `cancelAt`, addressed to the contract's customer.

A date on which no invoice would be issued, or a customer of another entity, is not found. Needs a key holding `contracts:read` and `invoices:read`.



## OpenAPI

````yaml https://app.synthetic.ai/api/v1/openapi.json query /invoice-previews/pdf
openapi: 3.2.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:
  /invoice-previews/pdf:
    query:
      tags:
        - Contracts
      summary: Get a link to an invoice preview's PDF
      description: >-
        A link to download one invoice a change would bill, as a PDF. It looks
        like an invoice, with PREVIEW in place of its number and a note that
        nothing has been billed. Send exactly one of these in the body, with the
        invoice's `scheduledIssueAt`:


        - `contractId`: an invoice the contract will bill once its draft
        amendment is agreed, addressed to the contract's customer.

        - `terms`: an invoice that terms would bill before they are saved,
        addressed to the customer in `terms.customerId`.

        - `cancellation`: the invoice that would still be billed if the contract
        were cancelled from `cancelAt`, addressed to the contract's customer.


        A date on which no invoice would be issued, or a customer of another
        entity, is not found. Needs a key holding `contracts:read` and
        `invoices:read`.
      operationId: invoices-preview-downloadPdf
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                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)$
                  description: The contract whose draft amendment to preview.
                terms:
                  type: object
                  properties:
                    startAt:
                      format: date-time
                      description: >-
                        The first day the terms cover. Only the date is used;
                        send it as midnight UTC.
                      type: string
                    endAt:
                      format: date-time
                      description: >-
                        The day the terms end. They cover the days before this
                        date, not the date itself. Only the date is used; send
                        it as midnight UTC.
                      type: string
                    paymentTermsDays:
                      type: integer
                      minimum: 0
                      maximum: 9007199254740991
                      description: >-
                        How many days the customer has to pay each invoice.
                        Leave it out for 0, which makes payment due the day the
                        invoice is issued.
                    lineItems:
                      type: array
                      items:
                        type: object
                        properties:
                          description:
                            type: string
                            description: What the line item says on each invoice.
                          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 the line item charges each time it bills. Its
                              value is a whole number of the currency's smallest
                              unit, such as cents.
                          cadence:
                            anyOf:
                              - type: string
                                enum:
                                  - MONTHLY
                                  - QUARTERLY
                                  - SEMI_ANNUAL
                                  - ANNUAL
                              - type: 'null'
                            description: >-
                              How often the line item bills; null for a one-time
                              charge.
                          billingTiming:
                            type: string
                            enum:
                              - IN_ADVANCE
                              - IN_ARREARS
                            description: >-
                              When a line item with a cadence bills for each
                              period: IN_ADVANCE on the invoice dated the day
                              the period starts, IN_ARREARS on the invoice dated
                              the day it ends. Leave it out for IN_ADVANCE, and
                              for a one-time charge.
                        required:
                          - description
                          - amount
                          - cadence
                        additionalProperties: false
                      description: >-
                        What the terms charge for. Every line item must be in
                        the same currency.
                    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)$
                      description: The customer the terms would bill.
                  required:
                    - customerId
                  additionalProperties: false
                  description: >-
                    Contract terms to preview without saving them, and the
                    customer they would bill.
                cancellation:
                  type: object
                  properties:
                    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)$
                      description: The contract to cancel.
                    cancelAt:
                      format: date-time
                      description: >-
                        The day the cancellation would end the contract. Only
                        the date is used; send it as midnight UTC.
                      type: string
                  required:
                    - contractId
                    - cancelAt
                  additionalProperties: false
                  description: >-
                    A cancellation to preview without agreeing it: the contract,
                    and the day it would end.
                scheduledIssueAt:
                  format: date-time
                  description: >-
                    The day the invoice would be issued. Only the date is used;
                    send it as midnight UTC.
                  type: string
              required:
                - scheduledIssueAt
              additionalProperties: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  downloadUrl:
                    type: string
                    description: >-
                      A link to the file. It works for one hour after this
                      response, and anyone holding it can download the file. Do
                      not send your API key with it: the link points at
                      Synthetic's file storage, not the API. For a new link,
                      call the route again.
                required:
                  - downloadUrl
                additionalProperties: false
        '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:
    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: []
  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.