Skip to main content

Field Option Mutations

The Field Option API provides mutations to manage options for SELECTION and SELECTION_MULTI fields.

Update Field Option

Update an existing field option.

Mutation Structure

mutation UpdateFieldOption(
$id: String!
$color: String
$name: String
$postId: String
$postVisibility: PostVisibility
) {
updateFieldOption(
id: $id
color: $color
name: $name
postId: $postId
postVisibility: $postVisibility
) {
node {
id
color
name
postVisibility
}
}
}

Input Fields

FieldTypeDescription
idString!ID of the field option to update
colorStringNew color code for the option
nameStringNew display name for the option
postIdStringOptional post ID for option updates in post context
postVisibilityPostVisibilityNew visibility setting for posts with this option

Delete Field Option

Delete an existing field option.

Mutation Structure

mutation DeleteFieldOption($id: String!, $postId: String) {
deleteFieldOption(id: $id, postId: $postId) {
node {
id
}
}
}

Input Fields

FieldTypeDescription
idString!ID of the field option to delete
postIdStringOptional post ID for option deletion in post context

Error Handling

Authentication Errors

  • Invalid API Key: Returned when the API key is missing or invalid
  • Insufficient Permissions: Returned when the user lacks write access to the board
  • Write Access Required: Returned when using a read-only API key

Example Error Response

{
"errors": [
{
"message": "Invalid color format. Must be a valid hex color code",
"extensions": {
"code": "INVALID_INPUT",
"field": "color"
}
}
]
}

Notes

  1. Field options are typically managed through the parent field's mutations (createField and updateField).
  2. The standalone mutations above are used for individual option updates and deletions.
  3. When a field option is deleted:
    • It is removed from the parent field's options list
    • Any posts using this option will have it removed from their values
  4. The postId parameter is used when updating/deleting options in the context of a specific post to ensure proper handling of post-specific data.