---
title: "Update Field By Id"
method: PUT
path: "/fields/{id}"
tags: ["Fields"]
---

# Update Field By Id

`PUT /fields/{id}`

## Request

- Base URL: `https://api.speakai.co/v1`
- URL: `https://api.speakai.co/v1/fields/{id}`
- Auth: API key in header `x-speakai-key` and API key in header `x-access-token`

### Update Field Information

This endpoint allows you to update the information of a specific field.

#### Request Body

- `description` (string, required): The updated description of the field.

- `name` (string, required): The new name of the field.


Example:

``` json
{
 "description": "Currency Description Updated",
 "name": "New Updated Name",
 "privacyMode": "public"
}

 ```

#### Response

- `status` (string): The status of the response.

- `data` (object): An object containing the updated field information.

 - `id` (string): The ID of the field.

 - `name` (string): The name of the field.

 - `description` (string): The description of the field.

 - `type` (string): The type of the field.

 - `isActive` (boolean): Indicates if the field is active.

 - `privacyMode` (string): The privacy mode of the field.

 - `createdAt` (string): The date and time of creation.

 - `updatedAt` (string): The date and time of the last update.


Example Response:

``` json
{
 "status": "",
 "data": {
 "id": "",
 "name": "",
 "description": "",
 "type": "",
 "isActive": true,
 "privacyMode": "",
 "createdAt": "",
 "updatedAt": ""
 }
}

 ```

#### Who can update a field

Anyone in your company can update any field in it. The endpoint scopes the write to your company, not to the person who created the field.

#### Sending the id in the body

You can also send `PUT {{url}}/v1/fields` with the field id in the request body instead of the path. Both forms run the same handler. Send the id in both places and the path value wins. Send it in neither and the request returns 400.

#### Errors

- `400` when no field id reaches the endpoint, in either the path or the body.
- `404` when your company has no field with that id.
- `409` when you change `name` to one that another field in your company already uses.

## Path parameters

- `id` string, required

## Request body

- object
  - `id` string: Identify the field to update. Optional here, because the path already carries the id. Trimmed. Send it in the body when you call `PUT /fields` with no id in the path. When you send both, the path value wins.
  - `name` string, required: Set the field name. You have to send this key on every update, even when the name is not changing. Required, and an empty string is accepted. Unlike the create schema this one does not trim. When the name differs from the stored one the server checks for another field with that name in your company and returns 409 if it finds one.
  - `description` string: Set what the field is for. You can send an empty string. Optional. Empty string is accepted. Not trimmed.
  - `privacyMode` 'public' | 'private': Choose whether values for this field are visible publicly or kept private. Optional. Trimmed. The schema schema writes.allow(MediaPrivacyMode), which does not constrain the string, so the validator accepts any non-empty string. The stored record enforces the list.
  - `type` 'text' | 'url' | 'boolean' | 'date' | 'datetime' | 'number' | 'currency': Change the data type the field stores. Optional. Trimmed. Same.allow(FieldType) pattern, so the validator accepts any non-empty string and the model enforces the list.
  - `prompt` string: Give the AI an instruction for filling this field automatically. Optional. Trimmed. Empty string is accepted.
  - `allowedValues` string[]: Replace the list of values a user can pick for this field. Optional. Every item must be a string. No cap on the number of items.
  - `allowedValuesMode` 'single' | 'multiple': Choose whether a user can pick one value from allowedValues or several. Optional. Enforced by the schema with.valid(.Object.values(AllowedValuesMode)), so anything outside the list returns 400. No default on the update schema.
  - `otherValues` boolean: Allow a user to enter a value that is not in allowedValues. Optional.
  - `notApplicableValues` string: Set the text that marks this field as not applicable for a piece of media. Optional. Empty string is accepted.

## Response `200`

Success

## Other responses

- `400`: No field id was supplied in either the path or the body
- `404`: No field with that id exists in your company
- `409`: Another field in your company already uses that name

---

[API](https://skmtc.dev/speakai/apis/speak-ai-api.md) · [All operations](https://skmtc.dev/speakai/apis/speak-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/speakai/apis/speak-ai-api/revisions/52d777e6d46e?raw)
