Skip to content

Create

invoices.create(InvoiceCreateParams**kwargs) -> InvoiceCreateResponse
POST/invoices

Creates an invoice.

ParametersExpand Collapse
invoice_id: str

Unique ID for the invoice.

line_items: Iterable[LineItem]

Line items to create with the invoice.

description: str

Description of the line item.

product_id: str

Unique identifier for the product.

type: Literal["payin", "payout"]

Type of the line item.

Accepts one of the following:
"payin"
"payout"
user: LineItemUser

Identifies a user by id or external_id.

Accepts one of the following:
class LineItemUserID:
id: str

FRAGMENT generated unique ID.

class LineItemUserExternalID:
external_id: str

User-provided unique ID.

Deprecatedamount: Optional[str]

Total amount as a string in the smallest currency unit, such as cents for USD. Deprecated, use price instead.

currency_code: Optional[Literal["ADA", "BTC", "DAI", 176 more]]

ISO 4217 or crypto currency code.

Accepts one of the following:
"ADA"
"BTC"
"DAI"
"ETH"
"SOL"
"USDC"
"USDT"
"USDG"
"EURC"
"CADC"
"CADT"
"XLM"
"UNI"
"BCH"
"LTC"
"AAVE"
"LINK"
"MATIC"
"PTS"
"AED"
"AFN"
"ALL"
"AMD"
"ANG"
"AOA"
"ARS"
"AUD"
"AWG"
"AZN"
"BAM"
"BBD"
"BDT"
"BGN"
"BHD"
"BIF"
"BMD"
"BND"
"BOB"
"BRL"
"BSD"
"BTN"
"BWP"
"BYR"
"BZD"
"CAD"
"CDF"
"CHF"
"CLP"
"CNY"
"COP"
"CRC"
"CUC"
"CUP"
"CVE"
"CZK"
"DJF"
"DKK"
"DOP"
"DZD"
"EGP"
"ERN"
"ETB"
"EUR"
"FJD"
"FKP"
"GBP"
"GEL"
"GGP"
"GHS"
"GIP"
"GMD"
"GNF"
"GTQ"
"GYD"
"HKD"
"HNL"
"HRK"
"HTG"
"HUF"
"IDR"
"ILS"
"IMP"
"INR"
"IQD"
"IRR"
"ISK"
"JMD"
"JOD"
"JPY"
"KES"
"KGS"
"KHR"
"KMF"
"KPW"
"KRW"
"KWD"
"KYD"
"KZT"
"LAK"
"LBP"
"LKR"
"LRD"
"LSL"
"LYD"
"MAD"
"MDL"
"MGA"
"MKD"
"MMK"
"MNT"
"MOP"
"MUR"
"MVR"
"MWK"
"MXN"
"MYR"
"MZN"
"NAD"
"NGN"
"NIO"
"NOK"
"NPR"
"NZD"
"OMR"
"PAB"
"PEN"
"PGK"
"PHP"
"PKR"
"PLN"
"PYG"
"QAR"
"RON"
"RSD"
"RUB"
"RWF"
"SAR"
"SBD"
"SCR"
"SDG"
"SEK"
"SGD"
"SHP"
"SLL"
"SOS"
"SPL"
"SRD"
"SVC"
"SYP"
"STN"
"SZL"
"THB"
"TJS"
"TMT"
"TND"
"TOP"
"TRY"
"TTD"
"TVD"
"TWD"
"TZS"
"UAH"
"UGX"
"USD"
"UYU"
"UZS"
"VEF"
"VND"
"VUV"
"WST"
"XAF"
"XCD"
"XOF"
"XPF"
"YER"
"ZAR"
"ZMW"
"LOGICAL"
"CUSTOM"
price: Optional[LineItemPrice]

Price breakdown. Provide amount, or unit_price and quantity, or all three.

amount: Optional[str]

Total amount as a string in the smallest currency unit, such as cents for USD. Required if unit_price and quantity are not provided.

quantity: Optional[int]

Number of units for the line item.

minimum1
unit_price: Optional[str]

Price per unit as a string in the smallest currency unit, such as cents for USD.

tags: Optional[Iterable[LineItemTag]]

Tags for the line item.

key: str

Tag key. Must not contain #, /, or :. Max 50 characters.

value: str

Tag value. Must not contain #, /, or :. Max 200 characters.

tags: Optional[Iterable[Tag]]

Tags for the invoice.

key: str

Tag key. Must not contain #, /, or :. Max 50 characters.

value: str

Tag value. Must not contain #, /, or :. Max 200 characters.

ReturnsExpand Collapse
class InvoiceCreateResponse:
data: Invoice

Invoice object.

id: str

Unique invoice ID.

created: datetime

Timestamp when the invoice was created. Uses ISO 8601 format.

formatdate-time
Deprecatedstatus: Literal["active"]

Status of the invoice. Deprecated.

tags: List[Tag]

Tags for the invoice.

key: str

Tag key.

value: str

Tag value.

version: float

Current version of the invoice.

workspace_id: str

Workspace the invoice belongs to.

line_items: Optional[List[LineItem]]

Line items for the invoice.

id: str

FRAGMENT generated unique ID.

Deprecatedamount: str

Total amount as a string in the smallest currency unit, such as cents for USD. Deprecated, use price.amount instead.

currency_code: Literal["ADA", "BTC", "DAI", 176 more]

ISO 4217 or crypto currency code.

