Record a registration
POST https://releva.ai/api/v0/register creates or updates a profile and sets its registration time to the moment of the call.
When to use it
Section titled “When to use it”Call it from your server at the time a user completes their registration in your shop. Unlike Create or update profiles, which is meant for backfill and bulk sync, this call is made for the sign-up moment. To load past registrations with their original dates, use Create or update profiles with registeredAt.
Authentication
Section titled “Authentication”Send your shop’s Secret Key as a bearer token, from your server only:
authorization: Bearer $RELEVA_SECRET_KEYFind the key under Settings › Shop & Integration; see Find your Access Token and Secret Key. Authentication failures answer 400, not 401 (see Errors).
Request
Section titled “Request”POST /api/v0/register with content-type: application/json. Send your customer id, with email or phoneNumber when you have them. Releva also accepts a request with only email or only phoneNumber; it answers 400 only when all three are missing.
| Field | Type | Notes |
|---|---|---|
id |
string | The user’s unique identifier in your database. |
email |
string | A valid email address. |
phoneNumber |
string | Must start with + followed by digits only, for example +49875345976. A national number is converted with your shop’s country code, but send the international form. |
firstName, lastName |
string | |
birthday |
string | YYYY-MM-DD only. |
tags |
array of strings | Tags to apply to the user. Replaces the profile’s tags. Leave it out to keep the existing tags. |
Unknown keys are ignored on this endpoint. There is no field for the registration date: every call sets it to now, also for a customer who registered before.
curl -X POST 'https://releva.ai/api/v0/register' \ -H "authorization: Bearer $RELEVA_SECRET_KEY" \ -H 'content-type: application/json' \ -d '{ "id": "DEMO-1001", "email": "maria@example.com", "firstName": "Maria", "lastName": "Example", "phoneNumber": "+15555550199", "tags": ["registered-online"], "birthday": "1990-05-12" }'Response
Section titled “Response”202 Accepted with the body {}. The profile is written when the response returns.
Errors
Section titled “Errors”Errors have one shape, { "message": "..." }.
| Status | When | Message |
|---|---|---|
400 |
No authorization header |
Authorization header is missing. |
400 |
The header is not Bearer <token> |
Authorization header is malformed. It should look like `Bearer <string>`. |
400 |
The token is not a UUID | Authorization header contains an invalid Bearer token. |
400 |
No shop has this key | Domain with the provided secret key cannot be found. |
400 |
No identifier | At least one of (id, email, phoneNumber) is required! |
400 |
Bad email | The 'email' field must be a valid e-mail. |
400 |
tags is not an array |
The 'tags' field must be an array. |
400 |
birthday with a time part |
birthday must be a valid ISO-8601 date such as 2020-01-01 with optional time ... Got 1990-05-12T00:00:00Z instead. (despite the text, only YYYY-MM-DD is accepted) |
400 |
Phone number that is not + and digits after conversion |
phoneNumber must be a valid telephone number starting with + and international code, e.g. +1. Got abc instead. |
402 |
The shop is disabled | Domain is disabled. Please reach out to support@releva.ai to enable it. |
413 |
Body larger than 800 KB | request entity too large |
500 |
Unexpected error | An internal error occurred. Retry later. |
Limits
Section titled “Limits”- One profile per request.
- Rate limits: none on this endpoint.