Skip to main content

Contacts

Create and manage customers and suppliers.

Contacts represent counterparties in the ledger. They are referenced by invoices, payments, and transactions.

Authentication

All endpoints require a valid API key. See Authentication.

The contact object

{
"id": "cont_17",
"contactType": "customer",
"name": "Acme Corporation",
"company": "Acme Corp Ltd",
"email": "accounts@acme.com",
"phone": "+44 20 7123 4567",
"addressLine1": "123 Business Park",
"addressLine2": "Suite 100",
"city": "London",
"region": "Greater London",
"postalCode": "EC1A 1BB",
"country": "United Kingdom",
"vatNumber": "GB123456789",
"paymentTerms": 30,
"currency": "GBP",
"bankName": null,
"bankSortCode": null,
"bankAccount": null,
"bankIban": null,
"isActive": true,
"notes": "Key client since 2024",
"createdAt": "2026-01-15T10:00:00Z",
"updatedAt": "2026-01-31T14:30:00Z"
}

Contact attributes

FieldTypeDescription
idstringUnique identifier (e.g., cont_17)
contactTypestringcustomer, supplier, or both
namestringContact name
companystringCompany name (optional)
emailstringEmail address
phonestringPhone number
addressLine1stringAddress line 1
addressLine2stringAddress line 2
citystringCity
regionstringRegion or county
postalCodestringPostal code
countrystringCountry
vatNumberstringVAT registration number
paymentTermsintegerDefault payment terms (days)
currencystringDefault currency (ISO 4217)
bankNamestringBank name (suppliers only)
bankSortCodestringSort code (suppliers only)
bankAccountstringAccount number (suppliers only)
bankIbanstringIBAN (suppliers only)
isActivebooleanWhether the contact is active
notesstringInternal notes
createdAtstringCreation timestamp (UTC)
updatedAtstringLast update timestamp (UTC)

Create a contact

POST /v1/contacts
curl -X POST https://api.speybooks.com/v1/contacts \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"contactType": "customer",
"name": "Acme Corporation",
"company": "Acme Corp Ltd",
"email": "accounts@acme.com",
"phone": "+44 20 7123 4567",
"addressLine1": "123 Business Park",
"city": "London",
"postalCode": "EC1A 1BB",
"vatNumber": "GB123456789",
"paymentTerms": 30
}'

Create parameters

FieldTypeRequiredDescription
contactTypestringYescustomer, supplier, or both
namestringYesContact name (max 200 chars)
companystringNoCompany name
emailstringNoEmail address
phonestringNoPhone number
addressLine1stringNoAddress line 1
addressLine2stringNoAddress line 2
citystringNoCity
regionstringNoRegion or county
postalCodestringNoPostal code
countrystringNoDefaults to United Kingdom
vatNumberstringNoVAT registration number
paymentTermsintegerNoDefault payment terms (days)
currencystringNoDefault currency (defaults to GBP)
bankNamestringNoBank name
bankSortCodestringNoSort code
bankAccountstringNoAccount number
bankIbanstringNoIBAN
notesstringNoInternal notes

Response

{
"success": true,
"data": {
"id": "cont_17",
"contactType": "customer",
"name": "Acme Corporation",
"company": "Acme Corp Ltd",
"email": "accounts@acme.com",
"phone": "+44 20 7123 4567",
"addressLine1": "123 Business Park",
"city": "London",
"postalCode": "EC1A 1BB",
"country": "United Kingdom",
"vatNumber": "GB123456789",
"paymentTerms": 30,
"currency": "GBP",
"isActive": true,
"createdAt": "2026-01-31T10:00:00Z",
"updatedAt": "2026-01-31T10:00:00Z"
}
}

Retrieve a contact

GET /v1/contacts/:id
curl https://api.speybooks.com/v1/contacts/cont_17 \
-H "Authorization: Bearer sk_live_your_api_key"

Response

{
"success": true,
"data": {
"id": "cont_17",
"contactType": "customer",
"name": "Acme Corporation",
"company": "Acme Corp Ltd",
"email": "accounts@acme.com",
"isActive": true,
"createdAt": "2026-01-31T10:00:00Z",
"updatedAt": "2026-01-31T10:00:00Z"
}
}

List contacts

GET /v1/contacts
curl "https://api.speybooks.com/v1/contacts?type=customer&active=true&limit=20" \
-H "Authorization: Bearer sk_live_your_api_key"

Query parameters

ParameterTypeDefaultDescription
typestringcustomer, supplier, or both
searchstringSearch by name, company, or email
activebooleantrueFilter by active status
pageinteger1Page number
limitinteger50Results per page (max 100)

Response

{
"success": true,
"data": [
{
"id": "cont_17",
"contactType": "customer",
"name": "Acme Corporation",
"company": "Acme Corp Ltd",
"email": "accounts@acme.com",
"isActive": true
},
{
"id": "cont_18",
"contactType": "customer",
"name": "TechStart Ltd",
"company": null,
"email": "hello@techstart.io",
"isActive": true
}
],
"meta": {
"page": 1,
"limit": 20,
"total": 47,
"hasMore": true
}
}

Update a contact

PUT /v1/contacts/:id
curl -X PUT https://api.speybooks.com/v1/contacts/cont_17 \
-H "Authorization: Bearer sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"phone": "+44 20 7123 9999",
"paymentTerms": 14,
"notes": "Updated contact details"
}'

Only provided fields are updated. Unspecified fields are left unchanged.

Response

{
"success": true,
"data": {
"id": "cont_17",
"updatedAt": "2026-01-31T15:00:00Z"
}
}

Delete or deactivate a contact

DELETE /v1/contacts/:id
curl -X DELETE https://api.speybooks.com/v1/contacts/cont_17 \
-H "Authorization: Bearer sk_live_your_api_key"

Deletion rules

  • Contacts without linked invoices are deleted
  • Contacts with linked invoices are deactivated instead

Deletion is prevented to preserve accounting history.

Response (deleted)

{
"success": true,
"data": {
"deleted": true
}
}

Response (deactivated)

{
"success": true,
"data": {
"deactivated": true,
"message": "Contact deactivated (has linked invoices)"
}
}

Get contact summary

GET /v1/contacts/:id/summary

Returns contact details with a financial summary.

curl https://api.speybooks.com/v1/contacts/cont_17/summary \
-H "Authorization: Bearer sk_live_your_api_key"

Response

{
"success": true,
"data": {
"contact": {
"id": "cont_17",
"contactType": "customer",
"name": "Acme Corporation",
"company": "Acme Corp Ltd",
"email": "accounts@acme.com",
"phone": "+44 20 7123 4567",
"isActive": true
},
"summary": {
"totalInvoices": 12,
"openInvoices": 3,
"totalInvoiced": 2500000,
"outstanding": 450000
}
}
}

Summary fields

FieldTypeDescription
totalInvoicesintegerTotal invoices issued
openInvoicesintegerUnpaid invoices
totalInvoicedintegerTotal invoiced amount (minor units)
outstandingintegerOutstanding balance (minor units)

Common errors

CodeHTTPDescription
validation_error400Missing required field (e.g., name, contactType)
invalid_id400Malformed contact ID (expected cont_*)
not_found404Contact does not exist or belongs to another organisation
conflict409Email already exists for another contact

Key principles

  • Contacts are reference data, not financial records
  • Contacts with history are never destroyed
  • Deactivation preserves auditability
  • Contacts are safe to reference across the ledger

Contacts define who you do business with — transactions define what happens financially.

Amount format

All monetary values are in minor units (pence for GBP). 2500000 = £25,000.00