> For the complete documentation index, see [llms.txt](https://api-kit.prix.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-kit.prix.im/signature/contract-update.md).

# 계약서 정보 변경 API

계약서 정보를 업데이트할 수 있는 API를 제공합니다.

계약서에 연결된 태그와 고객을 변경할 수 있는 API를 제공합니다.

<br>

## `PATCH` kit-api/v1/contracts/\[contract uuid]

Method: PATCH\
Endpoint: kit-api/v1/contracts/\[contract uuid]\
Param: contract uuid는 계약서의 식별값을 의미

<br>

## Example

```
...kit-api/v1/contracts/ed976505-bcbd-47bd-913d-f4cde05dea7a
```

```json
{
  "input": {
    "tagIds": [12345, 12346]
  }
}
```

고객 ID로 연결된 고객을 변경하는 경우

```json
{
  "input": {
    "customerIds": [101, 102]
  }
}
```

고객 커스텀 키로 연결된 고객을 변경하는 경우

```json
{
  "input": {
    "customerCustomKeys": ["CUSTOMER-001", "CUSTOMER-002"]
  }
}
```

<br>

## Request Body

| Key                      | Type         | Description             | Required |
| ------------------------ | ------------ | ----------------------- | -------- |
| input.tagIds             | number array | 연결할 계약서 태그 ID 목록        | no       |
| input.customerIds        | number array | 연결할 고객 ID 목록            | no       |
| input.customerCustomKeys | string array | 연결할 고객의 customKey 속성 목록 | no       |

* 전달한 목록으로 기존 연결이 통째로 교체됩니다. 빈 배열을 전달하면 연결이 모두 해제됩니다.
* 전달하지 않은 항목은 변경되지 않습니다.
* `customerIds`와 `customerCustomKeys`는 둘 중 하나만 전달할 수 있습니다. 함께 전달하면 요청이 실패합니다.
* 존재하지 않거나 삭제된 고객이 포함되어 있으면 요청이 실패합니다.

<br>

## Response

```json
{
  "ok": true // api 성공 시
}
```

<br>

```json
{
  "ok": false, // api 실패 시
  "message": "error message",
  "errorCode": "ERROR_CODE"
}
```

<br>
