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

# Issue an invoice

> Issues a scheduled invoice now, ahead of its billing date. The invoice is calculated, final tax is committed, its date of issue is today, and autopay charges it as it would on its billing date. The billing date itself does not change.

Set `send_invoice` to send the customer's usual invoice notifications, as on the billing date (a customer autopay can charge is not emailed the invoice); when false no notifications are sent.

`due_date_basis` is optional — omit it and the invoice keeps its own basis. Send `CUSTOM` with a `due_at` to name the due date outright; either one without the other is rejected.

Only a scheduled invoice can be issued. The request is refused with a `400` when invoice review would draft the invoice, when billing is turned off for the subscription (it has no billing start date), when it bills a period before the subscription's billing start date, when the subscription was imported and hasn't reached its billing start cutover, when it bills usage for a period that hasn't ended, and when it has nothing to bill.



## OpenAPI

````yaml https://api.salesbricks.com/api/v2/openapi.yaml post /invoices/{invoice_id}/issue
openapi: 3.0.3
info:
  title: Salesbricks REST API
  version: 2.0.0
  description: API reference for external integrations
servers:
  - url: https://api.salesbricks.com/api/v2
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Subscriptions
    description: >-
      Operations related to subscription management, including creation,
      updates, and retrieving subscription details. Subscriptions can be
      upgraded to add / remove add-ons by using the POST
      /subscriptions/{subscription_id}/upgrade endpoint and can be recasted for
      replacing the current agreement using the POST
      /subscriptions/{subscription_id}/recast endpoint
  - name: Subscription Milestones
    description: >-
      Operations for listing and completing milestone bricks — bricks billed
      when the work they cover is delivered rather than on the subscription's
      schedule. Completing one either raises a standalone invoice immediately or
      bills on the subscription's next scheduled invoice.
  - name: Customers
    description: >-
      Operations related to customer management, including creation, updates,
      and managing customer person objects.
  - name: Invoices
    description: Operations related to subscription's invoicing details.
  - name: Plans
    description: >-
      Operations related to listing and getting plan details including bricks in
      the plan.
  - name: Payment Methods
    description: Operations related to subscription's payment method.
paths:
  /invoices/{invoice_id}/issue:
    post:
      tags:
        - Invoices
      summary: Issue an invoice
      description: >-
        Issues a scheduled invoice now, ahead of its billing date. The invoice
        is calculated, final tax is committed, its date of issue is today, and
        autopay charges it as it would on its billing date. The billing date
        itself does not change.


        Set `send_invoice` to send the customer's usual invoice notifications,
        as on the billing date (a customer autopay can charge is not emailed the
        invoice); when false no notifications are sent.


        `due_date_basis` is optional — omit it and the invoice keeps its own
        basis. Send `CUSTOM` with a `due_at` to name the due date outright;
        either one without the other is rejected.


        Only a scheduled invoice can be issued. The request is refused with a
        `400` when invoice review would draft the invoice, when billing is
        turned off for the subscription (it has no billing start date), when it
        bills a period before the subscription's billing start date, when the
        subscription was imported and hasn't reached its billing start cutover,
        when it bills usage for a period that hasn't ended, and when it has
        nothing to bill.
      operationId: issueInvoice
      parameters:
        - in: path
          name: invoice_id
          schema:
            type: string
            pattern: ^([a-zA-Z\d\-]+)$
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IssueInvoiceRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/IssueInvoiceRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/IssueInvoiceRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IssueInvoiceOutput'
          description: ''
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                BadRequestResponse:
                  value:
                    error:
                      code: ERR_BAD_REQUEST
                      message: >-
                        Bad request — the input payload is malformed, missing
                        required fields, or contains invalid data.
                  summary: Bad Request Response
          description: ''
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NotFoundResponse:
                  value:
                    error:
                      code: ERR_NOT_FOUND
                      message: >-
                        Not found — the resource you are looking for does not
                        exist.
                  summary: Not Found Response
          description: ''
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: ''
components:
  schemas:
    IssueInvoiceRequest:
      type: object
      properties:
        send_invoice:
          type: boolean
          description: >-
            Whether to send the customer's usual invoice notifications, as on
            the billing date: a customer autopay can charge is not emailed the
            invoice. When false no notifications are sent.
        due_date_basis:
          enum:
            - ISSUE_DATE
            - SERVICE_PERIOD
            - CUSTOM
          type: string
          x-spec-enum-id: 16da8029ddd46fbc
          nullable: true
          description: >-
            What the issued invoice's due date follows. Omit it to keep the
            invoice's own basis. `ISSUE_DATE` counts the payment terms from
            today, `SERVICE_PERIOD` from the billing date, and `CUSTOM` names
            the date outright and must be sent with `due_at`.


            * `ISSUE_DATE` - Issue date

            * `SERVICE_PERIOD` - Service period

            * `CUSTOM` - Custom
        due_at:
          type: string
          format: date
          nullable: true
          description: >-
            The due date to issue under. Only valid with a `CUSTOM`
            `due_date_basis`, and cannot be earlier than today.
      required:
        - send_invoice
    IssueInvoiceOutput:
      type: object
      description: Output serializer for an invoice issued now (SAL-8044).
      properties:
        invoice_id:
          type: string
          format: uuid
          description: The unique identifier of the issued invoice
        status:
          type: string
          description: The invoice's status once issued, for example `OUTSTANDING`.
      required:
        - invoice_id
        - status
    ErrorResponse:
      type: object
      description: >-
        Standardizes API error responses with a consistent structure containing
        error code and message.
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/Error'
          description: The error that caused the request to fail
      required:
        - error
    Error:
      type: object
      description: >-
        Represents individual error details with a standardized code and
        descriptive message.
      properties:
        code:
          enum:
            - ERR_NOT_FOUND
            - ERR_BAD_REQUEST
            - ERR_SERVER_ERROR
          type: string
          x-spec-enum-id: dc5a5d6feae1b697
          description: >-
            Error code indicating the type of error: NOT_FOUND for missing
            resources, BAD_REQUEST for invalid input, SERVER_ERROR for internal
            server issues


            * `ERR_NOT_FOUND` - ERR_NOT_FOUND

            * `ERR_BAD_REQUEST` - ERR_BAD_REQUEST

            * `ERR_SERVER_ERROR` - ERR_SERVER_ERROR
        message:
          type: string
          description: Human-readable explanation of the error
        error_id:
          type: string
          format: uuid
          description: >-
            Correlation handle for SERVER_ERROR responses — quote this when
            contacting support; it joins to the structured server log line for
            the failure. Not present on 4xx responses.
        details:
          description: >-
            Optional detail on what was wrong with the request; its shape
            depends on the endpoint. Validation errors send either a list of
            "field: message" strings or an object keyed by field name, nested
            under `fields` or at the top level.
      required:
        - code
        - message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-SALESBRICKS-KEY
      description: API key for authentication

````

## Related topics

- [Finalize an invoice](https://docs.salesbricks.com/api-reference/invoices/finalize-an-invoice.md)
- [Create standalone invoice](https://docs.salesbricks.com/api-reference/invoices/create-standalone-invoice.md)
- [Pay an invoice](https://docs.salesbricks.com/api-reference/invoices/pay-an-invoice.md)


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