Business Partners
Business partners are the companies and people that you work with. They can be your suppliers, customers, employees, owners or any other person/company that you interact with. Business partners are one of the most important resources in Snapbooks, and are used in journal entries, invoices, credit notes, payment lists and more.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /business-partners | List business partners |
| POST | /business-partners | Create a business partner |
| GET | /business-partners/{id} | Get a business partner |
| POST/PUT | /business-partners/{id} | Update a business partner |
| DELETE | /business-partners/{id} | Deactivate a business partner |
Query Parameters
The GET /business-partners endpoint supports the following query parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| client_account_id | integer | Yes | Filter by client account ID. Must be one of the user’s eligible client accounts |
| is_organization | boolean | No | Filter by organization status |
| organization_id | integer | No | Filter by organization ID |
| user_id | integer | No | Filter by user ID |
| is_active | boolean | No | Filter by active status (default: true) |
| free_text | string | No | Search in business partner fields |
| page | integer | No | Page number for pagination (default: 1) |
| per_page | integer | No | Number of items per page (default: 100) |
| with | string | No | Include related resources (supported: organization, user, bank_accounts, sending_methods, statistics) |
Attributes
| Attribute | Type | Description |
|---|---|---|
| id | integer | The ID of the business partner |
| created_at | datetime | The date and time when the business partner was created |
| created_by_id | integer | The ID of the user that created the business partner |
| updated_at | datetime | The date and time when the business partner was last updated |
| updated_by_id | integer | The ID of the user that last updated the business partner |
| client_account_id | integer | The ID of the client account this partner belongs to |
| sequence_number | integer | The sequence number of the business partner |
| name | string | The name of the business partner |
| is_organization | boolean | Whether the business partner is an organization or not |
| organization_id | integer | The organization ID of the business partner |
| organization_number | string | The organization number of the business partner |
| ssn | string | The social security number (fødselsnummer) of the business partner |
| user_id | integer | The user this partner stands for, if any. Only an active person partner can stand for a user, and a user has at most one per client account: linking a user moves their link from the partner they had, and deactivating a partner unlinks it. A partner that stands for another user must be unlinked before it is linked to someone else, and a linked partner can’t move to another client account. You can link a partner to yourself or unlink your own; owners and accountants of the client account can also link its other users. |
| address | string | The address of the business partner |
| zip | string | The zip code of the business partner |
| city | string | The city of the business partner |
| state | string | The state of the business partner |
| country | string | The country code of the business partner |
| string | The email address of the business partner | |
| phone | string | The phone number of the business partner |
| is_active | boolean | Whether the business partner is active or not |
| autonomy_level | string or null | Per-entity autonomy override. Values: NONE, DRAFT, FULL, or null (inherit from client account settings) |
Relationships
| Relationship | Type | Description |
|---|---|---|
| organization | Organization | The organization of the business partner |
| user | User | The associated user account |
| bank_accounts | BankAccount | The bank accounts of the business partner |
| sending_methods | object | Available sending methods per document type. Keyed by document type (ARINV, ARCRN), each an array of {method, value} objects. method is email or peppol |
| statistics | object | Statistical information about the business partner — see below |
Statistics Object
| Field | Type | Description |
|---|---|---|
| is_customer | boolean | Whether the partner has receivable activity (AR invoices/credit notes or account 1500 postings) |
| is_supplier | boolean | Whether the partner has payable activity (AP invoices/credit notes/receipts or account 2400 postings) |
| is_employee | boolean | Whether the partner has an active employment contract or payroll postings (accounts 2910, 2930) |
| is_owner | boolean | Whether the partner has equity postings (accounts 2255, 2915) |
| balances | array | Non-zero journal entry balances per account: {account_code, balance} |
| receivable_credit_days | number or null | Median days between document date and due date for AR invoices |
| payable_credit_days | number or null | Median days between document date and due date for AP invoices |
Example Response
{
"id": 1,
"created_at": "2023-05-10T12:00:00Z",
"created_by_id": 1,
"updated_at": "2023-05-10T12:00:00Z",
"updated_by_id": 1,
"client_account_id": 1,
"sequence_number": 1001,
"name": "John Doe",
"is_organization": false,
"organization_id": 1245,
"organization_number": "123456789",
"ssn": null,
"user_id": null,
"address": "Street 1",
"zip": "1234",
"city": "City",
"state": "State",
"country": "NO",
"email": "john@doe.com",
"phone": "+4712345678",
"is_active": true,
"autonomy_level": null,
"organization": {
"id": 1245,
"name": "ACME Corp"
},
"user": null,
"bank_accounts": [
{
"id": 1,
"account_number": "12345678901"
}
],
"sending_methods": {
"ARINV": [
{"method": "email", "value": "john@doe.com"},
{"method": "peppol", "value": "0192:123456789"}
],
"ARCRN": [
{"method": "email", "value": "john@doe.com"}
]
},
"statistics": {
"is_customer": true,
"is_supplier": false,
"is_employee": false,
"is_owner": false,
"balances": [
{"account_code": "1500", "balance": 1250.00}
],
"receivable_credit_days": 14,
"payable_credit_days": null
}
}
Deactivation Validation
When attempting to deactivate a business partner using the DELETE endpoint, the system performs validation to ensure data integrity:
- Balance Checking: The system checks if any accounting accounts with mandatory business partner dimensions have non-zero balances for this specific business partner.
- Validation Failure: If any accounts have non-zero balances, the deactivation is denied with a 400 Bad Request error.
- Error Details: The error message includes specific account codes and their balances to help identify which transactions need to be resolved.
Example Error Response
{
"error": {
"code": "common.validation_error",
"message": "Cannot deactivate business partner: account 1500: 1250.00, account 2400: -500.00",
"request_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
}
}
This validation ensures that business partners cannot be deactivated while they still have outstanding balances, maintaining the integrity of your accounting records.
Error Responses
| Status Code | Description |
|---|---|
| 400 | Invalid request parameters, deactivation blocked by non-zero account balances, or the SSN is already used by another active business partner |
| 403 | User not authorized to access this business partner |
| 404 | Business partner not found |
| 409 | Duplicate business partner — same organization already exists on this client account, or same name/country combination already exists |
Example Duplicate Error Response
{
"error": {
"code": "businesspartner.duplicate",
"message": "Duplicate business partner: John Doe (NO)",
"request_id": "a1b2c3d4-5678-90ab-cdef-1234567890ab"
}
}
Notes
- The client_account_id must be one of the eligible client accounts for the authenticated user.
- When creating or updating a business partner, the created_by_id/updated_by_id is automatically set to the authenticated user’s ID.
- Relationships can be included by specifying them in the
withparameter. - The sequence_number is automatically assigned when creating a new business partner.
- The statistics and sending_methods relationships provide additional information about the partner’s activity and communication preferences.
- All dates are returned in ISO 8601 format.
- The DELETE endpoint deactivates the business partner (sets is_active to false) rather than permanently deleting the record.