1. User Fields
Returning.AI
  • Getting Started
  • Users
    • Get user
      GET
    • Get Users with Filters
      POST
    • Create New User
      POST
    • Get User Data
      POST
    • Manage User Account
      POST
    • List mini-game logs by user email
      POST
    • Get user's current Mini Games and Streak stats
      POST
    • Get User Milestones
      POST
    • Update User Data, Identifier, And Roles
      POST
    • Update User XP and Currency
      POST
  • Messaging
    • Agent messaging workflow
    • Get Messages
      GET
    • Send Message
      POST
    • Reply Message
      POST
    • React Message
      POST
    • Upload message images
      POST
  • Gamification
    • Leaderboards
      • List leaderboards with pagination
      • Create a new leaderboard
      • Update an existing leaderboard
      • Get a single leaderboard by ID
      • Delete a leaderboard
    • Streaks & Mini Games
      • List user streak logs
      • Update user spin-wheel information
    • Referral
      • Get referral programs
      • Get user's referral summary
    • Rolling Data
      • Get Daily Calculation Data
      • Get Rolling Calculation Data
    • Match Predictions
    • Get tiers and XP settings
      GET
    • Get daily user gamification history
      POST
    • List user gamification logs
      POST
    • Get user activity stats
      POST
  • Rewards & Redemptions
    • Update redemption order status or refund
    • List redemption orders by user email
    • List redemption statuses
    • Get redemption status by ID
    • List redemption orders by community
    • Create redemption order status
    • Get redemption order status history
  • Chart Analysis
    • Create Analysis
    • Get Analysis
    • Update Analysis
    • Delete Analysis
    • List Analyses
    • Append Drawings
  • Bulk Operations
    • List bulk update jobs
    • Get bulk update job status
    • Get bulk update job details
    • Bulk update users from CSV
    • Bulk update premium currency from CSV
  • Channels
    • Iframe
    • List integration channels
  • Events
    • Outgoing webhooks
      • Encryption
      • User Joins Server
      • User Visits server
      • New Message Posted Anywhere
      • New Message Posted To channel
      • Purchased Store Item
    • Incoming webhooks
      • API Keys & Encryption
      • Send message into channels
      • Update Custom User Fields
      • Update In-game currency
  • Widgets
    • Authenticated Widgets
    • Public widgets
  • Community Analytics
    • Get Loyalty Overview
    • Get Phone Verification Contacts
  • Store
    • Purchase History
      • Update redemption instructions or voucher details
    • Categories
      • List Store categories
      • Create Store category
      • Get Store category by ID
      • Update Store category
      • Delete Store category
    • Products
      • List products
      • Update products in bulk
      • Create products in bulk
      • Create product with vouchers
      • Read product
      • Update product and append vouchers
      • Delete product
    • Redemption-transaction
      • Get redemption transaction detail
    • Get Store configuration
    • Update Store configuration
  • Community
    • Appearance
      • Update community theme colors
      • Update community bot profile
      • Update community URL metadata
      • Update community name and URL
    • Community Users
      • Get community users
      • Get user
    • Create community
  • API Keys
    • Community API Keys
      • Create API key
      • Read API keys
      • Delete API key
      • Update API key
    • User API Keys
      • List user API keys
      • Create user API key
      • Update user API key
      • Delete user API key
      • Get current API key information
  • User Fields
    • User Field History
      • Get all user field histories in a community
      • Get user field histories for a specific field
      • Get user field histories for a specific user
      • Get user field histories of specific user field and user
      • Update A User Field Value
      • Deprecated Field-First History Write
      • Deprecated Field-First History Read
    • Get A User Field Definition
      GET
    • Update A User Field Definition
      PUT
    • Create A User Field Definition
      POST
    • Delete A User Field Definition
      DELETE
    • List User Field Definitions
      GET
    • Delete user field
      DELETE
    • Update user field
      PUT
    • Get specific user field
      GET
  • Legacy
    • Servers
      • Create server
      • List servers
      • Update server metadata
    • Bulk Operations
      • Bulk import users from CSV
    • Authentication
      • Secure Auth
      • Register user with password
      • Verify user email
      • Log in user with password
    • Badges
      • List badges
      • Create badge
      • Update badge
      • Delete badge
      • Remove badge from user
      • Award badge to user
    • Messaging
    • Roles & Permissions
      • List server roles
      • Create role
      • Update role
      • Delete role
      • List user roles
      • Add role to user
      • Remove role from user
    • Users
      • Upload user avatar
    • Channels
      • Create channel
      • Update channel
      • Delete channel
    • API Keys
      • List integration API keys
      • Create integration API key
      • Delete integration API key
      • Update integration API key
  • Schemas
    • Sample Schemas
    • Schemas
    • Outgoing webhooks
    • Analysis
    • Pet
    • Category
    • Tag
    • ValidationError
    • NotFoundError
    • InternalServerError
    • NotImplementedError
    • CreateUserFieldHistoryResponse
    • CreateUserFieldHistorySuccessResponse
    • UserFieldHistoryItem
    • GetUserFieldHistoriesResponse
    • UserFieldHistoriesValidationError
    • UserFieldHistoriesMetaWithValidation
    • UserFieldHistoriesMetaWithPagination
    • GetUserFieldHistoriesSuccessResponse
    • CreateUserFieldResponse
    • CreateUserFieldSuccessResponse
    • DeleteUserFieldResponse
    • DeleteUserFieldSuccessResponse
    • UserFieldCreator
    • GetUserFieldResponse
    • GetUserFieldSuccessResponse
    • ValidationErrorItem
    • GetUserFieldsMetaResponse
    • CreatorInfo
    • UserFieldResponse
    • GetUserFieldsSuccessResponse
    • UpdateUserFieldResponse
    • UpdateUserFieldPayload
    • UpdateUserFieldSuccessResponse
    • MetaResponse
    • GetUserResponse
    • GetUserSuccessResponse
    • Purchased store item
    • ErrorResponse
    • New message posted to channel
    • UpdateAnalysisRequest
    • User visits server
    • AppendDrawingsRequest
    • User join server
    • CreateAnalysisResponse
    • GetAnalysisResponse
    • UpdateAnalysisResponse
    • AppendDrawingsResponse
    • AnalysisMetadata
    • Expiry
    • Levels
    • LevelEntry
    • Drawing
    • HorizontalLineDrawing
    • LineDrawing
    • RectangleDrawing
    • ParallelDrawing
    • FibonacciRetracementDrawing
    • Coordinate
    • DrawingStyle
    • AnalysisDetail
    • AnalysisSummary
    • CreateAnalysisRequest
    • ListAnalysesResponse
    • StandardApiError
    • StandardSuccessEnvelope
    • PurchasedStoreItemEvent
    • ChannelMessagePostedEvent
    • UserVisitedCommunityEvent
    • UserJoinedCommunityEvent
  1. User Fields