Accepts one of the following:
"ADA"
"BTC"
"DAI"
"ETH"
"SOL"
"USDC"
"USDT"
"USDG"
"EURC"
"CADC"
"CADT"
"XLM"
"UNI"
"BCH"
"LTC"
"AAVE"
"LINK"
"MATIC"
"PTS"
"AED"
"AFN"
"ALL"
"AMD"
"ANG"
"AOA"
"ARS"
"AUD"
"AWG"
"AZN"
"BAM"
"BBD"
"BDT"
"BGN"
"BHD"
"BIF"
"BMD"
"BND"
"BOB"
"BRL"
"BSD"
"BTN"
"BWP"
"BYR"
"BZD"
"CAD"
"CDF"
"CHF"
"CLP"
"CNY"
"COP"
"CRC"
"CUC"
"CUP"
"CVE"
"CZK"
"DJF"
"DKK"
"DOP"
"DZD"
"EGP"
"ERN"
"ETB"
"EUR"
"FJD"
"FKP"
"GBP"
"GEL"
"GGP"
"GHS"
"GIP"
"GMD"
"GNF"
"GTQ"
"GYD"
"HKD"
"HNL"
"HRK"
"HTG"
"HUF"
"IDR"
"ILS"
"IMP"
"INR"
"IQD"
"IRR"
"ISK"
"JMD"
"JOD"
"JPY"
"KES"
"KGS"
"KHR"
"KMF"
"KPW"
"KRW"
"KWD"
"KYD"
"KZT"
"LAK"
"LBP"
"LKR"
"LRD"
"LSL"
"LYD"
"MAD"
"MDL"
"MGA"
"MKD"
"MMK"
"MNT"
"MOP"
"MUR"
"MVR"
"MWK"
"MXN"
"MYR"
"MZN"
"NAD"
"NGN"
"NIO"
"NOK"
"NPR"
"NZD"
"OMR"
"PAB"
"PEN"
"PGK"
"PHP"
"PKR"
"PLN"
"PYG"
"QAR"
"RON"
"RSD"
"RUB"
"RWF"
"SAR"
"SBD"
"SCR"
"SDG"
"SEK"
"SGD"
"SHP"
"SLL"
"SOS"
"SPL"
"SRD"
"SVC"
"SYP"
"STN"
"SZL"
"THB"
"TJS"
"TMT"
"TND"
"TOP"
"TRY"
"TTD"
"TVD"
"TWD"
"TZS"
"UAH"
"UGX"
"USD"
"UYU"
"UZS"
"VEF"
"VND"
"VUV"
"WST"
"XAF"
"XCD"
"XOF"
"XPF"
"YER"
"ZAR"
"ZMW"
"LOGICAL"
"CUSTOM"
description: str

Description of the line item.

price: LineItemPrice

Price breakdown.

amount: str

Total amount as a string in the smallest currency unit, such as cents for USD.

quantity: int

Number of units.

unit_price: str

Unit price as a string in the smallest currency unit, such as cents for USD.

product_id: str

Unique identifier for the product.

tags: List[LineItemTag]

Tags for the line item.

key: str

Tag key.

value: str

Tag value.

type: Literal["payin", "payout"]

Type of the line item.

Accepts one of the following:
"payin"
"payout"
user_id: str

User-provided unique external ID.

modified: Optional[datetime]

Timestamp when the invoice was last modified. Uses ISO 8601 format.

formatdate-time

Create

from fragment import Fragment

client = Fragment()
invoice = client.invoices.create(
    invoice_id="invoice_2024_001",
    line_items=[{
        "description": "Professional services for January 2026",
        "product_id": "prod_1234567890",
        "type": "payout",
        "user": {
            "id": "user_abc123"
        },
    }],
)
print(invoice.data)
{
  "data": {
    "id": "inv_1234567890",
    "created": "2024-01-13T00:00:00Z",
    "status": "active",
    "tags": [
      {
        "key": "department",
        "value": "engineering"
      }
    ],
    "version": 1,
    "workspace_id": "ws_1234567890",
    "line_items": [
      {
        "id": "item_1234567890",
        "amount": "1000",
        "currency_code": "USD",
        "description": "Professional services for January 2026",
        "price": {
          "amount": "1000",
          "quantity": 1,
          "unit_price": "1000"
        },
        "product_id": "prod_1234567890",
        "tags": [
          {
            "key": "department",
            "value": "engineering"
          }
        ],
        "type": "payout",
        "user_id": "user_ext_456"
      }
    ],
    "modified": "2024-01-13T00:00:00Z"
  }
}
Returns Examples
{
  "data": {
    "id": "inv_1234567890",
    "created": "2024-01-13T00:00:00Z",
    "status": "active",
    "tags": [
      {
        "key": "department",
        "value": "engineering"
      }
    ],
    "version": 1,
    "workspace_id": "ws_1234567890",
    "line_items": [
      {
        "id": "item_1234567890",
        "amount": "1000",
        "currency_code": "USD",
        "description": "Professional services for January 2026",
        "price": {
          "amount": "1000",
          "quantity": 1,
          "unit_price": "1000"
        },
        "product_id": "prod_1234567890",
        "tags": [
          {
            "key": "department",
            "value": "engineering"
          }
        ],
        "type": "payout",
        "user_id": "user_ext_456"
      }
    ],
    "modified": "2024-01-13T00:00:00Z"
  }
}