Skip to main content

Prerequisites

  1. A Corebill account at app.corebill.io
  2. At least one company created in your organization
  3. An API key (generate one in Settings > Developers)

Step 1: Get your companies

First, retrieve your available companies to get the company_id you’ll use in subsequent requests.
curl "https://api.corebill.io/v1/companies" \
  -H "Authorization: Bearer sk_live_your_api_key"
Response:
{
  "data": {
    "companies": [
      {
        "id": "com_a1b2c3d4e5f6",
        "name": "My Company",
        "slug": "my-company",
        "currency": "USD"
      }
    ]
  }
}
Copy the id value — you’ll need it for all other endpoints.

Step 2: Create a customer

curl -X POST "https://api.corebill.io/v1/customers?company_id=com_a1b2c3d4e5f6" \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "country": "US",
    "email": "[email protected]",
    "currency": "USD"
  }'

Step 3: Create an invoice

curl -X POST "https://api.corebill.io/v1/invoices?company_id=com_a1b2c3d4e5f6" \
  -H "Authorization: Bearer sk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "cus_a1b2c3d4e5f6",
    "due_date": "2025-05-15",
    "tax_rate": 16,
    "items": [
      {
        "name": "Web Development",
        "description": "Frontend implementation",
        "quantity": 40,
        "unit": "hour",
        "unit_price": 75.00
      },
      {
        "name": "UI Design",
        "quantity": 1,
        "unit": "project",
        "unit_price": 2000.00
      }
    ]
  }'
Response:
{
  "data": {
    "id": "inv_x1y2z3a4b5c6",
    "invoice_number": "INV-2025-000001",
    "status": "draft",
    "subtotal": 5000.00,
    "tax_rate": 16,
    "tax_amount": 800.00,
    "total": 5800.00,
    "amount_due": 5800.00,
    "items": [...]
  }
}

Next steps