Guides
Notes API
Integrate with CreditRisk endpoints using clear request and response examples.
Notes Endpoint
Retrieve, add and update account notes for the grantors you have access to.
Endpoint Details
GET
GET
POST
PUT
/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 |
type | string | No | Filter by note type |
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 |
Response Format
Success Response (200 OK)
{
"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": "Call",
"type": "General",
"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 update only the fields supplied are changed.
| Field | Type | Required | Description |
|---|---|---|---|
account_id | integer | On create | Account the note belongs to (must be in a grantor you can access) |
note | string | On create | Note text |
activity | string | No | Activity |
type | string | No | Note type |
follow_up_date | date | No | e.g. 2024-02-01 |
follow_up_complete | integer | No | 0 or 1 |
app_invite_id, pre_legal_id, crm_id | integer | No | Optional links to related records |
sync_id | string | No | Your external reference; used to match existing notes |
active | integer | No | Default 1 on create; set 0 to deactivate |
The note's user_id is set to the authenticated user on create.
{
"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_id":123,"note":"Called customer","type":"General","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"
Error Responses
Authentication Failed (401 Unauthorized)
{
"success": false,
"error": "Authentication failed",
"message": "Invalid or expired access token"
}
Note Not Found (404)
{
"success": false,
"message": "Note not found"
}