Create A User Field Definition

POST
/v1/communities/{communityId}/user-fields

What this endpoint does#

Creates one typed custom user-field definition. Use definitions to model broker identifiers, trading metrics, statuses, dates, flags, and internal notes before writing values. The lowercase field key is immutable and should be stored in integration configuration.
INFO
Workflow
Create field -> read field

Quick start#

{
  "name": "Trading Volume",
  "field": "trading_volume",
  "type": "numerical",
  "defaultValue": 0
}

Authentication and permission#

Use a community API key with userFields. The caller must be a community owner or administrator. Personal message API keys are not recognized by this application-service route.

Complete examples#

Supported type values are single-line-text, multi-line-text, numerical, date, time, date-time, boolean, single-select-dropdown, and multi-select-dropdown.
Copyable examples for every type:
{ "name": "Account Tier", "field": "account_tier", "type": "single-line-text", "defaultValue": "standard" }
{ "name": "Internal Notes", "field": "internal_notes", "type": "multi-line-text", "defaultValue": "" }
{ "name": "Trading Volume", "field": "trading_volume", "type": "numerical", "defaultValue": 0 }
{ "name": "KYC Date", "field": "kyc_date", "type": "date", "defaultValue": "2026-07-21" }
{ "name": "Market Open", "field": "market_open", "type": "time", "defaultValue": "08:30:00" }
{ "name": "Last Sync", "field": "last_sync", "type": "date-time", "defaultValue": "2026-07-21T08:30:00Z" }
{ "name": "KYC Complete", "field": "kyc_complete", "type": "boolean", "defaultValue": false }
{ "name": "Segment", "field": "segment", "type": "single-select-dropdown", "defaultValue": "gold" }
{ "name": "Eligible Plans", "field": "eligible_plans", "type": "multi-select-dropdown", "defaultValue": ["gold", 2] }
Omitting defaultValue and sending null both mean no default. Non-null defaults must match the exact field type. Numerical defaults are JSON numbers, booleans are JSON booleans, date uses YYYY-MM-DD, time uses HH:mm:ss, and date-time uses an ISO-like timestamp. Select defaults may use finite numbers as well as strings; multi-select defaults are arrays of those scalar values.

