# Simple update without version check
curl -X PUT https://api.example.com/api/assessments/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Assessment Name",
"progress": 50
}'
# Update with optimistic locking
curl -X PUT https://api.example.com/api/assessments/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "COMPLETE",
"progress": 100,
"version": 3
}'
const assessmentId = '550e8400-e29b-41d4-a716-446655440000';
// Update with optimistic locking
const response = await fetch(
`https://api.example.com/api/assessments/${assessmentId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: 'COMPLETE',
progress: 100,
version: 3 // Current version from GET request
})
}
);
if (response.status === 409) {
// Conflict - assessment was modified by another user
console.error('Assessment was updated by another user. Please refresh.');
} else {
const updated = await response.json();
console.log('New version:', updated.version); // Will be 4
}
import requests
assessment_id = '550e8400-e29b-41d4-a716-446655440000'
# Update with optimistic locking
response = requests.put(
f'https://api.example.com/api/assessments/{assessment_id}',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
json={
'status': 'COMPLETE',
'progress': 100,
'version': 3 # Current version from GET request
}
)
if response.status_code == 409:
# Conflict - assessment was modified
print('Please refresh and try again')
else:
updated = response.json()
print(f'New version: {updated["version"]}')
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Updated Assessment Name",
"companyName": "Acme Coffee Cooperative",
"companyType": "Cooperative",
"country": "Kenya",
"status": "COMPLETE",
"intakeMode": "UPLOAD",
"progress": 100,
"version": 4,
"overallRiskScore": 38.5,
"overallRiskLevel": "MODERATE",
"userId": "auth0|123456789",
"createdAt": "2026-03-04T10:30:00.000Z",
"updatedAt": "2026-03-04T14:20:00.000Z"
}
{
"statusCode": 404,
"message": "Assessment not found",
"error": "Not Found"
}
{
"statusCode": 409,
"message": "Assessment was modified by another user. Please refresh and try again.",
"error": "Conflict"
}
Assessments
Update assessment
PUT
/
api
/
assessments
/
:id
# Simple update without version check
curl -X PUT https://api.example.com/api/assessments/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Assessment Name",
"progress": 50
}'
# Update with optimistic locking
curl -X PUT https://api.example.com/api/assessments/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "COMPLETE",
"progress": 100,
"version": 3
}'
const assessmentId = '550e8400-e29b-41d4-a716-446655440000';
// Update with optimistic locking
const response = await fetch(
`https://api.example.com/api/assessments/${assessmentId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: 'COMPLETE',
progress: 100,
version: 3 // Current version from GET request
})
}
);
if (response.status === 409) {
// Conflict - assessment was modified by another user
console.error('Assessment was updated by another user. Please refresh.');
} else {
const updated = await response.json();
console.log('New version:', updated.version); // Will be 4
}
import requests
assessment_id = '550e8400-e29b-41d4-a716-446655440000'
# Update with optimistic locking
response = requests.put(
f'https://api.example.com/api/assessments/{assessment_id}',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
json={
'status': 'COMPLETE',
'progress': 100,
'version': 3 # Current version from GET request
}
)
if response.status_code == 409:
# Conflict - assessment was modified
print('Please refresh and try again')
else:
updated = response.json()
print(f'New version: {updated["version"]}')
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Updated Assessment Name",
"companyName": "Acme Coffee Cooperative",
"companyType": "Cooperative",
"country": "Kenya",
"status": "COMPLETE",
"intakeMode": "UPLOAD",
"progress": 100,
"version": 4,
"overallRiskScore": 38.5,
"overallRiskLevel": "MODERATE",
"userId": "auth0|123456789",
"createdAt": "2026-03-04T10:30:00.000Z",
"updatedAt": "2026-03-04T14:20:00.000Z"
}
{
"statusCode": 404,
"message": "Assessment not found",
"error": "Not Found"
}
{
"statusCode": 409,
"message": "Assessment was modified by another user. Please refresh and try again.",
"error": "Conflict"
}
Update an existing assessment. Supports optimistic locking via version number.
Path parameters
string
required
Assessment ID (UUID).
Request body
All fields are optional. Only provided fields will be updated.string
Assessment name or identifier.Maximum length: 200 characters.
string
Name of the company being assessed.Maximum length: 200 characters.
string
Type or category of company.Maximum length: 100 characters.
string
Update the assessment status.Allowed values:
DRAFT, ANALYZING, ACTION_REQUIRED, COMPLETEnumber
Update completion percentage.Range: 0-100
number
Current version number for optimistic locking.If provided, the update will only succeed if the current database version matches this value. This prevents concurrent updates from overwriting each other. If the version doesn’t match, a 409 Conflict error is returned.The version is automatically incremented on each update.
Response
Returns the updated assessment object with all fields.string
Unique assessment identifier (UUID).
string
Assessment name.
string
Company name.
string
Company type.
string
Country of operation.
string
Current status:
DRAFT, ANALYZING, ACTION_REQUIRED, or COMPLETEstring
Data collection method:
UPLOAD, GUIDED_INTERVIEW, or MANUAL_ENTRYnumber
Completion percentage (0-100).
number
Version number (incremented on each update).
number
Aggregated risk score (0-100). Null until complete.
string
Risk classification:
LOW, MODERATE, HIGH, or CRITICAL. Null until complete.string
Creator user ID.
string
ISO 8601 creation timestamp.
string
ISO 8601 last update timestamp.
# Simple update without version check
curl -X PUT https://api.example.com/api/assessments/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Assessment Name",
"progress": 50
}'
# Update with optimistic locking
curl -X PUT https://api.example.com/api/assessments/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "COMPLETE",
"progress": 100,
"version": 3
}'
const assessmentId = '550e8400-e29b-41d4-a716-446655440000';
// Update with optimistic locking
const response = await fetch(
`https://api.example.com/api/assessments/${assessmentId}`,
{
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: 'COMPLETE',
progress: 100,
version: 3 // Current version from GET request
})
}
);
if (response.status === 409) {
// Conflict - assessment was modified by another user
console.error('Assessment was updated by another user. Please refresh.');
} else {
const updated = await response.json();
console.log('New version:', updated.version); // Will be 4
}
import requests
assessment_id = '550e8400-e29b-41d4-a716-446655440000'
# Update with optimistic locking
response = requests.put(
f'https://api.example.com/api/assessments/{assessment_id}',
headers={'Authorization': 'Bearer YOUR_TOKEN'},
json={
'status': 'COMPLETE',
'progress': 100,
'version': 3 # Current version from GET request
}
)
if response.status_code == 409:
# Conflict - assessment was modified
print('Please refresh and try again')
else:
updated = response.json()
print(f'New version: {updated["version"]}')
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Updated Assessment Name",
"companyName": "Acme Coffee Cooperative",
"companyType": "Cooperative",
"country": "Kenya",
"status": "COMPLETE",
"intakeMode": "UPLOAD",
"progress": 100,
"version": 4,
"overallRiskScore": 38.5,
"overallRiskLevel": "MODERATE",
"userId": "auth0|123456789",
"createdAt": "2026-03-04T10:30:00.000Z",
"updatedAt": "2026-03-04T14:20:00.000Z"
}
{
"statusCode": 404,
"message": "Assessment not found",
"error": "Not Found"
}
{
"statusCode": 409,
"message": "Assessment was modified by another user. Please refresh and try again.",
"error": "Conflict"
}
Optimistic locking workflow
To prevent concurrent updates from conflicting:1
Fetch current assessment
GET the assessment to retrieve the current
version number.2
Make changes
Modify the assessment data in your application.
3
Submit update with version
Include the
version field in your PUT request body.4
Handle conflicts
If you receive a 409 Conflict response, refresh the assessment data and ask the user to re-apply their changes.
Omitting the
version field disables optimistic locking. The update will always succeed (unless the assessment doesn’t exist), but you risk overwriting concurrent changes.⌘I