Skip to main content

Documentation Index

Fetch the complete documentation index at: https://help.daylit.com/llms.txt

Use this file to discover all available pages before exploring further.

The customers endpoints let you read and write every aspect of a customer record in your Daylit company. You can list customers with rich filtering and cursor-based pagination, create or update records, manage nested contacts, and retrieve per-customer AR aging history — all scoped to a single company_id.

List customers


GET /api/companies/{company_id}/customers
Returns a paginated list of customers for the given company. The response uses cursor-based pagination so you can efficiently load large portfolios. On the first request (no cursor), the response includes a count of total matching records and a next_cursor you pass on subsequent requests to fetch the next page.

Path parameters

company_id
string
required
UUID of the company whose customers you want to list.

Query parameters

status
string
Filter by customer status. Accepted values: active, inactive, suspended, prospect. Pass any or omit to return all statuses.
industry
string
Filter by industry (case-insensitive exact match).
Case-insensitive partial match against customer_company_name.
risk_level
string
Filter by AR aging risk level derived from the latest AR aging detail snapshot.
ar_owner
string
UUID of the team member assigned as AR owner. Returns only customers assigned to that owner.
sales_owner
string
UUID of the team member assigned as sales owner.
is_person
boolean
Pass true to return individual person contacts only. Pass false to return company accounts (and records where is_person is null).
labels
string
Comma-separated list of label UUIDs. Returns customers matching any of the given labels (OR semantics).
hide_zero_balance
boolean
Pass true to exclude customers with a zero open balance.
balance_scope
string
Pass positive to return only customers with a positive open balance when no other balance filter is active.
sort
string
default:"total_balance_desc"
Sort order. Accepted values: total_balance_desc, total_balance_asc, customer_name_asc, customer_name_desc.
limit
number
default:"100"
Maximum number of customers to return per page. Capped at 500.
cursor
string
Opaque cursor returned as next_cursor from a previous response. Omit on the first request.
include_contacts
boolean
Pass true (or 1 / yes) to embed the customer’s contacts array in each list item.

Response fields

count
number
Total number of customers matching the applied filters. Only present on the first page (when no cursor is supplied).
limit
number
The page size used for this response.
has_more
boolean
true when additional pages are available.
next_cursor
string
Pass this value as cursor on your next request to fetch the following page. null when you have reached the last page.
applied_filters
object
Echo of all filters that were active for this request, useful for debugging.
items
object[]
Array of customer objects for the current page.

Example

curl --request GET \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers?status=active&sort=total_balance_desc&limit=50" \
  --header "Authorization: Token YOUR_API_KEY"
{
  "count": 142,
  "limit": 50,
  "has_more": true,
  "next_cursor": "eyJtb2RlIjoidG90YWxfYmFsYW5jZSIsInRvdGFsX2JhbGFuY2UiOiIxMjM0NS4wMCIsImlkIjoiYWJjMTIzIn0=",
  "applied_filters": {
    "company_id": "9e8f1234-0000-0000-0000-abcdef012345",
    "status": "active"
  },
  "items": [
    {
      "id": "c1a2b3c4-0000-0000-0000-000000000001",
      "customer_company_name": "Acme Corp",
      "is_person": false,
      "open_balance": 48200.00,
      "total_due": 12500.00,
      "aging_breakdown": {
        "current": 35700.00,
        "1_30": 8000.00,
        "31_60": 3500.00,
        "61_90": 1000.00,
        "91_over": 0.00
      },
      "ar_owner": "u1a2b3c4-0000-0000-0000-000000000099",
      "ar_owner_name": "Jane Smith",
      "invoices_count": 7,
      "credit_limit": 60000.00,
      "credit_usage_percent": 80.3,
      "labels": [],
      "signals": [],
      "primary_signal_severity": null,
      "conversation_summary": null,
      "last_contact_date": "2026-04-30T14:22:00Z",
      "created_at": "2025-01-15T09:00:00Z",
      "updated_at": "2026-04-30T14:22:00Z"
    }
  ]
}

Create a customer


POST /api/companies/{company_id}/customers
Creates a new customer record under the given company. Returns the created customer with HTTP 201.

Path parameters

company_id
string
required
UUID of the company to create the customer under.

Request body

