Login and registration
Find a member's churches by phone, log in with phone and PIN, register with an SMS code, the optional login OTP, and the forgot-PIN flow.
Every pin field on this page is the 4-digit PIN as the shipped apps send it: encrypted by the app (see the overview). Verification codes are 4 digits, sent by SMS from the church's sender ID, valid for 5 minutes and usable once. Codes are rate limited per phone number (rate limits).
Typical flow
POST login-phonewith the phone: the churches this number belongs to.- The member picks a church;
POST login/{church}with phone and PIN returns the member token. - Optionally
POST send-login-otp/{church}thenPOST verify-otp/{church}when the church requires a login code. - A new member registers with
POST register-member/{church}(sends a code) thenPOST confirm-otp/{church}(creates the account).
Churches for a phone number
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| phone | string | Yes | The member's phone number, any Kenyan format. |
curl -X POST https://uat-api.mychurch.co.ke/api/v2/login-phone \
-H "Content-Type: application/json" \
-d '{"phone": "0712345678"}'{
"message": "Success",
"status": true,
"churches": [
{ "uuid": "00000000-0000-4000-8000-000000000001", "church_name": "Grace Community Church" }
]
}A number with no membership anywhere answers {"message": "You are not registered to any church", "status": false}. Churches hidden from the app are left out of the list.
Log in
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| phone | string | Yes | The member's phone number. |
| pin | string | Yes | The PIN, encrypted by the app. |
curl -X POST https://uat-api.mychurch.co.ke/api/v2/login/00000000-0000-4000-8000-000000000001 \
-H "Content-Type: application/json" \
-d '{"phone": "254712345678", "pin": "<encrypted pin>"}'{
"message": "Login successful",
"status": true,
"token": "11111111-2222-4333-8444-555555555555",
"photo": "https://uat-api.mychurch.co.ke/storage/scarlet/profiles/jane.jpg",
"account": {
"first_name": "Jane",
"middle_name": "",
"other_names": "Wanjiku",
"primary_phone": "254712345678",
"alternative_phone": null,
"email": "[email protected]",
"physical_address": "Kilimani, Nairobi",
"date_of_birth": "1990-04-12",
"confirmation_date": null,
"married_on": null,
"age_group": {
"id": 3, "uuid": "00000000-0000-4000-8000-0000000000a3", "church_id": 12,
"name": "Adults", "from_age": 26, "to_age": 60,
"deleted_at": null, "created_at": "2024-01-10T07:00:00.000000Z", "updated_at": "2024-01-10T07:00:00.000000Z"
},
"status": 1,
"gender": 2,
"marital_status": 2,
"uuid": "00000000-0000-4000-8000-0000000000b1",
"member_number": "GC042",
"tithe_number": null,
"blocked": null,
"department_name": "Departments",
"cell_group_name": "Cell Groups"
}
}status in account is 0 pending, 1 active, 3 inactive. blocked is the opt-out record when the member has stopped non-transactional SMS, else null. department_name and cell_group_name are the church's own words for those groups, for the app's labels. Failures (all HTTP 200, status: false):
You are not a registered member of Grace Community ChurchYour Grace Community Church membership has not been approved. Contact the church administrator for more info: 0700000000Invalid credentials(with"token": null)An error occurredwhen the PIN does not decrypt
On /api/v1/login/{church} the response carries token, photo and name instead of the account block.
Login OTP (optional second step)
Some churches require a code after the PIN. The app calls send-login-otp with the token it just received and reads status_int.
No body. Answers, all status: true:
status_int: 1,Otp has been sent to your phone: ask for the code.status_int: 2,Otp login not allowed: the church does not use login codes; continue.status_int: 3,Success: the church remembers logins; continue.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| otp | string | Yes | The 4-digit code. |
{
"message": "Login successful",
"status": true,
"token": "11111111-2222-4333-8444-666666666666",
"photo": null,
"name": "Jane Wanjiku"
}A new token is issued; use it from now on. A wrong code answers Your have entered the wrong otp (the spelling is what the apps match on).
Register a new member
1. Send the verification code
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Full name. The first word becomes the first name, the last the other names, anything between the middle name. |
| physical_address | string | Yes | Where the member lives. |
| phone | string | Yes | The member's phone; the code is sent here. |
| pin | string | Yes | The chosen PIN, encrypted by the app. |
| date_of_birth | string | No | YYYY-MM-DD. Required unless age_group is sent. Must be 18 or over. |
| age_group | uuid | No | An age group from get-age-groups. Required unless date_of_birth is sent. |
{"message": "A verification code has been sent to your phone", "status": true}Failures: You are already registered to this church, Member should be 18yrs and above, Invalid date, Registration could not be completed. Please try again later. An invalid phone is a 422 with "0712 is invalid" as the message.
2. Confirm the code and create the account
Send the same fields again, plus:
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| otp | string | Yes | The 4-digit code from step 1. |
| gender | integer | No | 1 male, 2 female. |
| marital_status | integer | No | 1 single, 2 married, 3 single parent, 4 widowed. |
| member_number | string | No | The member's existing church number, if they have one. A number already taken is replaced by a generated one. |
| department | uuid | No | A department to join (from all-departments). |
| cell_group | uuid | No | A cell group to join (from all-cell-groups). |
{"message": "Your account is being created. You will receive an sms shortly", "status": true}The account exists when this answers. It is active, or pending when the church approves new members first (login then answers with the not-approved message). Pledges and children recorded earlier against this phone are linked to the new member, and the church's welcome SMS is sent. A wrong code answers Your have entered the wrong verification code. The member logs in next with login/{church}.
Age groups for the registration form
{
"message": "success",
"status": true,
"age_groups": [
{ "uuid": "00000000-0000-4000-8000-0000000000a1", "name": "Youth", "group": "18-25" },
{ "uuid": "00000000-0000-4000-8000-0000000000a3", "name": "Adults", "group": "26-60" }
]
}Forgot PIN
1. Send a code
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| phone | string | Yes | The member's phone. |
{"message": "A verification code has been sent to your phone", "status": true}Unknown number: You are not registered to this church.
2. Verify the code
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| phone | string | Yes | The member's phone. |
| otp | string | Yes | The code from step 1. |
{"message": "Request successful", "status": true, "token": "11111111-2222-4333-8444-777777777777"}The token authorises step 3. Wrong code: You have entered the wrong verification code.
3. Set the new PIN
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| phone | string | Yes | The member's phone; must be the phone of the token's member. |
| pin | string | Yes | The new PIN, encrypted by the app. |
{"message": "Your pin has been changed", "status": true}Change PIN and log out
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| old_pin | string | Yes | Current PIN, encrypted by the app. |
| new_pin | string | Yes | New PIN, encrypted by the app. |
{"message": "Your pin has been changed", "status": true}Wrong current PIN: You have entered a wrong current password.
{"message": "You have logged out", "status": true}Churches still on the previous system
login, register-member, confirm-otp, forgot-pin-otp and forgot-pin answer Your church is still on the previous MyChurch system. Please update the app or try again later for a church that has not moved yet, and issue nothing.