---
title: "Edit a custom-field definition"
description: "Label/options/flags/position; type & api_name immutable."
canonical_url: "https://twominutebilling.com/help/developers/api-reference/custom-fields/edit-a-custom-field-definition"
---
# Edit a custom-field definition

> Label/options/flags/position; type & api_name immutable.

<api-operation method="PATCH" path="/v1/businesses/{biz}/custom_field_definitions/{id}">
<template v-slot:docs="">

## Path parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        biz
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      Business id (biz_…)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The custom field definition's id.
    </td>
  </tr>
</tbody>
</table>

## Headers

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        Idempotency-Key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Safely retry writes — repeats return the original response. If a write FAILED after it had already taken effect, that failure is what repeats: the key is spent, and a new attempt needs a new key.
    </td>
  </tr>
</tbody>
</table>

## Body

The request body is **required**.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The custom field definition's label.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        enum_options
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The allowed values, for an <code>
        enum
      </code>
      
       field.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        required
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Whether a value is required.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        is_pii
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Whether the field holds personal data.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        show_in_portal
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Whether the customer portal shows the field.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        position
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The field's sort position; lower numbers come first.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        archived
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      True if the field is archived.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        expected_version
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The <code>
        resource_version
      </code>
      
       you last read. The update fails with 409 if the field changed since.
    </td>
  </tr>
</tbody>
</table>

## Response

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The object type.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The custom field definition's id (cfd_…).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        entity_type
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The kind of record the field is on.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        api_name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The field's key in a record's <code>
        custom_fields
      </code>
      
       object.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cf_name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The field's key when flattened onto the record, prefixed <code>
        cf_
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The custom field definition's label.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        data_type
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The type of value the field holds.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        enum_options
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      The allowed values, for an <code>
        enum
      </code>
      
       field.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        required
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether a value is required.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        is_pii
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether the field holds personal data.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        show_in_portal
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether the customer portal shows the field.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        position
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      The field's sort position; lower numbers come first.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        archived
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      True if the field is archived.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filter_kind
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The filter kind this field compares as. Use it to pick the value control; the field is filterable as <code>
        cf_<api_name>
      </code>
      
       on that entity's list. One of <code>
        text
      </code>
      
      , <code>
        enum
      </code>
      
      , <code>
        number
      </code>
      
      , <code>
        bool
      </code>
      
      , <code>
        date
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filter_ops
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      Operators this field accepts, e.g. <code>
        is
      </code>
      
      , <code>
        in
      </code>
      
      , <code>
        between
      </code>
      
      , <code>
        in_last
      </code>
      
      . Use verbatim — widening it produces a 400 on apply.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        resource_version
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      A number that goes up on every change. Send it as <code>
        expected_version
      </code>
      
       on update.
    </td>
  </tr>
</tbody>
</table>

## Status codes

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        200
      </code>
    </td>
    
    <td>
      Success
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        400
      </code>
    </td>
    
    <td>
      Invalid body
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        404
      </code>
    </td>
    
    <td>
      No such custom field
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      resource_version conflict
    </td>
  </tr>
</tbody>
</table>
</template>

<template v-slot:request="">

```bash [Request]
curl -X PATCH "$TMBILLING_URL/v1/businesses/biz_XXXXXXXXXXXX01/custom_field_definitions/cfd_XXXXXXXXXXXX01" \
  -H "Authorization: Bearer $TMBILLING_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Region"
  }'
```

</template>

<template v-slot:response="">
<code-group>

```json [200 OK]
{
  "object": "custom_field_definition",
  "id": "cfd_XXXXXXXXXXXX01",
  "entity_type": "customer",
  "api_name": "seats",
  "cf_name": "cf_po_number",
  "label": "Region",
  "data_type": "text",
  "enum_options": [
    "Enum option"
  ],
  "required": false,
  "is_pii": false,
  "show_in_portal": false,
  "position": 0,
  "archived": false,
  "filter_kind": "text",
  "filter_ops": [
    "Filter op"
  ],
  "resource_version": 1
}
```

```json [400 Bad Request]
{
  "error": {
    "type": "invalid_request_error",
    "message": "Invalid body"
  }
}
```

```json [404 Not Found]
{
  "error": {
    "type": "invalid_request_error",
    "message": "No such custom field"
  }
}
```

```json [409 Conflict]
{
  "error": {
    "type": "conflict_error",
    "message": "resource_version conflict"
  }
}
```

</code-group>
</template>
</api-operation>


## Sitemap

See the full [sitemap](https://twominutebilling.com/sitemap.md) for all pages.
