1. User Field History
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 daily user XP and coin changes
    • Search user gamification logs
    • Get user activity stats
  • 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
      • Get user field histories for a specific field
        GET
      • Get user field histories for a specific user
        GET
      • Get user field histories of specific user field and user
        GET
      • Update A User Field Value
        POST
      • Deprecated Field-First History Write
        POST
      • Deprecated Field-First History Read
        GET
    • 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 Field History

Update A User Field Value

POST
/v1/communities/{communityId}/users/{userId}/user-fields/{fieldIdOrName}/histories

What this endpoint does#

Writes one user's value for one field and appends an audit-history row. Use overwrite for supported scalar fields and increase or decrease for numerical fields. The user-first route shown here is the only supported write route.
INFO
Workflow
User + field + action -> stored value -> history

Quick start#

{ "value": 10, "action": "increase" }

Authentication and permission#

Use a server-side community API key with userFields. The principal must be a community owner or administrator. {userId} accepts email, Mongo ObjectId, numeric platform ID, or username. {fieldIdOrName} accepts the stable field key or field ObjectId. URL-encode email addresses.

Complete examples#

Meaningful falsy values are preserved end to end:
{ "value": false, "action": "overwrite" }
{ "value": 0, "action": "overwrite" }
{ "value": "", "action": "overwrite" }
The empty string is valid only for a multi-line-text field. increase and decrease require a JSON number. Omitting action defaults to overwrite when supported. Select definitions may be created, but select-value writes are not supported by this endpoint.

Success and readback#

{
  "meta": {
    "status": "success",
    "statusCode": 201,
    "code": "USER_FIELD_VALUE_UPDATED"
  },
  "message": "Update user field value api success.",
  "data": {
    "value": 10,
    "action": "increase",
    "storedValue": 110,
    "updatedValue": 110,
    "fieldID": "<fieldObjectId>",
    "fieldName": "trading_volume",
    "fieldType": "numerical",
    "userID": "<mongoUserId>",
    "userNumericID": 3247779,
    "updated": true
  }
}
The first successful write omits idempotentReplay. An exact replay of a completed keyed request adds "idempotentReplay": true. If the write committed but saving the replay record degraded, the response may instead add "idempotencyPersistence": "degraded"; perform readback before retrying.
value and action echo the caller's magnitude and operation. storedValue/updatedValue represent the resulting projection when available. Read back with the narrow user-and-field history route and the approved current-value read.
CHECK
Readback
Run the follow-up read named above. Compare the returned identifiers and final stored values.

Errors and recovery#

400 INVALID_FIELD_VALUE or INVALID_FIELD_ACTION: fix type/action without coercing meaningful falsy values. Select definitions currently reach INVALID_FIELD_VALUE because this endpoint does not support select-value mutation.
400 INVALID_IDEMPOTENCY_KEY: use 1 to 200 visible ASCII characters.
400 USER_IDENTIFIER_UPDATE_REJECTED: use Update User Data for an intentional active-identifier change.
401 AUTHENTICATION_REQUIRED / 403 API_KEY_PERMISSION_DENIED: use a recognized community key and owner/admin access.
403 USER_NOT_IN_COMMUNITY: the user exists but is not a member of this key's community.
404 USER_NOT_FOUND or USER_FIELD_NOT_FOUND: resolve the user and field inside the same community.
409 IDEMPOTENCY_KEY_CONFLICT or IDEMPOTENCY_REQUEST_IN_PROGRESS: the key belongs to a different request or the original request is still running.
409 USER_IDENTIFIER_CONFLICT: the requested active identifier belongs to another user.
409 USER_FIELD_MUTATION_IN_PROGRESS: another numerical mutation still owns the resource lock; no mutation started.
500 USER_FIELD_VALUE_PROJECTION_FAILED: projection failed and rollback was confirmed; read back before retrying.
500 USER_FIELD_HISTORY_RECONCILIATION_REQUIRED: cleanup could not be proven; outcome is ambiguous.
500 USER_FIELD_HISTORY_INTERNAL_ERROR: an unexpected controller failure occurred.
503 IDEMPOTENCY_STORE_UNAVAILABLE or USER_FIELD_MUTATION_LOCK_UNAVAILABLE: safe coordination was unavailable and the mutation did not start.

Retry safety#

WARNING
Retry rule
Reuse the same Idempotency-Key only with the exact same user identifier, field identifier, value, and action. Different equivalent identifiers still conflict because the public request identity changed. After lock contention, retry the exact keyed request with bounded backoff. After an in-progress/ambiguous result, perform narrow readback and never create a new key to bypass ownership.

Gotchas#

Avoid this mistake

Next steps#

Read the field history
Call GET /v1/communities/{communityId}/users/{userId}/user-fields/{fieldIdOrName}/histories for narrow readback. Use broader history routes for audits. Use POST /v1/users/update instead of this endpoint to replace an active identifier.

Request

Path Params

Header Params

Body Params application/jsonRequired

Examples

Responses

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

🟠400Bad Request
🟠401Unauthorized
🟠403Forbidden
🟠404Record Not Found
🟠409
🔴500Server Error
🔴503Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://api.returning.ai/v1/communities/6502c9e514a3e564c5c09c0a/users/user@example.com/user-fields/trading_volume/histories' \
--header 'Authorization: Bearer <apiKey>' \
--header 'Idempotency-Key: usrfld-20260720-0001' \
--header 'Content-Type: application/json' \
--data '{
  "value": false,
  "action": "overwrite"
}'
Response Response Example
201 - Success Example
{
  "meta": {
    "status": "success",
    "statusCode": 201,
    "code": "USER_FIELD_VALUE_UPDATED",
    "sum": 110,
    "updated": true
  },
  "message": "Update user field value api success.",
  "data": {
    "_id": "66f000000000000000000020",
    "communityID": "6502c9e514a3e564c5c09c0a",
    "userID": "66f000000000000000000021",
    "userNumericID": 3247779,
    "fieldID": "66f000000000000000000010",
    "fieldName": "trading_volume",
    "fieldType": "numerical",
    "value": 10,
    "action": "increase",
    "storedValue": 110,
    "updatedValue": 110,
    "createdAt": "2026-07-21T00:00:00.000Z",
    "updatedAt": "2026-07-21T00:00:00.000Z",
    "updated": true
  }
}
Modified at 2026-07-27 16:01:08
Previous
Get user field histories of specific user field and user
Next
Deprecated Field-First History Write
Built with