> ## Documentation Index
> Fetch the complete documentation index at: https://alliancebioversityciat-alliance-risk-analysis-tool.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update assessment

Update an existing assessment. Supports optimistic locking via version number.

## Path parameters

**id** `string` *required*

Assessment ID (UUID).

## Request body

All fields are optional. Only provided fields will be updated.

**name** `string`

Assessment name or identifier.

Maximum length: 200 characters.

**companyName** `string`

Name of the company being assessed.

Maximum length: 200 characters.

**companyType** `string`

Type or category of company.

Maximum length: 100 characters.

**status** `string`

Update the assessment status.

Allowed values: `DRAFT`, `ANALYZING`, `ACTION_REQUIRED`, `COMPLETE`

**progress** `number`

Update completion percentage.

Range: 0-100

**version** `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.

**id** `string`

Unique assessment identifier (UUID).

**name** `string`

Assessment name.

**companyName** `string`

Company name.

**companyType** `string`

Company type.

**country** `string`

Country of operation.

**status** `string`

Current status: `DRAFT`, `ANALYZING`, `ACTION_REQUIRED`, or `COMPLETE`

**intakeMode** `string`

Data collection method: `UPLOAD`, `GUIDED_INTERVIEW`, or `MANUAL_ENTRY`

**progress** `number`

Completion percentage (0-100).

**version** `number`

Version number (incremented on each update).

**overallRiskScore** `number`

Aggregated risk score (0-100). Null until complete.

**overallRiskLevel** `string`

Risk classification: `LOW`, `MODERATE`, `HIGH`, or `CRITICAL`. Null until complete.

**userId** `string`

Creator user ID.

**createdAt** `string`

ISO 8601 creation timestamp.

**updatedAt** `string`

ISO 8601 last update timestamp.

```bash cURL theme={null}
# 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
  }'
```

```javascript JavaScript theme={null}
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
}
```

```python Python theme={null}
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"]}')
```

```json 200 Response theme={null}
{
  "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"
}
```

```json 404 Not Found theme={null}
{
  "statusCode": 404,
  "message": "Assessment not found",
  "error": "Not Found"
}
```

```json 409 Conflict theme={null}
{
  "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.

> [!TIP]
>
> Omitting the `version` field disables optimistic locking. The update will always succeed (unless the assessment doesn't exist), but you risk overwriting concurrent changes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.