UserSet or remove a user's phone number

Set or remove a user's phone number

Writes the phone number (PII) to D1 and emits a UserPhoneNumberUpdated audit event carrying only a masked (last-4) form — the raw number never enters the event log. Pass phoneNumber as a string to set it, or null to remove it.

curl -X POST "https://api.spkey.co/users/example_string/UpdatePhoneNumber" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN (JWT)" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{
  "phoneNumber": "null"
}'
{
  "success": true,
  "aggregateId": "example_string",
  "version": 3.14,
  "event": "null"
}
POST
/users/{id}/UpdatePhoneNumber
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token (JWT)
Bearer Tokenstring
Required

JWT token from SmartphoneKey authentication. Identifies the B2C user or B2B service.

JWT token from SmartphoneKey authentication. Identifies the B2C user or B2B service.
API Key (header: X-API-Key)
X-API-Keystring
Required

API key for B2B organization access. Provided during organization onboarding.

API key for B2B organization access. Provided during organization onboarding.
Content-Typestring
Required

The media type of the request body

Options: application/json
phoneNumberstringnull
Required

Phone number to set; null to remove the existing phone number

Min length: 1
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token (JWT). JWT token from SmartphoneKey authentication. Identifies the B2C user or B2B service.

header
X-API-Keystring
Required

API Key for authentication. API key for B2B organization access. Provided during organization onboarding.

Path Parameters

Body

application/json
phoneNumberstring,null
Required

Phone number to set; null to remove the existing phone number

Responses

successboolean
Required
aggregateIdstring
Required
versionnumber
Required
eventobject,null
Required