# Sets the custom fields for the task template.

POST https://api.awork.com/api/v1/tasktemplates/{taskTemplateId}/setcustomfields

Sets the custom fields for the task template. The required properties depend on the type of the custom field. Only task templates which are linked to a project template may have custom fields set.

<Check title="Required Permissions" icon="key">The user must be an admin or have `project-manage-config:write` permissions.</Check>

## Request example

```sh
curl -X POST --globoff 'https://api.awork.com/api/v1/tasktemplates/{taskTemplateId}/setcustomfields' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  --data '[
  {
    "customFieldDefinitionId": "123e4567-e89b-12d3-a456-426614174000",
    "userIdValue": "123e4567-e89b-12d3-a456-426614174000",
    "clientIdValue": "123e4567-e89b-12d3-a456-426614174000",
    "numberValue": 123.45,
    "selectionOptionIdValue": "123e4567-e89b-12d3-a456-426614174000",
    "textValue": "A custom logo",
    "dateValue": "2022-03-10T16:30:26.100Z",
    "booleanValue": true
  }
]'
```

- path parameter `taskTemplateId`: string (required). The id of the task template to set custom fields for.

## Request body (application/json)

- `customFieldDefinitionId`: string (required)

- `userIdValue`: string or null

- `clientIdValue`: string or null

- `numberValue`: number or null

- `selectionOptionIdValue`: string or null

- `textValue`: string or null

- `dateValue`: string or null

- `booleanValue`: boolean or null

## Response 204

No Content

## Response 400

Bad Request

application/json

```json
{
  "code": "not-found",
  "description": "There is no matching path for this URL.",
  "link": "https://developers.awork.com",
  "details": [
    "No project with the id '123' exists."
  ],
  "validationErrors": [
    {
      "property": "FirstName",
      "message": "FirstName is required."
    }
  ],
  "traceId": "a65ce5745df02af216715ff06661fb3a"
}
```

## Response 404

Not Found

application/json

```json
{
  "code": "not-found",
  "description": "There is no matching path for this URL.",
  "link": "https://developers.awork.com",
  "details": [
    "No project with the id '123' exists."
  ],
  "validationErrors": [
    {
      "property": "FirstName",
      "message": "FirstName is required."
    }
  ],
  "traceId": "a65ce5745df02af216715ff06661fb3a"
}
```
