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

> Update the sample details of a target material

Updates the sample-level details of a target material. All body fields are optional; only the fields you send are changed.

<ParamField path="target_material_id" type="integer" required>
  ID of the target material to update
</ParamField>

<ParamField body="sample_name" type="string">
  New name for the target material sample
</ParamField>

<ParamField body="substrate" type="string">
  New substrate the layers are grown on
</ParamField>

<ParamField body="sample_id" type="integer">
  Reassign the target material to a different sample
</ParamField>

<ParamField body="sample_metadata" type="object">
  Replacement metadata for the sample
</ParamField>

## Response

<ResponseField name="sample_id" type="integer">
  ID of the target material sample
</ResponseField>

<ResponseField name="sample_name" type="string">
  Name of the target material sample
</ResponseField>

<ResponseField name="substrate" type="string">
  Substrate the layers are grown on
</ResponseField>

<ResponseField name="sample_metadata" type="object">
  Metadata attached to the sample
</ResponseField>

<ResponseField name="detail_notes_id" type="string">
  ID of the linked detail note, if any
</ResponseField>

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

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

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

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.atomscale.ai/target-materials/42" \
    -H "X-API-KEY: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "sample_name": "BaTiO3 on Si (revised)"
    }'
  ```

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

  response = requests.patch(
      "https://api.atomscale.ai/target-materials/42",
      headers={
          "X-API-KEY": "YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "sample_name": "BaTiO3 on Si (revised)"
      }
  )
  target_material = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "sample_id": 42,
    "sample_name": "BaTiO3 on Si (revised)",
    "substrate": "Si",
    "sample_metadata": {},
    "detail_notes_id": null,
    "user_id": "user_abc123",
    "version": "0.269.1",
    "last_updated": "2024-01-15T12:00:00Z"
  }
  ```
</ResponseExample>
