> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atomscale.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Update OES Peak Assignment

> Manually reassign an OES emission peak to a candidate element

Applies a manual peak assignment override to the latest OES result. Each detected peak carries a set of candidate element assignments; this endpoint selects one of those candidates for a given peak and persists the override so it survives reprocessing.

<ParamField path="data_id" type="string" required>
  The data entry UUID for the OES measurement
</ParamField>

<ParamField body="peak_id" type="string" required>
  The `peak_id` of the detected peak to reassign
</ParamField>

<ParamField body="candidate_key" type="string" required>
  The candidate assignment to apply to the peak. Must be one of the candidate keys available on that peak.
</ParamField>

## Response

Returns the updated OES result with the new assignment applied. The response has the same shape as the [Get OES Data](/api-reference/oes/get) response.

<RequestExample>
  ```python Python theme={null}
  import requests

  response = requests.patch(
      "https://api.atomscale.ai/oes/d290f1ee-6c54-4b01-90e6-d701748f0851/peaks",
      headers={
          "X-API-KEY": "YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "peak_id": "p1",
          "candidate_key": "Ga_417.2"
      }
  )
  oes_data = response.json()
  ```

  ```bash cURL theme={null}
  curl -X PATCH "https://api.atomscale.ai/oes/d290f1ee-6c54-4b01-90e6-d701748f0851/peaks" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "peak_id": "p1",
      "candidate_key": "Ga_417.2"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data_id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "id": "oes_001",
    "wavelengths": [400.0, 400.5, 401.0, 401.5],
    "wavelength_unit": "nm",
    "sample": [1200, 1350, 4100, 1280],
    "scope_corrected": [1150, 1298, 4049, 1231],
    "spectrum_type": "sample",
    "detected_peaks": [
      {"peak_id": "p1", "wavelength_nm": 401.0, "element": "Ga", "manual": true}
    ],
    "constraint_mode": "auto",
    "constrained_elements": null,
    "last_updated": "2024-01-15T10:40:00Z"
  }
  ```
</ResponseExample>
