Invoices

Create an invoice

Creates an invoice.

POST
/invoices

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

Invoice payload

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://api.sandbox.billingrails.com/v1/invoices" \  -H "Content-Type: application/json" \  -d '{    "account_id": "acc_IhMUl3rrZ3",    "currency": "USD",    "collection_method": "manual",    "due_at": "2025-02-14T17:33:40.843Z",    "line_items": [      {        "name": "Service",        "quantity": 1,        "unit_amount": 1000      }    ]  }'
{
  "invoice": {
    "object": "invoice",
    "id": "inv_IhMUl3rrZ3",
    "number": "INV-0001",
    "type": "adhoc",
    "status": "draft",
    "account_id": "acc_IhMUl3rrZ3",
    "currency": "USD",
    "collection_method": "manual",
    "credit_amount": 0,
    "outstanding_amount": 1000,
    "paid_amount": 0,
    "download_url": "https://billingrails.page/acme/i/inv_IhMUl3rrZ3/pdf",
    "url": "https://billingrails.page/acme/i/inv_IhMUl3rrZ3",
    "subscription_id": "sub_IhMUl3rrZ3",
    "subtotal_amount": 1000,
    "total_amount": 1000,
    "created_at": "2025-02-14T17:33:40.843Z",
    "due_at": "2025-02-14T17:33:40.843Z",
    "issued_at": "2025-02-14T17:33:40.843Z",
    "billing_start": "2025-02-14T17:33:40.843Z",
    "billing_end": "2025-02-14T17:33:40.843Z",
    "line_items": [
      {
        "object": "invoice_line_item",
        "id": "invli_IhMUl3rrZ3",
        "name": "Basic Product",
        "description": "Basic Product.",
        "quantity": 1,
        "unit_amount": 1000,
        "subtotal_amount": 1000,
        "total_amount": 1000,
        "billing_start": "2025-02-14T17:33:40.843Z",
        "billing_end": "2025-02-14T17:33:40.843Z"
      }
    ]
  },
  "meta": {
    "request_id": "req_IhMUl3rrZ3"
  }
}