🔐 Required role:
TM_CODE_C📖 Data dictionary: Time-management code
Create or update operational codes (upsert)
Operational codes classify non-client operational time.
Every record is saved with type OperationalCode, so records carry no type. Maximum 100 records per request.
A record updates the code its systemRef names: the same system and reference, the code with that Aiwyn ID when system is aiwyn, or else the code whose pmsRef is the reference. Without a systemRef, it updates the code whose pmsRef is attributes.pmsRef. When nothing matches, a new code is created. Attributes left out of an update keep their values. A record with any field other than systemRef and attributes is rejected with 400. Some older operational codes appear in the lookup but aren't matched here, so sending one creates a new operational code.
| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
pmsRef | string | No | generated | Reference in your practice management system. |
code | string | Yes | — | Code value that operational entries reference. |
display | string | Yes | — | Name shown in Aiwyn. |
description | string | No | — | Longer description. |
active | boolean | No | true | false deactivates the code. |
Custom fields your firm defines for OperationalCode are accepted too; list them with GET /api/v1/codes/schema/OperationalCode.
Each record succeeds or fails on its own: 200, 207 or 422 say whether all, some or none succeeded — see Batch writes: per-record results.
- Sandbox (requires Cloudflare Access headers)https://api.sandbox.aiwyn.app/api/v1/operational-codes
- Staging (requires Cloudflare Access headers)https://api.staging.aiwyn.app/api/v1/operational-codes
- Production (your live firm data; no Cloudflare Access headers)https://api.aiwyn.ai/api/v1/operational-codes
curl -i -X POST \
https://api.sandbox.aiwyn.app/api/v1/operational-codes \
-H 'Authorization: Bearer <YOUR_JWT_HERE>' \
-H 'CF-Access-Client-Id: YOUR_API_KEY_HERE' \
-H 'CF-Access-Client-Secret: YOUR_API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"records": [
{
"systemRef": {
"system": "PM",
"reference": "TRAINING"
},
"attributes": {
"pmsRef": "TRAINING",
"code": "TRAINING",
"display": "Internal training",
"active": true
}
}
]
}'{ "data": { "summary": {}, "records": [ … ] }, "error": {}, "meta": { "success": true, "message": "string", "timestamp": "2019-08-24T14:15:22Z", "version": "string" } }