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

# Subscriber Assign Custom Fields

> Set one or more custom field values on a subscriber via the ChatSyncs API, using a JSON object of field name/value pairs. Use when a developer asks how to sync CRM data into a subscriber's custom fields.

Sets custom field values on a subscriber. See
[Subscriber Manager's Custom Fields](/learn/whatsapp-subscriber-manager#custom-fields) for what
a custom field is and the available types (Text, Number, Date, Email, Phone).

## The `custom_fields` JSON format

`custom_fields` is a single JSON object — each **key** is an existing custom field's name, and
each **value** is what you want to set it to, matching that field's type:

```json theme={null}
{
  "city": "Bangalore",
  "plan_type": "Premium",
  "age": 28,
  "date_of_birth": "1998-05-20",
  "email": "rahul@example.com",
  "phone": "919999999999"
}
```

| Field type | Example key       | Example value                           |
| ---------- | ----------------- | --------------------------------------- |
| Text       | `"city"`          | `"Bangalore"`                           |
| Number     | `"age"`           | `28` (no quotes)                        |
| Date       | `"date_of_birth"` | `"1998-05-20"` (as text, `YYYY-MM-DD`)  |
| Email      | `"email"`         | `"rahul@example.com"`                   |
| Phone      | `"phone"`         | `"919999999999"` (as text, digits only) |

<Note>
  The field must already exist — check [Custom Fields List](/developer-api/subscriber/list-custom-fields)
  for valid names, or create one first in **Subscriber Manager → Manage → Manage Custom Fields**.
  You only need to include the fields you're updating — any field you leave out is unaffected.
</Note>


## OpenAPI

````yaml POST /whatsapp/subscriber/chat/assign-custom-fields
openapi: 3.1.0
info:
  title: ChatSyncs Developer API
  version: 1.0.0
  description: >-
    REST API for sending WhatsApp messages and managing subscribers through
    ChatSyncs.
servers:
  - url: https://platform.chatsyncs.com/api/v1
security: []
paths:
  /whatsapp/subscriber/chat/assign-custom-fields:
    post:
      tags:
        - Subscriber API
      summary: Assign Custom Fields
      operationId: assignCustomFields
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                apiToken:
                  type: string
                  description: >-
                    Your ChatSyncs API key (not a WhatsApp/Meta access token).
                    [Where to find
                    it](/developer-api/finding-ids#api-token-apitoken).
                  example: API-KEY
                phone_number_id:
                  type: string
                  description: >-
                    The WhatsApp account's phone number ID. [Where to find
                    it](/developer-api/finding-ids#phone-number-id-phone_number_id).
                  example: PHONE-NUMBER-ID
                phone_number:
                  type: string
                  description: >-
                    The subscriber's phone number, with country code, digits
                    only.
                  example: PHONE-NUMBER
                custom_fields:
                  type: string
                  description: A JSON object of custom field names and values.
                  example: '{"custom_field_name1":"value1"}'
              required:
                - apiToken
                - phone_number_id
                - phone_number
                - custom_fields
      responses:
        '200':
          description: >-
            Standard ChatSyncs response. `status` is `"1"` on success and `"0"`
            on failure.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: '`"1"` = success, `"0"` = failure.'
                  message:
                    type: string
                    description: Human-readable result message.
              examples:
                success:
                  summary: Success
                  value:
                    status: '1'
                    message: Success.
                error:
                  summary: Error
                  value:
                    status: '0'
                    message: Invalid request.

````