> ## 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 Sample Target Material

> Set or clear the target material for a physical sample

Assigns a target material to a physical sample. The `target_material_id` key is required in the body: pass an integer to set the material, or `null` to clear it.

<ParamField path="physical_sample_id" type="string" required>
  UUID of the physical sample
</ParamField>

<ParamField body="target_material_id" type="integer" required>
  ID of the target material to associate with the sample. Pass `null` to remove the current target material.
</ParamField>

## Response

<ResponseField name="id" type="string">
  Physical sample UUID
</ResponseField>

<ResponseField name="name" type="string">
  Sample name
</ResponseField>

<ResponseField name="created_datetime" type="string">
  ISO 8601 timestamp of creation
</ResponseField>

<ResponseField name="last_updated" type="string">
  ISO 8601 timestamp of last update
</ResponseField>

<ResponseField name="version" type="string">
  Version string of the sample record
</ResponseField>

<ResponseField name="user_id" type="string">
  ID of the user who owns the sample
</ResponseField>

<ResponseField name="growth_instrument_id" type="integer">
  Growth instrument ID, or `null` if not set
</ResponseField>

<ResponseField name="sample_id" type="integer">
  Numeric sample identifier, or `null` if not set
</ResponseField>

<ResponseField name="detail_notes_id" type="string">
  UUID of the linked detail note, or `null` if not set
</ResponseField>

<ResponseField name="physical_sample_metadata" type="object">
  Key-value metadata for the sample
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.atomscale.ai/physical_samples/a1b2c3d4-5678-90ab-cdef-1234567890ab/target_material" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "target_material_id": 7
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.patch(
      "https://api.atomscale.ai/physical_samples/a1b2c3d4-5678-90ab-cdef-1234567890ab/target_material",
      headers={
          "X-API-KEY": "YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "target_material_id": 7
      }
  )
  sample = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
    "name": "GaAs-003",
    "created_datetime": "2024-01-15T11:00:00Z",
    "last_updated": "2024-01-16T09:30:00Z",
    "version": "0.269.1",
    "user_id": "user_abc123",
    "growth_instrument_id": null,
    "sample_id": null,
    "detail_notes_id": null,
    "physical_sample_metadata": {}
  }
  ```
</ResponseExample>
