Delete a user field definition
Remove one of your custom user fields by its key or ID, so it no longer appears in your field list and can't be written.
- Method
- DELETE
- Path
https://api.returning.ai / v1/ communities/ {communityId}/ user-fields/ {fieldIdOrName} - Permission
- userFields
- Retries
- Read back before retrying; a repeat returns 404
When to use this
- A field your integration created is no longer used, such as a promo code field from a finished campaign.
- You created a field with the wrong key and want to start again with the right one.
- You clean up test fields before going live.
Authentication#
- Header
Authorization: Bearer <API_KEY>- Permission
- userFieldsShown in the dashboard as “User Fields”
Use a Community API key with the userFields permission, and keep it on your server. communityId must be the ID of the community that owns the key.
Behaviour#
Only custom fields can be deleted. Built-in fields, such as email, total_xp and total_coins, return 409 USER_FIELD_DELETE_FORBIDDEN, and a field marked as a user identifier, such as your broker identifier field, returns 409 USER_FIELD_DELETE_IDENTIFIER_LOCKED.
After a delete, the field no longer appears in your field list, and value writes and field history reads that use its key or ID return 404 USER_FIELD_NOT_FOUND.
Traders' history entries for the field are not deleted. They still appear in Get all user field histories in a community and in each trader's list, with fieldType set to null. If you create a field with the same key again, it gets a new _id and starts with an empty history; the old entries stay with the old ID.
Before you delete a field, remove it from anything that still writes to it, such as your own sync jobs or a data workflow.
Request#
Path parameters#
Rule24 hex characters
Eg"66f000000000000000000010"
_id. Capitals and spaces are cleaned up as on create, so PromoCode finds promocode.RuleField key or 24-character ID
Eg"promocode"
Headers#
userFields.RuleBearer <API_KEY>
curl --request DELETE \
--url https://api.returning.ai/v1/communities/66f000000000000000000010/user-fields/promocode \
--header 'Authorization: Bearer <API_KEY>'
Response#
A 200 returns the definition as it was just before the delete, so you can keep a record of it. Branch on the HTTP status and meta.code, never on message.
Eg{ ... }
Rulesuccess
Rule200
RuleUSER_FIELD_DELETED
Eg"Delete user field api success."
Eg{ ... }
Rule^[0-9a-fA-F]{24}$
Eg"66f000000000000000000604"
Eg"Promo code"
Rulea-z, 0-9, _, -
Eg"promocode"
Rulesingle-line-text, multi-line-text, numerical, date, time, date-time, boolean, single-select-dropdown, multi-select-dropdown
Eg"single-line-text"
null when it had none.Egnull
true. Only custom fields can be deleted.{
"meta": {
"status": "success",
"statusCode": 200,
"code": "USER_FIELD_DELETED"
},
"message": "Delete user field api success.",
"data": {
"_id": "66f000000000000000000604",
"name": "Promo code",
"field": "promocode",
"type": "single-line-text",
"defaultValue": null,
"isCustom": true,
"createdAt": "2026-09-01T08:30:00.000Z",
"updatedAt": "2026-09-01T08:30:00.000Z"
}
}
Errors#
Every error carries its code in meta.code, except a fieldIdOrName that isn't a valid key or ID: that returns 400 with a detail object and no code. A 400, 404 or 409 deletes nothing.
Fix the request04
fieldIdOrName isn't a valid key or ID: after cleanup it must be 1-120 characters of a-z, 0-9, _ and -. detail names the problem. This error has no code. Nothing was deleted.AUTHENTICATION_REQUIREDFix the requestAuthorization: Bearer <API_KEY> with a current Community API key.API_KEY_PERMISSION_DENIEDFix the requestuserFields. Add the permission in Settings > Integration > API Keys.API_KEY_COMMUNITY_MISMATCHFix the requestcommunityId is not the community that owns your key. Use your own community's ID.Fix the data04
USER_FIELD_NOT_FOUNDFix the dataUSER_FIELD_DELETE_FORBIDDENFix the dataemail or total_xp. Only fields your community created can be deleted.USER_FIELD_DELETE_IDENTIFIER_LOCKEDFix the dataCOMMUNITY_NOT_FOUNDFix the dataRetry with backoff01
USER_FIELD_OPERATION_FAILEDRetry with backoff409, the field changed while your delete ran and nothing was deleted. At 500, the outcome is unclear. Read the field with Get a user field definition: a 404 means it's gone; otherwise send the delete again.{
"meta": {
"status": "error",
"statusCode": 400
},
"message": "Delete user field api validation error.",
"detail": {
"fieldIdOrName": "field must use ASCII letters, numbers, \"_\", or \"-\" after normalization."
},
"solution": "Check your params in request and try again"
}