Mergeți la conținut principal

Custom Person Fields

Churches add their own fields to person records in B1 Admin, such as a background-check expiry date, a shirt size, or a class status (see Custom Fields). The API exposes them as two resources: a field is the definition (a name and a type), and a field value is what one person has stored for one field. Every value is stored as a string, whatever the field's type.

Before You Begin

  • Send a JWT or an API key in the Authorization: Bearer header on every request
  • Reading fields and values needs the People.View permission
  • Creating, changing, or deleting fields and writing values needs People.Edit

Permissions and Scopes​

Both resources live in the Membership module and check the same people permissions as the rest of a person's record.

ActionPermissionScope on an API key or OAuth token
List fields, read valuesPeople.Viewpeople:read (also included in people:write)
Create, update, or delete a field; set or clear valuesPeople.Editpeople:write

A scope only narrows a credential. The person behind the key or token must hold the permission as well.

A request without the permission is answered with 401 and an empty JSON object ({}). Everything is limited to the church the credential belongs to. A churchId sent in a request body is ignored.

Fields​

Method & PathPurpose
GET /membership/personfieldsList the church's fields, ordered by sort and then name
POST /membership/personfieldsCreate (no id) or update (with id) one or more fields. The body is an array
DELETE /membership/personfields/:idDelete a field and every value stored for it

A field has these properties:

PropertyTypeNotes
idstringAssigned by the API when the field is created. Send it to update a field
churchIdstringAlways set from the credential
namestringThe label staff see in B1 Admin. Up to 100 characters
fieldTypestringOne of the six field types
choicesstringMultiple Choice only. A JSON string holding an array of { "value": "...", "text": "..." } objects. Left out of the response when the field has none
sortnumberOptional whole number used to order the list

Create two fields:

POST /membership/personfields
Authorization: Bearer <token>
Content-Type: application/json

[
{ "name": "Background check expires", "fieldType": "Date" },
{
"name": "Shirt size",
"fieldType": "Multiple Choice",
"choices": "[{\"value\":\"S\",\"text\":\"Small\"},{\"value\":\"M\",\"text\":\"Medium\"}]"
}
]

The response is the saved fields, in the order you sent them, each with its id:

[
{ "id": "a1B2c3D4e5F", "churchId": "AbC123XyZ90", "name": "Background check expires", "fieldType": "Date" },
{
"id": "g6H7i8J9k0L",
"churchId": "AbC123XyZ90",
"name": "Shirt size",
"fieldType": "Multiple Choice",
"choices": "[{\"value\":\"S\",\"text\":\"Small\"},{\"value\":\"M\",\"text\":\"Medium\"}]"
}
]

Things to know when saving fields:

  • Nothing is validated. The API stores name, fieldType, and choices as sent. It does not check that fieldType is one of the six types or that choices is valid JSON, so check both before you post.
  • Send the whole field on an update. In particular, leaving choices out of an update clears it.
  • Changing fieldType does not convert stored values. Values already saved keep the string they had.

DELETE /membership/personfields/:id removes the field's values first and then the field, and returns {}. There is no undo.

Field Types​

fieldType is one of the names B1 Admin offers when a field is created. The API does not check a value against its field's type. The formats below are the ones B1 Admin writes and the ones its profile, search, and list screens expect, so write the same.

fieldTypeStored valueExample
TextboxThe text as entered"Blue"
Whole NumberThe number as a string"3"
DecimalThe number as a string"12.5"
DateThe date as YYYY-MM-DD"2027-03-31"
Yes/NoTrue or False, capitalised"True"
Multiple ChoiceThe value of the chosen choice, not its text"M"
  • B1 Admin shows a Yes/No value of True as Yes and False as No, and shows nothing for any other string.
  • B1 Admin shows a Multiple Choice value as the text of the matching choice, or the raw value when no choice matches.
  • A value can hold up to 4,000 characters.

Field Values​

Method & PathPurpose
GET /membership/personfieldvalues/person/:personIdEvery value stored for one person
GET /membership/personfieldvalues/field/:fieldIdOne field's value for every person who has one
POST /membership/personfieldvaluesSet or clear values. The body is an array of { personId, fieldId, value }

A value has an id, churchId, personId, fieldId, and value. There is at most one value per person per field, and a person who has never had a field filled in has no row for it. Treat a missing value as blank.

Set one value and clear another for the same person:

POST /membership/personfieldvalues
Authorization: Bearer <token>
Content-Type: application/json

[
{ "personId": "Pq7Rs2Tu4Vw", "fieldId": "a1B2c3D4e5F", "value": "2027-03-31" },
{ "personId": "Pq7Rs2Tu4Vw", "fieldId": "g6H7i8J9k0L", "value": "" }
]
[
{ "id": "m1N2o3P4q5R", "churchId": "AbC123XyZ90", "personId": "Pq7Rs2Tu4Vw", "fieldId": "a1B2c3D4e5F", "value": "2027-03-31" }
]
  • Values are matched on person and field. You never send a value's id. Posting a value for a person and field that already have one replaces it.
  • An empty value deletes the row. Send "" or null, or leave value out, to clear a field. There is no DELETE route for values.
  • The response is the person's full set of values. For every person named in the request, the API returns all of the values they now have, including fields you did not send.
  • Ids are not checked. The API does not confirm that personId and fieldId exist before it stores a value.

Filtering People and Saved Lists​

Custom fields can filter people in two places. Both compare against the stored string, so use the formats under Field Types.

People search. POST /membership/people/advancedSearch takes an array of conditions (see Membership Endpoints). A condition whose field is personField_ followed by a field's id filters on that field:

[
{ "field": "personField_a1B2c3D4e5F", "operator": "lessThan", "value": "2026-12-01" }
]

Custom-field conditions are combined with AND, together with any standard conditions in the same request. A condition that names a field that does not exist returns no one.

Saved lists. A saved list stores its filter as a rules tree on /membership/lists. A custom-field condition in that tree uses the field provider and puts the field's id in entityId:

{
"match": "all",
"conditions": [
{ "provider": "field", "entityId": "a1B2c3D4e5F", "operator": "lessThan", "value": "2026-12-01" }
]
}

Post { "rules": ... } to /membership/lists/preview (needs People.View) to get the matching people without saving a list.

The operators depend on the field's type:

fieldTypeOperators
Whole Number, Decimalequals, greaterThan, greaterThanEqual, lessThan, lessThanEqual. Both sides are read as numbers
Dateequals (the same calendar day), greaterThan (after), lessThan (before)
Textbox, Yes/No, Multiple Choiceequals, contains, startsWith, endsWith, ignoring case. contains is the default

Only stored values are compared, so a person with no value for the field never matches, whatever the operator. A number or date that cannot be read does not match either.