Notes API
Integrate with CreditRisk endpoints using clear request and response examples.
Notes Endpoint
Endpoint Details
/api/notesGET
/api/notes/{id} — a single notePOST
/api/notes — add a notePUT
/api/notes/{id} — update a note
Authentication Required
- API Token: Required in URL parameter
?api_token=xxx - User Token: Required in Authorization header
Authorization: Bearer xxx
Only notes linked to an account of a grantor the user has access to are returned.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_token | string | Yes | Your API access token |
grantor_id | integer | No | Limit to one grantor (default: all grantors the user can access) |
account_id | integer | No | Only notes for this account |
account_sync_id | string | No | Only notes for accounts with this external account sync ID; distinct from the note's sync_id |
follow_up_complete | integer | No | 0 or 1 |
sync_id | string | No | Filter by the note's sync ID |
active | integer | No | Default 1. Use 0 for inactive notes |
page | integer | No | Page number (default: 1, 100 per page) |
paging | integer | No | Set to 0 to disable pagination and get all results |
Filtering by type is not supported; supplying it as a query parameter returns HTTP 400.
Response Format
{
"success": true,
"message": "Notes retrieved successfully",
"data": {
"notes": [
{
"id": 1,
"account_id": 123,
"account_sync_id": "a1b2c3",
"grantor_id": 5,
"app_invite_id": null,
"pre_legal_id": null,
"crm_id": null,
"user_id": 7,
"note": "Called customer about overdue invoice",
"activity": "Phone",
"type": "account-note",
"follow_up_date": "2024-02-01",
"follow_up_complete": 0,
"active": 1,
"sync_id": "n-456",
"import_id": null,
"created_at": "2024-01-15 10:00:00",
"updated_at": "2024-01-15 10:00:00"
}
],
"pagination": {
"current_page": 1,
"per_page": 100,
"total_results": 1,
"total_pages": 1,
"has_previous": false,
"has_next": false,
"previous_page": null,
"next_page": null
}
}
}
GET /api/notes/{id} returns data.note instead of data.notes.
Add or Update a Note
Send a JSON body. POST adds a note; if the body contains an id or a sync_id that matches an existing note, that note is updated instead (upsert). PUT only updates and returns 404 if the note does not exist. The id can be in the path (/api/notes/{id}) or in the body. On create and update, the server always sets type to account-note; any supplied value is ignored.
| Field | Type | Required | Description |
|---|---|---|---|
account_id | integer | On create, unless account_sync_id is supplied | Account the note belongs to (must be in a grantor you can access) |
account_sync_id | string | On create, unless account_id is supplied | External account reference used to find the account. Distinct from the note's sync_id. |
note | string | On create | Note text |
activity | string or null | No | Phone, Email, Meeting or null. The string "null" is also treated as null. Defaults to null on create; unchanged on update if omitted. |
follow_up_date | date | No | e.g. 2024-02-01 |
follow_up_complete | integer | No | 0 or 1 |
pre_legal_id | integer | No | Optional link to a related record |
sync_id | string | No | Your external reference; used to match existing notes |
active | integer | No | Default 1 on create; set 0 to deactivate |
On update, either account reference can be supplied to change the linked account. If both are supplied, they must identify the same accessible account. An unknown or inaccessible account returns HTTP 404; if an external account reference matches multiple accessible accounts, the API returns HTTP 409 and requires account_id to disambiguate.
The note's user_id is set to the authenticated API user on create and update, replacing the previous value on update. Any supplied user_id is ignored. crm_id and app_invite_id cannot be supplied on create or update, even as null; they remain available in GET responses. Invalid activity values and restricted fields return HTTP 400.
{
"success": true,
"message": "Note created successfully",
"data": { "id": 42, "status": "created" }
}
Add a Note
curl -X POST "https://api.creditrisk.co.za/api/notes?api_token=your_token" \
-H "Authorization: Bearer your_user_token" -H "Content-Type: application/json" \
-d '{"account_sync_id":"ACC-001","note":"Called customer","activity":"Phone","follow_up_date":"2024-02-01"}'
Update a Note
curl -X PUT "https://api.creditrisk.co.za/api/notes/42?api_token=your_token" \
-H "Authorization: Bearer your_user_token" -H "Content-Type: application/json" \
-d '{"follow_up_complete":1}'
Examples
All Notes
curl -X GET "https://api.creditrisk.co.za/api/notes?api_token=your_token" \
-H "Authorization: Bearer your_user_token"
Notes for an Account
curl -X GET "https://api.creditrisk.co.za/api/notes?api_token=your_token&account_id=123" \
-H "Authorization: Bearer your_user_token"
Notes for an External Account Reference
curl -X GET "https://api.creditrisk.co.za/api/notes?api_token=your_token&account_sync_id=ACC-001" \
-H "Authorization: ******"
Error Responses
{
"success": false,
"error": "Authentication failed",
"message": "Invalid or expired access token"
}
{
"success": false,
"message": "Note not found"
}