> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open.cx/llms.txt
> Use this file to discover all available pages before exploring further.

> Set or clear Structured Field values on a contact. Use when your application records profile facts such as plan or tier on the contact, validated against the same fields sessions use.

# Set contact structured field values



## OpenAPI

````yaml put /contacts/{contact_id}/structured-field-values
openapi: 3.1.0
info:
  title: OpenCX API
  description: >

    OpenCX is an AI-powered, all-in-one platform for customer support and
    outbound communications.


    Use this API to manage your OpenCX organization's AI agents, actions,
    conversations, contacts, and more.


    To get started, generate a new API key from the dashboard.


    ## Authentication

    All API endpoints require authentication using a Bearer token. You can
    generate an API key from your OpenCX dashboard.


    ## Rate Limiting

    API requests are rate limited to ensure fair usage. The current limits are:

    - 100 requests per minute for standard endpoints

    - 1000 requests per minute for streaming endpoints


    ## Error Handling

    The API uses standard HTTP status codes and returns detailed error messages
    in the response body.
  version: 1.0-beta
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: http://localhost:8080
    description: Development
  - url: https://api.open.cx
    description: Production
security:
  - bearerAuth: []
paths:
  /contacts/{contact_id}/structured-field-values:
    put:
      summary: Set contact structured field values
      description: >-
        Upserts Structured Field values on a contact; `null` clears a field.
        Fields are the same definitions sessions use; a contact holds its own
        values. Every value is validated against its live field definition (an
        enum leaf choice, a user/team/tag of the organization, or a typed
        scalar), and a bad entry rejects the whole batch. A value on a field
        whose "show when" rule is unmet after the batch is rejected with 400;
        set the parent field in the same batch instead. Values whose field stops
        applying because a parent changed are cleared automatically. Returns the
        full current list with `applicable_field_ids`.
      operationId: setContactStructuredFieldValues
      parameters:
        - schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          in: path
          name: contact_id
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetContactStructuredFieldValuesDto'
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactStructuredFieldValueListDto'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
components:
  schemas:
    SetContactStructuredFieldValuesDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SetContactStructuredFieldValuesDtoInput'
      type: object
      properties:
        values:
          maxItems: 50
          type: array
          items:
            $ref: '#/components/schemas/ContactStructuredFieldValueInputDto'
      required:
        - values
    ContactStructuredFieldValueListDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ContactStructuredFieldValueListDto'
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/ContactStructuredFieldValueDto'
        applicable_field_ids:
          type: array
          items:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
      required:
        - data
        - applicable_field_ids
      additionalProperties: false
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    ContactStructuredFieldValueInputDto:
      $ref: '#/components/schemas/SessionStructuredFieldValueInputDto'
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ContactStructuredFieldValueInputDtoInput'
    ContactStructuredFieldValueDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/ContactStructuredFieldValueDto'
      type: object
      properties:
        org_id:
          type: string
        contact_id:
          type: string
        field_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        value:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - org_id
        - contact_id
        - field_id
        - value
        - created_at
        - updated_at
      additionalProperties: false
    SessionStructuredFieldValueInputDto:
      $schema: https://json-schema.org/draft/2020-12/schema
      $id: '#/components/schemas/SessionStructuredFieldValueInputDtoInput'
      type: object
      properties:
        field_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        value:
          anyOf:
            - type: string
              maxLength: 5000
            - type: 'null'
      required:
        - field_id
        - value
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.