Success and readback#

{
  "meta": {
    "status": "success",
    "statusCode": 201,
    "code": "USER_FIELD_CREATED",
    "compatibilityEvent": "attempted"
  },
  "message": "Create user field api success.",
  "data": {
    "_id": "<fieldObjectId>",
    "name": "Trading Volume",
    "field": "trading_volume",
    "type": "numerical",
    "defaultValue": 0,
    "isCustom": true,
    "createdAt": "2026-07-21T00:00:00.000Z",
    "updatedAt": "2026-07-21T00:00:00.000Z"
  }
}
Read back by data.field or data._id. compatibilityEvent: "failed" means the downstream compatibility event failed after the definition committed. idempotencyPersistence: "degraded" is a separate warning that the completed replay record could not be persisted.
CHECK
Readback
Run the follow-up read named above. Compare the returned identifiers and final stored values.

Errors and recovery#

400 INVALID_FIELD_DEFINITION: fix name, key, type, or typed default.
400 INVALID_IDEMPOTENCY_KEY: supply 1 to 200 visible ASCII characters with no spaces or control characters.
401 AUTHENTICATION_REQUIRED / 403 API_KEY_PERMISSION_DENIED: use a recognized community key and authorized owner/admin.
404 COMMUNITY_NOT_FOUND: fix community scope.
409 USER_FIELD_NAME_CONFLICT or USER_FIELD_KEY_CONFLICT: read the existing definition and reconcile.
409 IDEMPOTENCY_KEY_CONFLICT: the same key was reused with a different normalized definition.
409 IDEMPOTENCY_REQUEST_IN_PROGRESS: read by stable key before deciding whether another logical operation is needed.
503 IDEMPOTENCY_STORE_UNAVAILABLE: creation did not start because safe deduplication was unavailable.

Retry safety#

WARNING
Retry rule
Use one community-scoped Idempotency-Key for one logical definition. Exact normalized replays return the original 201, including omitted versus explicit-null default. A different definition under the key conflicts. Keep the key for 24 hours and read back after any ambiguous result.

Gotchas#

Avoid this mistake

Next steps#

Read the field
Read the definition by stable key. Then use POST /v1/communities/{communityId}/users/{userId}/user-fields/{fieldIdOrName}/histories for supported scalar values. Use list endpoints to audit field history.

Request

Path Params

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢201Created
application/json
Create user field api success. Branch on the HTTP status and meta.code; do not branch on the human-readable message.
Bodyapplication/json

🟠400Bad Request
🟠401Error
🟠403Error
🟠404Record Not Found
🟠409Error
🔴500Server Error
🔴503Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.returning.ai/v1/communities/6502c9e514a3e564c5c09c0a/user-fields' \
--header 'Authorization: Bearer <apiKey>' \
--header 'Idempotency-Key: usrfld-20260720-0001' \
--header 'Content-Type: application/json' \
--data '{
  "name": "Account Tier",
  "field": "account_tier",
  "type": "single-line-text",
  "defaultValue": "standard"
}'
Response Response Example
201 - Success Example
{
  "meta": {
    "status": "success",
    "statusCode": 201,
    "code": "USER_FIELD_CREATED",
    "compatibilityEvent": "attempted"
  },
  "message": "Create user field api success.",
  "data": {
    "_id": "66f000000000000000000010",
    "communityID": "6502c9e514a3e564c5c09c0a",
    "name": "Trading Volume",
    "field": "trading_volume",
    "type": "numerical",
    "defaultValue": 0,
    "isCustom": true,
    "createdAt": "2026-07-21T00:00:00.000Z",
    "updatedAt": "2026-07-21T00:00:00.000Z"
  }
}
Modified at 2026-07-27 16:00:32
Previous
Update A User Field Definition
Next
Delete A User Field Definition
Built with