POST
/
v1
/
invoices
curl --location --request POST 'https://api.stateset.com/v1/invoices' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
    "customer_id": "cust_abc123",
    "issue_date": "2024-01-19",
    "due_date": "2024-02-18",
    "currency": "USD",
    "line_items": [
        {
            "description": "Professional Services - January 2024",
            "quantity": 40,
            "unit_price": 15000,
            "tax_rate": 0.08
        },
        {
            "description": "Software License",
            "quantity": 5,
            "unit_price": 9900,
            "product_id": "prod_xyz789"
        }
    ],
    "payment_terms": "Net 30",
    "send_email": true
}'
{
  "id": "inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
  "object": "invoice",
  "invoice_number": "INV-2024-0001",
  "status": "sent",
  "customer_id": "cust_abc123",
  "issue_date": "2024-01-19",
  "due_date": "2024-02-18",
  "currency": "USD",
  "subtotal": 649500,
  "tax_amount": 48000,
  "total_amount": 697500,
  "amount_due": 697500,
  "amount_paid": 0,
  "line_items": [
    {
      "id": "li_123456",
      "description": "Professional Services - January 2024",
      "quantity": 40,
      "unit_price": 15000,
      "amount": 600000,
      "tax_rate": 0.08,
      "tax_amount": 48000
    },
    {
      "id": "li_123457",
      "description": "Software License",
      "quantity": 5,
      "unit_price": 9900,
      "amount": 49500,
      "product_id": "prod_xyz789",
      "tax_rate": 0,
      "tax_amount": 0
    }
  ],
  "payment_terms": "Net 30",
  "created_at": "2024-01-19T10:00:00Z",
  "sent_at": "2024-01-19T10:01:00Z",
  "pdf_url": "https://invoices.stateset.com/inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30.pdf"
}
This endpoint creates a new invoice for billing customers. Invoices can be sent immediately or scheduled for future delivery.

Authentication

This endpoint requires a valid API key with invoices:write permissions.
Authorization: Bearer YOUR_API_KEY

Request Body

customer_id
string
required
Customer ID to bill
invoice_number
string
Custom invoice number (auto-generated if not provided)
issue_date
string
required
Invoice issue date (ISO 8601)
due_date
string
required
Payment due date (ISO 8601)
currency
string
required
ISO 4217 currency code
line_items
array
required
Invoice line items
billing_address
object
Billing address
payment_terms
string
Payment terms (e.g., “Net 30”, “Due on receipt”)
notes
string
Invoice notes or memo
send_email
boolean
Whether to email invoice to customer (default: false)
metadata
object
Additional custom fields

Response

Returns the created invoice.
curl --location --request POST 'https://api.stateset.com/v1/invoices' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
    "customer_id": "cust_abc123",
    "issue_date": "2024-01-19",
    "due_date": "2024-02-18",
    "currency": "USD",
    "line_items": [
        {
            "description": "Professional Services - January 2024",
            "quantity": 40,
            "unit_price": 15000,
            "tax_rate": 0.08
        },
        {
            "description": "Software License",
            "quantity": 5,
            "unit_price": 9900,
            "product_id": "prod_xyz789"
        }
    ],
    "payment_terms": "Net 30",
    "send_email": true
}'
{
  "id": "inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
  "object": "invoice",
  "invoice_number": "INV-2024-0001",
  "status": "sent",
  "customer_id": "cust_abc123",
  "issue_date": "2024-01-19",
  "due_date": "2024-02-18",
  "currency": "USD",
  "subtotal": 649500,
  "tax_amount": 48000,
  "total_amount": 697500,
  "amount_due": 697500,
  "amount_paid": 0,
  "line_items": [
    {
      "id": "li_123456",
      "description": "Professional Services - January 2024",
      "quantity": 40,
      "unit_price": 15000,
      "amount": 600000,
      "tax_rate": 0.08,
      "tax_amount": 48000
    },
    {
      "id": "li_123457",
      "description": "Software License",
      "quantity": 5,
      "unit_price": 9900,
      "amount": 49500,
      "product_id": "prod_xyz789",
      "tax_rate": 0,
      "tax_amount": 0
    }
  ],
  "payment_terms": "Net 30",
  "created_at": "2024-01-19T10:00:00Z",
  "sent_at": "2024-01-19T10:01:00Z",
  "pdf_url": "https://invoices.stateset.com/inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30.pdf"
}