Skip to content

updateContentFieldValue

The updateContentFieldValue function updates a single field of an existing content entry. It is the JavaScript/TypeScript counterpart of the PUT /content/:id REST endpoint.

There are two ways to identify the target field: by field name + language (recommended) or by field value id (deprecated).

Example:

// Recommended: identify the field by name + language
await client.updateContentFieldValue(contentId, { fieldName: 'title', language: 'en' }, 'Hello world (updated)');

Interface

export type FieldSelector = { fieldName: string; language: string };
export interface ApiClient {
// Recommended overload
updateContentFieldValue(contentId: string, selector: FieldSelector, value: unknown): Promise<boolean>;
// Deprecated overload — pass a FieldSelector instead
updateContentFieldValue(contentId: string, fieldValueId: string, value: unknown): Promise<boolean>;
// ... other methods
}

Parameters

NameDescription
contentIdThe ID of the content entry to update. You can find it in your project’s Content tab, either in the list or in the content details.
selectorEither a FieldSelector object ({ fieldName, language }, recommended) or a string with the field value id (deprecated).
valueThe new value for the field. The expected type depends on the field’s type in the model.
await client.updateContentFieldValue(
'660f5b8a3a1c2d4e7f8b9012',
{ fieldName: 'title', language: 'en' },
'Hello world (updated)'
);
PropertyDescription
fieldNameThe name of the field as defined in the model (e.g. 'title').
languageThe language of the value being updated. Must be one of the languages enabled on the project.

Update by field value id (deprecated)

// Deprecated
await client.updateContentFieldValue('660f5b8a3a1c2d4e7f8b9012', 'fieldValueId-1234', 'Hello world (updated)');

Output

The function returns a Promise<boolean> indicating whether the update succeeded.

const ok = await client.updateContentFieldValue(
contentId,
{ fieldName: 'title', language: 'en' },
'Hello world (updated)'
);
// ok → true

Updating a field value automatically advances the content’s status (for example from published to pending changes), so the change needs to be published before read-token consumers can see it.