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 /api/notes
GET /api/notes/{id} — a single note
POST /api/notes — add a note
PUT /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_tokenstringYesYour API access token
grantor_idintegerNoLimit to one grantor (default: all grantors the user can access)
account_idintegerNoOnly notes for this account
typestringNoFilter by note type
follow_up_completeintegerNo0 or 1
sync_idstringNoFilter by the note's sync ID
activeintegerNoDefault 1. Use 0 for inactive notes
pageintegerNoPage number (default: 1, 100 per page)
pagingintegerNoSet 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.

FieldTypeRequiredDescription
account_idintegerOn createAccount the note belongs to (must be in a grantor you can access)
notestringOn createNote text
activitystringNoActivity
typestringNoNote type
follow_up_datedateNoe.g. 2024-02-01
follow_up_completeintegerNo0 or 1
app_invite_id, pre_legal_id, crm_idintegerNoOptional links to related records
sync_idstringNoYour external reference; used to match existing notes
activeintegerNoDefault 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"
}