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

# Create an invoice

> Issues an invoice to one of your customers and, unless `notify` is `false`, emails it with a link to pay by card.

- Send the lines; Talescria computes the subtotal, tax and total. Each line is `quantity × unitPrice`, and tax is the subtotal × `rateBasisPoints`, rounded half up to a minor unit.
- The receiving account follows the payment link rules: USD, GBP or EUR, able to take card payments.
- Your business details must be complete, because they go on the invoice (`409 PROFILE_INCOMPLETE` otherwise).

An issued invoice can't be edited. To correct one, void it and issue a new one. If the email fails, the invoice still exists and `emailed` is `false`; use [Resend](/api-reference/invoices/resend-an-invoice).

Requires the `invoices:write` scope.



## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/invoices
openapi: 3.1.0
info:
  title: Talescria API
  version: 1.0.0
  description: >-
    Accounts, recipients, payments, transfers between your accounts, payment
    links, customers and invoices. Authenticate with an access token from your
    OAuth client.
servers:
  - url: https://api.talescria.com
    description: Production (test and live keys)
security:
  - bearerAuth: []
tags:
  - name: Accounts
    description: Your accounts and their balances.
  - name: Recipients
    description: People and businesses you pay, and where to pay them.
  - name: Payments
    description: Paying recipients, including across currencies.
  - name: Transfers
    description: Moving money between your own accounts.
  - name: Payment links
    description: Links anyone can open to pay you by card.
  - name: Customers
    description: People and businesses who pay you.
  - name: Invoices
    description: One-off invoices and recurring series.
paths:
  /v1/invoices:
    post:
      tags:
        - Invoices
      summary: Create an invoice
      description: >-
        Issues an invoice to one of your customers and, unless `notify` is
        `false`, emails it with a link to pay by card.


        - Send the lines; Talescria computes the subtotal, tax and total. Each
        line is `quantity × unitPrice`, and tax is the subtotal ×
        `rateBasisPoints`, rounded half up to a minor unit.

        - The receiving account follows the payment link rules: USD, GBP or EUR,
        able to take card payments.

        - Your business details must be complete, because they go on the invoice
        (`409 PROFILE_INCOMPLETE` otherwise).


        An issued invoice can't be edited. To correct one, void it and issue a
        new one. If the email fails, the invoice still exists and `emailed` is
        `false`; use [Resend](/api-reference/invoices/resend-an-invoice).


        Requires the `invoices:write` scope.
      operationId: createAnInvoice
      parameters:
        - $ref: '#/components/parameters/IdempotencyKeyRequired'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - accountId
                - customerId
                - dueAt
                - lines
              properties:
                accountId:
                  type: string
                customerId:
                  type: string
                dueAt:
                  type: integer
                  description: Epoch ms.
                lines:
                  type: array
                  minItems: 1
                  maxItems: 100
                  items:
                    type: object
                    required:
                      - description
                      - quantity
                      - unitPrice
                    properties:
                      description:
                        type: string
                        maxLength: 500
                      quantity:
                        type: integer
                        minimum: 1
                      unitPrice:
                        type: string
                        pattern: ^\d{1,15}$
                        description: Whole minor units.
                tax:
                  type: object
                  required:
                    - label
                    - rateBasisPoints
                  properties:
                    label:
                      type: string
                      maxLength: 60
                      example: VAT 20%
                    rateBasisPoints:
                      type: integer
                      minimum: 1
                      maximum: 10000
                      description: 2000 = 20%.
                memo:
                  type: string
                  maxLength: 2000
                issuedAt:
                  type: integer
                  description: The invoice date, epoch ms. Default now.
                poNumber:
                  type: string
                  maxLength: 64
                servicePeriod:
                  type: object
                  required:
                    - from
                    - to
                  properties:
                    from:
                      type: integer
                    to:
                      type: integer
                internalNote:
                  type: string
                  maxLength: 2000
                  description: Your own; never on the document or shown to the payer.
                notify:
                  type: boolean
                  default: true
                  description: false issues it without emailing.
                cc:
                  type: array
                  maxItems: 5
                  items:
                    type: string
                    format: email
                  description: >-
                    Who to copy, from the customer's own extra addresses.
                    Absent: all of them. Anyone else is refused.
      responses:
        '201':
          description: Issued.
          content:
            application/json:
              schema:
                type: object
                properties:
                  invoice:
                    $ref: '#/components/schemas/Invoice'
                  emailed:
                    type: boolean
        '400':
          description: >-
            `VALIDATION`: A field is missing or malformed. `message` says which.


            `IDEMPOTENCY_KEY_REQUIRED`: This operation needs an
            `Idempotency-Key` header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            `UNAUTHENTICATED`: The access token is missing, expired or revoked.
            Get a new token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            `INSUFFICIENT_SCOPE`: Your API key lacks the scope this operation
            needs. The scope is named in `message` and the `WWW-Authenticate`
            header.


            `ENVIRONMENT_MISMATCH`: The request named a different environment
            from the key's.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            `NOT_FOUND`: It doesn't exist, or isn't yours. The answer is the
            same for both.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            `PROFILE_INCOMPLETE`: Your business details aren't complete, so
            there's no name to issue from.


            `IDEMPOTENCY_IN_PROGRESS`: A request with this `Idempotency-Key` is
            still running. Retry shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            `UNSUPPORTED`: This can't work as asked, for example an unsupported
            currency, corridor or account. `message` says why.


            `IDEMPOTENCY_KEY_REUSED`: This `Idempotency-Key` was used for a
            different request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: '`RATE_LIMITED`: Too many requests. Wait for `Retry-After` seconds.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: '`UPSTREAM_UNAVAILABLE`: Temporarily unavailable. Retry with backoff.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  parameters:
    IdempotencyKeyRequired:
      name: Idempotency-Key
      in: header
      required: true
      description: >-
        A unique key for this operation. Send the same key when you retry it.
        Kept for 24 hours.
      schema:
        type: string
        minLength: 8
        maxLength: 255
        pattern: ^[A-Za-z0-9_\-:.]+$
  schemas:
    Invoice:
      type: object
      required:
        - id
        - status
        - number
        - total
        - issuedAt
        - dueAt
        - url
        - document
      properties:
        id:
          type: string
        status:
          type: string
          enum:
            - unpaid
            - overdue
            - paid
            - void
          description: '`overdue` is unpaid past dueAt, and still payable.'
        number:
          type: string
          example: INV-0001
        total:
          $ref: '#/components/schemas/Money'
        issuedAt:
          type: integer
        dueAt:
          type: integer
        accountId:
          type:
            - string
            - 'null'
        customer:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                id:
                  type: string
                name:
                  type: string
                email:
                  type: string
                deleted:
                  type: boolean
        paidAt:
          type:
            - integer
            - 'null'
        paymentInProgress:
          type: boolean
        url:
          type: string
          description: What the customer opens to see and pay it.
        document:
          type: object
          description: 'The document as issued: parties, lines, subtotal, tax, total, memo.'
        createdAt:
          type: integer
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Branch on this, not on `message`. See Errors.
            message:
              type: string
              description: For people. Wording can change.
    Money:
      type: object
      required:
        - minorUnits
        - currency
      properties:
        minorUnits:
          type: string
          pattern: ^-?\d+$
          description: Integer minor units as a string. Never a float.
          example: '125000'
        currency:
          type: string
          example: USD
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        An access token (`at_test_…` or `at_live_…`) from `POST
        https://idp.talescria.com/oauth/token`.

````

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