Your First Request

Get up and running with the DayZero API in minutes.

Prerequisites

  1. A DayZero account with API access enabled
  2. An API token (see Authentication)
  3. Your business ID — from the dashboard URL or settings, or from Step 1 below

Step 1: List Your Businesses

This is the one common endpoint that does not need x-business-id:

bash
curl "https://api.ondayzero.com/api/v1/businesses" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "Accept: application/json"

Response (abbreviated — every successful response is wrapped in {"success": true, "data": …}):

json
{
  "success": true,
  "data": {
    "items": [
      {
        "id": "01912345-abcd-7000-8000-000000000001",
        "name": "Acme Corp",
        "default_currency": "USD",
        "accounting_basis": "accrual",
        "created_at": "2026-01-15T10:30:00Z"
      }
    ],
    "next_cursor": null,
    "prev_cursor": null,
    "has_next": false,
    "has_prev": false,
    "limit": null,
    "total": null
  }
}

Step 2: Fetch Transactions

Use the id from above as your x-business-id:

bash
curl "https://api.ondayzero.com/api/v1/transactions?limit=5" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: 01912345-abcd-7000-8000-000000000001" \
  -H "Accept: application/json"

The response has the same shape: data.items holds the transactions, data.next_cursor / data.has_next drive paging (see Pagination).

Step 3: Create an Invoice

You need a customer first — GET /api/v1/customers lists them, POST /api/v1/customers creates one. Then:

bash
curl -X POST "https://api.ondayzero.com/api/v1/invoices" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: 01912345-abcd-7000-8000-000000000001" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "customer_id": "019ab37c-c057-7000-8000-000000000001",
    "due_date": "2026-11-01",
    "description": "Consulting — October",
    "line_items": [
      {
        "description": "Consulting services",
        "quantity": 1,
        "unit_price": 15000
      }
    ]
  }'

A line item with no variant_id is a custom line: description and unit_price are required and quantity defaults to 1. To bill a catalog product instead, pass its variant_id with a quantity (the catalog price is used unless you send unit_price).

The response data is the created invoice: id, number, status (draft), total, balance_due, the normalised line_items, and more.

Note: All amounts are in cents. 15000 = $150.00. Never send decimals.

Step 4: Something went wrong?

Every error is one JSON envelope — {"error", "message", "code", "request_id"} — and 422 validation errors add an errors map naming the offending fields. See Error Handling.

What's Next?