notes:upsert
Description: Create a note or update a single note by ID or import_id.
Notes are attached to a subject (organization, household, or person) and can be used to store rich text content with a title.
When no subject is provided, the note is automatically attached to the current person identified by the incoming Arkipel message (the sender). If the sender has no person record in the target account, the note falls back to the account’s main organization.
Request Schema
{
"payload": {
"id": 1, // When set, update existing record, else create new record
"import_id": "NOTE-001", // When set, update existing record, else create new record
"type": "notes:upsert",
"title": "Meeting Notes - Project Kickoff",
"body": "<p>Discussed timeline and deliverables with the team.</p>",
"subject": {
"type": "organizations:upsert", // See payload specs for the appropriate subject type: organizations:upsert, households:upsert, people:upsert
"id": 456,
"import_id": "ORG-001",
"name": "Toucan Solutions"
},
"survey_id": 572, // Optional - attach an activity form (survey) to the note
"survey_data": { "revenus": "37500", "depenses": "12000" } // Optional - fill the attached form in the same message (requires survey_id)
},
"signature": "payload_ed25519_hex_signature",
"source_public_key": "your_client_public_key"
}
Request Attributes
Field Constraints
| Field | Type | Required | Default | Max Length | Constraints |
|---|---|---|---|---|---|
id | Integer | No | null | - | Arkipel ID. When set, updates existing record. When omitted, creates new record. |
import_id | String | Yes | Auto-generated | 255 | Your external system ID for this note. Unique per account. Auto-generated if not provided. |
title | String | Yes | null | 255 | Note title. Required. |
body | HTML | No | null | - | Note content. See HTML Content Guide |
subject | Object | No | Sender’s person / Main org | - | What this note is attached to. When omitted, defaults to the sender’s person (falls back to the account’s main organization if sender has no person). See Subject fields |
survey_id | Integer | No | null | - | Optional. Attach an activity form (survey) to the note. Must be the ID of an active form of the target account. See Activity form |
survey_data | Object | No | null | - | Optional. Answers for the form attached via survey_id — creates the note with the form filled in a single message. Requires survey_id. See Activity form
|
Special Field: import_id
The import_id field is your integration’s identifier for this note. Use it to link Arkipel records with your external system.
Characteristics:
- Required but auto-generated if not provided
- Must be unique per account
-
Your external system ID format is recommended (e.g.,
note_123,log_456,comment_789) - Used for idempotent operations and duplicate prevention
- Auto-generated format: 6 characters from
234679ACDEFGHJKMNPRTVWXYZ
Subject Fields
The subject is the entity this note is attached to (person, household, or organization). Optional — when omitted, the note attaches to the sender’s person.
| Field | Type | Required | Description |
|---|---|---|---|
type | String | Yes | Subject type: "organizations:upsert", "households:upsert", or "people:upsert"
|
id | Integer | Conditional | Arkipel subject ID (to attach to existing subject) |
import_id | String | Conditional | Your external system ID for the subject |
name | String | Conditional | Required when creating a new organization/household subject |
first_name | String | Conditional | Required when creating a new person subject |
last_name | String | Conditional | Required when creating a new person subject |
Subject lookup/creation logic:
- If
idis provided → attaches to existing Arkipel subject - If
import_idis provided → looks up by your external ID, creates if not found - If neither provided with minimal fields → creates new subject
- If
subjectis entirely omitted → attaches to the current person (the sender), or falls back to the account’s main organization if the sender has no person record
Real Life Example
Creating a Note on an Existing Organization
{
"type": "notes:upsert",
"title": "Follow-up Required",
"body": "<p>Customer requested callback next week regarding their inquiry.</p>",
"subject": {
"type": "organizations:upsert",
"id": 260926
}
}
Creating a Note with a New Household Subject
{
"type": "notes:upsert",
"import_id": "NOTE-2024-001",
"title": "Initial Contact",
"body": "<p>First meeting completed. Family interested in services.</p>",
"subject": {
"type": "households:upsert",
"name": "Smith Family",
"import_id": "HOUSE-001",
"locale": "en"
}
}
Quick Note Creation (No Subject)
When no subject is provided, the note is automatically attached to the current person (the sender identified by the incoming message). If the sender has no person record in the target account, the note falls back to the account’s main organization.
{
"type": "notes:upsert",
"title": "Thoughts of the day",
"body": "<p>Quick personal reflection without attaching to a specific entity.</p>"
}
Updating an Existing Note by Import ID
{
"type": "notes:upsert",
"import_id": "NOTE-2024-001",
"title": "Updated Meeting Notes",
"body": "<p>Follow-up completed. Services accepted.</p>"
}
Creating a Note with a Filled Activity Form
{
"type": "notes:upsert",
"import_id": "ANALYSE-2024-11",
"title": "Analyse mensuelle — novembre",
"body": "<p>Revenus et dépenses analysés lors de la rencontre.</p>",
"subject": {
"type": "households:upsert",
"import_id": "HOUSE-001"
},
"survey_id": 572,
"survey_data": {
"revenus": "37500",
"depenses": "12000"
}
}
Activity Form (survey_id / survey_data)
A note can carry an activity form (a survey, e.g. an income/expense analysis form). Use the forms:query / form:query messages to list the forms of the target account and their input keys — form.export returns id, name and inputs.
Behavior
| Payload | Effect |
|---|---|
survey_id only | Attaches the (empty) form to the note, like the web UI when creating a note |
survey_id + survey_data
| Attaches the form and submits the answers — the note is created with its form filled in a single message |
survey_data without survey_id
| Rejected (InvalidPayloadError, message failed) |
Unknown / inactive survey_id
| Rejected (message failed) |
How answers are stored
survey_data keys are the form input keys (the same keys the web form submits — e.g. revenus, depenses). Answers are persisted with the same mechanism as a web form submission: one document per note (keyed on the note’s global ID) in the survey’s response collection. The note’s survey_submitted_at timestamp is set, which marks the form as filled.
Idempotency / filling later
The persistence is an upsert keyed on the note: re-sending the same message (same import_id) with an updated survey_data replaces the stored answers — no duplicate notes, no duplicate responses. To fill a form after the note was created, re-send notes:upsert with the note’s import_id and the survey_data.
Response Schema
{
"source_public_key": "community_public_key",
"source_site": {
"protocol": "http",
"fqdn": "arkipel.localhost:3000"
},
"created_at": "2025-11-13T20:52:49Z",
"signature": "8b6392d5550605bd6ccddf9c21ebec470de4b44e4b4deb746076e37ab61c5346e07e7c7c7cebb5bbee41cdd92a476bcd3f02373d146ec165b31c31fc31c9ce0d",
"payload": {
"message_id": "6916452112f746b2b4cf48c1",
"type": "notes:upsert"
}
}