1. User Fields
Returning.AI
  • Getting Started
  • Bulk Operations
    • Bulk user updates
    • List bulk update jobs
      GET
    • Get bulk update job status
      GET
    • Get bulk update job details
      GET
    • Bulk update users from CSV
      POST
    • Bulk update premium currency from CSV
      POST
  • Chart Analysis
    • Create Analysis
      POST
    • Get Analysis
      GET
    • Update Analysis
      PATCH
    • Delete Analysis
      DELETE
    • List Analyses
      GET
    • Append Drawings
      POST
  • Rewards & Redemptions
    • Redemption lifecycle
    • Store catalog to redemptions
    • Update redemption order status or refund
      PUT
    • List redemption orders by user email
      POST
    • List redemption statuses
      POST
    • Get redemption status by ID
      POST
    • List redemption orders by community
      POST
    • Create redemption order status
      POST
    • Get redemption order status history
      POST
    • List redemption orders by custom-field identifier
      POST
  • Gamification
    • Leaderboards
      • 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
      • Mini-game State and History
      • List user streak logs
      • List mini-game logs by user email
      • Get current mini-game and streak state
      • Update user spin-wheel information
    • Referral
      • Referral Program Integration
      • Get referral programs
      • Get user's referral summary
    • Rolling Data
    • Match Predictions
      • Create match prediction
      • List match predictions
      • Get match prediction
      • Patch match prediction
      • Publish match prediction
      • Settle match prediction
      • Get settlement results
      • Void match prediction
      • Bulk update match predictions
      • Get bulk job status
      • Get bulk job results
    • Loyalty Points
      • Create loyalty points export
      • Get loyalty points export status
      • Get loyalty points export download link
    • Quizzes
      • Create quiz
      • List quizzes
      • Get quiz
      • Update quiz
      • Delete quiz
      • Add quiz question
      • Update quiz question
      • Delete quiz question
    • Get tier configuration
    • Get daily user XP and coin changes
    • Search user gamification logs
    • Get user activity stats
  • Messaging
    • Agent messaging workflow
    • Get Messages
    • Send Message
    • Reply Message
    • React Message
    • Upload message images
  • Users
    • User directory and provisioning
    • Get Users with Filters
    • Create New User
    • Get User Data
    • Manage User Account
    • Get User Milestones
    • Update User Data, Identifier, And Roles
  • 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
    • Channels
    • Leaderboard
    • Milestone
    • Socials
    • Store
  • Community Analytics
    • Get Loyalty Overview
    • Get Phone Verification Contacts
  • Store
    • Store journey
    • Store catalog
    • Purchase History
      • Archive or restore an order
      • 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
      • Create products in bulk
      • Create product with vouchers
      • Update products in bulk
      • Read product
      • Update product and append vouchers
      • Delete product
    • Redemption-transaction
      • Get redemption transaction detail
    • Get Store configuration
    • Update Store configuration
  • Community
    • Community directory and appearance
    • 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
  • User Fields
    • User field definitions and history
    • User Field History
      • List Community User-Field History
      • List One Field Across Users
      • List One User Across Fields
      • List One User's One Field
      • Update A User Field Value
      • Deprecated Field-First History Write
      • Deprecated Field-First History Read
    • Create A User Field Definition
      POST
    • Get A User Field Definition
      GET
    • Update A User Field Definition
      PUT
    • Delete A User Field Definition
      DELETE
    • List User Field Definitions
      GET
  • API Keys
    • API key lifecycle
    • 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
  • Legacy
    • Servers
      • Create server
      • List servers
      • Update server metadata
    • Bulk Operations
      • Bulk import users from CSV
    • Authentication
      • Register user with password
      • Verify user email
      • Log in user with password
      • Secure Auth
    • 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
      • Get user
      • 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
  • Community Logs
    • Retrieve and export community logs
  1. User Fields

Create A User Field Definition

POST
https://sgtr-api.returning.ai/v1/communities/{communityId}/user-fields
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
🟠401Unauthorized
🟠403Forbidden
🟠404Record Not Found
🟠409
🔴500Server Error
🔴503Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location 'https://sgtr-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 14:31:07
Previous
Deprecated Field-First History Read
Next
Get A User Field Definition
Built with