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

# Email an invoice

> Emails the invoice to the payer and fires the `invoice.sent` event. Call it again to resend.




## OpenAPI

````yaml /api-reference/openapi.en.json post /billing/invoices/{invoiceID}/send
openapi: 3.1.0
info:
  title: Infi API
  version: 0.0.1
  description: >
    The Infi REST API: catalog, customers, usage metering, subscriptions,

    invoices, payments and checkout.


    **Authentication.** Send your secret key as `Authorization: Bearer
    sk_test_…`

    (sandbox) or `sk_live_…` (production). The key prefix selects the
    environment.

    Checkout routes (`/pay/*`) and `/public/*` take no key: they run in the

    payer's browser.


    **Idempotency.** Every request that changes data requires an

    `Idempotency-Key` header. A retry with the same key returns the original

    response instead of running again.


    **Amounts.** Money and quantities travel as decimal strings (`"150.00"`,

    `"0.0001"`), never as floating-point numbers.


    **Errors.** The body carries `error_code` (stable, branch on it), `message`

    (for humans) and `tracer_id` (send it to support). Rate-limit and
    idempotency

    errors are nested under `error`, with `code` and `request_id`.
servers:
  - url: https://api-sandbox.beinfi.com
    description: Sandbox
  - url: https://api.beinfi.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Catalog
  - name: Customers
  - name: Metering
  - name: Subscriptions
  - name: Invoices
  - name: Payments
  - name: Checkout
  - name: Coupons
  - name: Billing
  - name: Account
  - name: Webhooks
  - name: Test account
  - name: Rail
  - name: Storefronts
paths:
  /billing/invoices/{invoiceID}/send:
    parameters:
      - $ref: '#/components/parameters/InvoiceID'
    post:
      tags:
        - Invoices
      summary: Email an invoice
      description: >
        Emails the invoice to the payer and fires the `invoice.sent` event. Call
        it again to resend.
      operationId: sendInvoice
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invoice'
          description: Success.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
components:
  parameters:
    InvoiceID:
      name: invoiceID
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Invoice ID.
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
      description: >-
        A unique key per operation (a UUID works). Retrying with the same key
        returns the original response.
  schemas:
    Invoice:
      type: object
      properties:
        id:
          type: string
          format: uuid
        customerId:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            The customer's product enrollment id. Set on product, usage and
            subscription invoices.
        payerId:
          type:
            - string
            - 'null'
          format: uuid
          description: The paying customer's id. Set on one-off invoices.
        subscriptionId:
          type:
            - string
            - 'null'
          format: uuid
          description: The subscription that generated the invoice
        invoiceNumber:
          type:
            - string
            - 'null'
          description: Sequential invoice number
        status:
          type: string
          enum:
            - draft
            - open
            - paid
            - void
            - uncollectible
          description: >-
            `draft` (being built), `open` (issued, awaiting payment), `paid`,
            `void` (canceled) or `uncollectible` (written off).
        currency:
          type: string
          description: Currency, as an ISO 4217 code (`BRL`).
        subtotal:
          type: string
          description: Sum of line items before tax and discounts.
        tax:
          type: string
          description: Tax on the invoice.
        total:
          type: string
          description: The invoice's final amount.
        amountDue:
          type: string
          description: How much is still owed.
        periodStart:
          type:
            - string
            - 'null'
          format: date-time
          description: Start of the billed period
        periodEnd:
          type:
            - string
            - 'null'
          format: date-time
          description: End of the billed period
        dueDate:
          type:
            - string
            - 'null'
          format: date-time
          description: Due date.
        finalizedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the invoice was issued.
        paidAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the invoice was paid.
        successUrl:
          type:
            - string
            - 'null'
          description: Where checkout sends the buyer after payment.
        cancelUrl:
          type:
            - string
            - 'null'
          description: Where checkout sends the buyer if they back out.
        createdAt:
          type: string
          format: date-time
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceLineItem'
      description: >-
        What a customer owes: line items, totals and status. Status: `draft` →
        `open` → `paid`, or `void` / `uncollectible`.
    InvoiceLineItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
        type:
          type: string
          enum:
            - usage
            - recurring
            - proration
            - credit
            - adjustment
            - commitment
            - manual
          description: >-
            `usage` (metered usage), `recurring` (recurring fee), `proration`
            (pro-rata adjustment for a mid-period change), `credit`,
            `adjustment` (usage that arrived after its period was already
            invoiced), `commitment` (top-up to the minimum commitment) or
            `manual` (free-form line).
        meterId:
          type:
            - string
            - 'null'
          format: uuid
          description: The meter the usage came from
        priceId:
          type:
            - string
            - 'null'
          format: uuid
          description: The price applied to this line.
        description:
          type: string
        quantity:
          type: string
          description: Quantity billed
        unitPrice:
          type:
            - string
            - 'null'
          description: Price per unit
        amount:
          type: string
          description: Line total
        proration:
          type: boolean
          description: '`true` when the line is a pro-rated amount.'
      description: One line on an invoice.
    Error:
      type: object
      required:
        - message
        - error_code
        - tracer_id
      properties:
        message:
          type: string
          description: Human-readable sentence.
        error_code:
          $ref: '#/components/schemas/ErrorCode'
          description: Stable error code. Branch on it.
        tracer_id:
          type: string
          description: Request id. Include it when contacting support.
      description: >-
        The standard error body. It is flat (no `error` wrapper) and the trace
        id is `tracer_id`.
    NotFoundError:
      type: object
      required:
        - message
        - error_code
        - tracer_id
        - resource
      properties:
        message:
          type: string
        error_code:
          $ref: '#/components/schemas/ErrorCode'
        tracer_id:
          type: string
        resource:
          type: string
    ConflictError:
      type: object
      required:
        - message
        - error_code
        - tracer_id
        - resource
        - metadata
      properties:
        message:
          type: string
          description: Human-readable explanation.
        error_code:
          $ref: '#/components/schemas/ErrorCode'
          description: Stable error code. Branch on this field.
        tracer_id:
          type: string
          description: Request identifier. Send it to support.
        resource:
          type: string
          description: The kind of resource in conflict. Empty string when not applicable.
        metadata:
          type:
            - object
            - 'null'
          additionalProperties:
            type: string
          description: Conflict details, as key-value pairs. `null` when there are none.
      description: 'Body of a 409 error: the resource''s state does not allow the operation.'
    RequestError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              $ref: '#/components/schemas/ErrorCode'
            message:
              type: string
            request_id:
              type: string
    ErrorCode:
      type: string
      examples:
        - internal_error
        - validation_failed
        - bad_request
        - unauthorized
        - forbidden
        - not_found
        - conflict
        - rate_limited
      description: >-
        Stable error code. The list is open: besides the generic codes, each
        area defines its own (`coupon_expired`, `insufficient_balance`,
        `version_not_draft`, `idempotency_key_reused`…). Handle a code you do
        not recognize by its HTTP status and show `message`; do not fail parsing
        the response.
  responses:
    Unauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
      description: Missing or invalid API key.
    NotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFoundError'
      description: Resource not found.
    Conflict:
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/ConflictError'
              - $ref: '#/components/schemas/RequestError'
      description: >-
        The resource's state does not allow the operation, or the
        `Idempotency-Key` was already used with a different body.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your account's secret key: `Authorization: Bearer sk_test_…` or
        `sk_live_…`. Server-side only.

````