customer_company_name
string
required
Display name of the customer (company or individual).
is_person
boolean
Set to true when the customer is an individual rather than a company.
customer_status
string
Initial status of the customer. Common values: active, inactive, prospect.
industry
string
Industry classification for filtering.
description
string
Free-text description of the customer.
default_payment_terms
number
Default net payment terms in days (e.g., 30 for Net 30).
credit_limit
number
Credit limit for this customer in your base currency.
URL to the customer’s payment portal or pay link.
preferred_communication_method
string
Preferred outreach channel for this customer (e.g., email, phone).
ar_owner
string
UUID of the team member to assign as AR owner.
sales_owner
string
UUID of the team member to assign as sales owner.
internal_notes
string
Internal notes visible only to your team.
address_line1
string
Primary address line.
address_city
string
City.
address_state
string
State or province.
address_zipcode
string
Postal code.
address_country
string
Country code or name.

Example

curl --request POST \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers" \
  --header "Authorization: Token YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "customer_company_name": "Globex Industries",
    "customer_status": "active",
    "default_payment_terms": 30,
    "credit_limit": 75000.00,
    "industry": "Manufacturing"
  }'

Get a customer


GET /api/companies/{company_id}/customers/{customer_id}
Returns a single customer record with full detail, including nested locations, active contacts, open invoices (up to 20), and computed AR metrics.

Path parameters

company_id
string
required
UUID of the company.
customer_id
string
required
UUID of the customer to retrieve.

Response fields

The detail response extends the list item fields with the following additional fields:
description
string
Free-text description of the customer.
industry
string
Industry classification.
customer_status
string
Current status of the customer.
default_payment_terms
number
Default net payment terms in days.
Pay link URL for this customer.
preferred_communication_method
string
Preferred outreach channel.
internal_notes
string
Team-only internal notes.
locations
object[]
All saved locations for this customer. Each object includes id, location_name, address_line1, address_city, address_state, address_zipcode, address_country, is_primary, is_billing_address, and is_active.
contacts
object[]
All active contacts (is_active=true) for this customer. See the contacts fields below.
invoices
object[]
Up to 20 open AR invoices for this customer. Each entry includes id, invoice_number, due_date, balance, total_amount, status, and days_outstanding.
invoices_count
number
Total count of open AR invoices (not capped at 20).
overdue_invoices_count
number
Count of open invoices whose due_date is in the past.
open_balance
number
Sum of all open invoice balances.
weighted_avg_ar_age
number
Weighted-average age of open AR in days, sourced from the latest AR aging snapshot.
days_beyond_terms
number
Weighted-average days past the agreed payment terms, sourced from the latest AR aging snapshot.
avg_days_to_pay
number
Average days from invoice issue to payment across historical paid invoices.
payment_history
object[]
Month-by-month payment history for trend analysis. Each entry has month (YYYY-MM), days (weighted-average days to pay), and optionally days_beyond (weighted-average days beyond terms).
portfolio_total_ar
number
Total open AR balance across the entire company (not just this customer).

Example

curl --request GET \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers/c1a2b3c4-0000-0000-0000-000000000001" \
  --header "Authorization: Token YOUR_API_KEY"

Update a customer


PATCH /api/companies/{company_id}/customers/{customer_id}
PUT  /api/companies/{company_id}/customers/{customer_id}
Updates an existing customer record. Use PATCH to update individual fields without supplying the full object. Use PUT to replace the entire record. Both methods trigger a customer metrics sync. You can also update label assignments atomically by including label_ids in the PATCH body — this replaces the customer’s full set of labels.

Path parameters

company_id
string
required
UUID of the company.
customer_id
string
required
UUID of the customer to update.

Request body (PATCH)

Supply any subset of the writable customer fields. All fields from the Create a customer request body are accepted, plus:
label_ids
string[]
Array of label UUIDs to assign to this customer. Replaces the customer’s current label set entirely.

Example

curl --request PATCH \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers/c1a2b3c4-0000-0000-0000-000000000001" \
  --header "Authorization: Token YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "credit_limit": 90000.00,
    "customer_status": "active",
    "label_ids": ["label-uuid-1", "label-uuid-2"]
  }'

Customer AR summary


GET /api/companies/{company_id}/customers/summary
Returns an aggregated AR summary across all customers in the company — total open balance, aging breakdowns, counts by status, and related metrics. Use this endpoint to populate portfolio-level dashboards.

Path parameters

company_id
string
required
UUID of the company.

