import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.invoices.create({
customerId: "cus_123",
plans: [
{
planId: "pro",
featureQuantities: [
{
featureId: "seats",
billingBehavior: "prepaid",
quantity: 5,
},
{
featureId: "credits",
billingBehavior: "usage_based",
quantity: 2500,
},
],
},
],
customLineItems: [
{
amount: 500,
description: "Implementation services",
},
],
netTermsDays: 30,
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.invoices.create(
customer_id="cus_123",
plans=[
{
"plan_id": "pro",
"feature_quantities": [
{
"feature_id": "seats",
"billing_behavior": "prepaid",
"quantity": 5,
},
{
"feature_id": "credits",
"billing_behavior": "usage_based",
"quantity": 2500,
},
],
},
],
custom_line_items=[
{
"amount": 500,
"description": "Implementation services",
},
],
net_terms_days=30,
)curl --request POST \
--url https://api.useautumn.com/v1/invoices.create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"customer_id": "cus_123",
"net_terms_days": 30,
"plans": [
{
"plan_id": "pro",
"feature_quantities": [
{
"feature_id": "seats",
"billing_behavior": "prepaid",
"quantity": 5
},
{
"feature_id": "credits",
"billing_behavior": "usage_based",
"quantity": 2500
}
]
}
],
"custom_line_items": [
{
"description": "Implementation services",
"amount": 500
}
]
}
'{
"invoice": {
"id": "inv_2b3c4d5e6f7g8h",
"customer_id": "cus_123",
"entity_id": null,
"plan_ids": [
"pro_plan"
],
"stripe_id": "in_1A2B3C4D5E6F7G8H",
"processor_type": "stripe",
"status": "open",
"total": 29.99,
"amount_paid": 29.99,
"refunded_amount": 0,
"currency": "usd",
"created_at": 1759247877000,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_123/test_456",
"items": [
{
"id": "invoice_li_2b3c4d5e6f7g8h",
"description": "Pro plan",
"plan_id": "pro_plan",
"feature_id": null,
"feature_name": null,
"quantity": null,
"amount": 20,
"period_start": 1759247877000,
"period_end": 1761839877000,
"entities": []
},
{
"id": "invoice_li_3c4d5e6f7g8h9i",
"description": "AI credits",
"plan_id": "pro_plan",
"feature_id": "ai_credits",
"feature_name": "AI Credits",
"quantity": 4995,
"amount": 9.99,
"period_start": 1759247877000,
"period_end": 1761839877000,
"entities": [
{
"entity_id": "acme-docs-prod",
"quantity": 4995,
"amount": 9.99
}
]
}
]
},
"preview": {
"currency": "usd",
"lines": [],
"subtotal": 29.99,
"discount_total": 0,
"tax": null,
"total": 29.99,
"invoice_credits": {
"balance": 10,
"applied": 10,
"currency": "usd"
},
"amount_due": 19.99,
"due_date": 1761839877000
}
}
Create Invoice
Creates a standalone send-invoice Stripe invoice from catalog pricing and custom charges. Quantities are billable units, exclusive of any included usage; Autumn applies billing units and tiers. Nothing about the customer’s plans, balances or subscriptions changes. Pass preview: true to get the calculated lines and totals without creating an invoice.
import { Autumn } from 'autumn-js'
const autumn = new Autumn()
const result = await autumn.invoices.create({
customerId: "cus_123",
plans: [
{
planId: "pro",
featureQuantities: [
{
featureId: "seats",
billingBehavior: "prepaid",
quantity: 5,
},
{
featureId: "credits",
billingBehavior: "usage_based",
quantity: 2500,
},
],
},
],
customLineItems: [
{
amount: 500,
description: "Implementation services",
},
],
netTermsDays: 30,
});from autumn_sdk import Autumn
autumn = Autumn(secret_key="am_sk_test...")
res = autumn.invoices.create(
customer_id="cus_123",
plans=[
{
"plan_id": "pro",
"feature_quantities": [
{
"feature_id": "seats",
"billing_behavior": "prepaid",
"quantity": 5,
},
{
"feature_id": "credits",
"billing_behavior": "usage_based",
"quantity": 2500,
},
],
},
],
custom_line_items=[
{
"amount": 500,
"description": "Implementation services",
},
],
net_terms_days=30,
)curl --request POST \
--url https://api.useautumn.com/v1/invoices.create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"customer_id": "cus_123",
"net_terms_days": 30,
"plans": [
{
"plan_id": "pro",
"feature_quantities": [
{
"feature_id": "seats",
"billing_behavior": "prepaid",
"quantity": 5
},
{
"feature_id": "credits",
"billing_behavior": "usage_based",
"quantity": 2500
}
]
}
],
"custom_line_items": [
{
"description": "Implementation services",
"amount": 500
}
]
}
'{
"invoice": {
"id": "inv_2b3c4d5e6f7g8h",
"customer_id": "cus_123",
"entity_id": null,
"plan_ids": [
"pro_plan"
],
"stripe_id": "in_1A2B3C4D5E6F7G8H",
"processor_type": "stripe",
"status": "open",
"total": 29.99,
"amount_paid": 29.99,
"refunded_amount": 0,
"currency": "usd",
"created_at": 1759247877000,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_123/test_456",
"items": [
{
"id": "invoice_li_2b3c4d5e6f7g8h",
"description": "Pro plan",
"plan_id": "pro_plan",
"feature_id": null,
"feature_name": null,
"quantity": null,
"amount": 20,
"period_start": 1759247877000,
"period_end": 1761839877000,
"entities": []
},
{
"id": "invoice_li_3c4d5e6f7g8h9i",
"description": "AI credits",
"plan_id": "pro_plan",
"feature_id": "ai_credits",
"feature_name": "AI Credits",
"quantity": 4995,
"amount": 9.99,
"period_start": 1759247877000,
"period_end": 1761839877000,
"entities": [
{
"entity_id": "acme-docs-prod",
"quantity": 4995,
"amount": 9.99
}
]
}
]
},
"preview": {
"currency": "usd",
"lines": [],
"subtotal": 29.99,
"discount_total": 0,
"tax": null,
"total": 29.99,
"invoice_credits": {
"balance": 10,
"applied": 10,
"currency": "usd"
},
"amount_due": 19.99,
"due_date": 1761839877000
}
}
Body Parameters
Response
{
"invoice": {
"id": "inv_2b3c4d5e6f7g8h",
"customer_id": "cus_123",
"entity_id": null,
"plan_ids": [
"pro_plan"
],
"stripe_id": "in_1A2B3C4D5E6F7G8H",
"processor_type": "stripe",
"status": "open",
"total": 29.99,
"amount_paid": 29.99,
"refunded_amount": 0,
"currency": "usd",
"created_at": 1759247877000,
"hosted_invoice_url": "https://invoice.stripe.com/i/acct_123/test_456",
"items": [
{
"id": "invoice_li_2b3c4d5e6f7g8h",
"description": "Pro plan",
"plan_id": "pro_plan",
"feature_id": null,
"feature_name": null,
"quantity": null,
"amount": 20,
"period_start": 1759247877000,
"period_end": 1761839877000,
"entities": []
},
{
"id": "invoice_li_3c4d5e6f7g8h9i",
"description": "AI credits",
"plan_id": "pro_plan",
"feature_id": "ai_credits",
"feature_name": "AI Credits",
"quantity": 4995,
"amount": 9.99,
"period_start": 1759247877000,
"period_end": 1761839877000,
"entities": [
{
"entity_id": "acme-docs-prod",
"quantity": 4995,
"amount": 9.99
}
]
}
]
},
"preview": {
"currency": "usd",
"lines": [],
"subtotal": 29.99,
"discount_total": 0,
"tax": null,
"total": 29.99,
"invoice_credits": {
"balance": 10,
"applied": 10,
"currency": "usd"
},
"amount_due": 19.99,
"due_date": 1761839877000
}
}
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Body
The customer to invoice.
Show child attributes
Show child attributes
Charges that are not tied to any plan or feature.
Show child attributes
Show child attributes
Discounts applied to the whole invoice.
Show child attributes
Show child attributes
ID of an invoice template whose footer, memo and default payment terms are applied.
Days until the invoice is due. Defaults to the template's terms, then the org default.
-9007199254740991 < x <= 9007199254740991Date of issue printed on the invoice, in milliseconds. Defaults to now; cannot be in the future.
0 <= x <= 9007199254740991When payment is due, in milliseconds. Must be in the future; takes precedence over net_terms_days.
0 <= x <= 9007199254740991Stripe tax rate ID (txr_...) applied to every line.
Start of the period being invoiced, in milliseconds. Prorated lines are charged for period_start → period_end against one price interval starting at period_start.
0 <= x <= 9007199254740991End of the period being invoiced, in milliseconds.
0 <= x <= 9007199254740991If true, returns the calculated lines and totals without creating an invoice.