---
title: "Change the code or name of one of the company's material mappings"
method: PATCH
path: "/api/constants-mapping/materials/{id}"
tags: ["Constants Mapping/Materials"]
---

# Change the code or name of one of the company's material mappings

`PATCH /api/constants-mapping/materials/{id}`

## Request

- Base URL: `https://api.retraced.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.retraced.com/api/constants-mapping/materials/{id}`
- Auth: none declared

Sets the mapping's `externalId` and, when given, its `externalName` (`null` or `''` clears it), along with the product-type mapping that shares the old code. Answers 404 `constant_mapping_not_found` when the company has no such material mapping and 409 `constant_mapping_already_exists` when another of its material mappings already uses the code. `data` is the updated mapping.

## Path parameters

- `id` string, required

## Request body

- object
  - `externalId` string, required
  - `externalName` string, nullable

## Response `200`

Default Response

- object
  - `metadata` object, required
    - `success` boolean, required: True when the request succeeded.
  - `data` object, required
    - `id` string, required
    - `retracedMaterialId` string, required
    - `name` string, nullable, required
    - `externalId` string, nullable, required
    - `externalName` string, nullable, required
    - `updatedAt` union, required
      - string
      - string, date-time
    - `updatedByUserName` string, nullable, required
    - `updatedByCompanyName` string, nullable, required

## Other responses

- `400`: Default Response
- `401`: Default Response
- `403`: Default Response
- `404`: Default Response
- `409`: Default Response

## Changes

> 108 revisions in range; 2 not diffed.

- **2026-10-13** `b9cf8bef8ed3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/retraced/apis/api-reference/changes/api/constants-mapping/materials/:id/patch.md)

---

[API](https://skmtc.dev/retraced/apis/api-reference.md) - [All operations](https://skmtc.dev/retraced/apis/api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/retraced/apis/api-reference/revisions/83309c4abd20?raw)