Example

curl --request GET \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers/summary" \
  --header "Authorization: Token YOUR_API_KEY"

List contacts


GET /api/companies/{company_id}/customers/{customer_id}/contacts
Returns all contacts on file for a customer.

Path parameters

company_id
string
required
UUID of the company.
customer_id
string
required
UUID of the customer.

Query parameters

is_active
boolean
Filter to active (true) or inactive (false) contacts only. Omit to return all.
contact_type
string
Filter by contact type (e.g., AP Manager, Controller, CFO, Primary Contact).

Response fields

count
number
Total number of contacts matching the filter.
data
object[]
Array of contact objects.

Example

curl --request GET \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers/c1a2b3c4-0000-0000-0000-000000000001/contacts?is_active=true" \
  --header "Authorization: Token YOUR_API_KEY"
{
  "count": 2,
  "data": [
    {
      "id": "ct000001-0000-0000-0000-000000000001",
      "customer": "c1a2b3c4-0000-0000-0000-000000000001",
      "first_name": "Alice",
      "last_name": "Johnson",
      "email": "alice.johnson@acmecorp.com",
      "phone": "+1-555-0100",
      "title": "AP Manager",
      "department": "Finance",
      "contact_type": "AP Manager",
      "is_primary": true,
      "is_active": true,
      "data_source_type": null,
      "created_at": "2025-03-01T10:00:00Z"
    }
  ]
}

Add a contact


POST /api/companies/{company_id}/customers/{customer_id}/contacts
Creates a new contact under the given customer. Returns HTTP 201 with the created contact object. Email addresses must be unique per customer.

Path parameters

company_id
string
required
UUID of the company.
customer_id
string
required
UUID of the customer to add the contact to.

Request body

first_name
string
Contact’s first name.
last_name
string
Contact’s last name.
email
string
Contact’s email address. Must be unique per customer.
phone
string
Contact’s phone number.
title
string
Contact’s job title.
department
string
Contact’s department.
contact_type
string
Role classification for AR purposes.
is_primary
boolean
Set to true to mark this contact as the primary AR contact for the account.
is_active
boolean
default:"true"
Whether the contact is active.

Example

curl --request POST \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers/c1a2b3c4-0000-0000-0000-000000000001/contacts" \
  --header "Authorization: Token YOUR_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "first_name": "Bob",
    "last_name": "Chen",
    "email": "bob.chen@acmecorp.com",
    "title": "Controller",
    "contact_type": "Controller",
    "is_primary": false
  }'

Customer activity log


GET /api/companies/{company_id}/customers/{customer_id}/activity
Returns a chronological log of all activity events for the given customer, including communications sent, notes logged, invoice status changes, and system events.

Path parameters

company_id
string
required
UUID of the company.
customer_id
string
required
UUID of the customer.

Example

curl --request GET \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers/c1a2b3c4-0000-0000-0000-000000000001/activity" \
  --header "Authorization: Token YOUR_API_KEY"

Customer AR aging history


GET /api/companies/{company_id}/customers/{customer_id}/ar-aging/history
Returns historical AR aging snapshots for a specific customer. Each snapshot captures the customer’s balance across aging buckets, risk metrics, and computed scores at a point in time. Use this data to build trend charts and benchmark payment behavior over time.

Path parameters

company_id
string
required
UUID of the company.
customer_id
string
required
UUID of the customer.

Response fields

data
object[]
Array of historical AR aging snapshots, sorted by report date descending.

Example

curl --request GET \
  --url "https://your-instance.com/api/companies/9e8f1234-0000-0000-0000-abcdef012345/customers/c1a2b3c4-0000-0000-0000-000000000001/ar-aging/history" \
  --header "Authorization: Token YOUR_API_KEY"
{
  "data": [
    {
      "id": "ah000001-0000-0000-0000-000000000001",
      "current": 35700.00,
      "days_1_30": 8000.00,
      "days_31_60": 3500.00,
      "days_61_90": 1000.00,
      "days_91_over": 0.00,
      "total_ar": 48200.00,
      "overdue": 12500.00,
      "weighted_avg_ar_age": 22.4,
      "days_beyond_terms": 5.1,
      "risk_score": 42,
      "risk_level": "low",
      "invoice_count": 7,
      "overdue_count": 3,
      "created_at": "2026-05-01T00:00:00Z"
    }
  ]
}