Customer sign-in
Connect API · https://api.conciar.com/connect/v1
Customers sign in with a one-time 6-digit code (valid 10 minutes, 5 attempts). Verifying the code returns an access token; send it as Authorization: Bearer … on the customer routes. Codes are delivered by email: type=phone is accepted, but no SMS is sent yet.
INFO
La référence de l’API est en anglais.
Register a customer
Emails a sign-in code. The answer is the same when the address already belongs to a member (they simply get a code).
Limite de débit: 5/min per IP
Corps
first_namestringobligatoireMax 100.
last_namestringMax 100.
emailstringobligatoireMax 255.
marketing_opt_inbooleanConsent to marketing.
Codes de statut
422Validation failed: {status: false, message, errors}.429OTP_COOLDOWN — one code per minute and five per hour per address. Body has retry_after (seconds); Retry-After header too.
curl -X POST "https://api.conciar.com/connect/v1/auth/register" \
-H "Accept: application/json" \
-H "X-Api-Key: pk_your_publishable_key" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Alex",
"email": "alex@example.com"
}'{
"status": true,
"message": "We emailed you a sign-in code.",
"expires_in": "10 minutes"
}Request a sign-in code
Sends a code to an existing customer. The answer is the same whether or not the address belongs to an account.
Limite de débit: 5/min per IP
Corps
identifierstringobligatoireThe email address.
typestringobligatoireemail. (phone is accepted, but no code is delivered to a phone.)
Codes de statut
422Validation failed: {message, errors}.429OTP_COOLDOWN, with retry_after.
curl -X POST "https://api.conciar.com/connect/v1/auth/otp/request" \
-H "Accept: application/json" \
-H "X-Api-Key: pk_your_publishable_key" \
-H "Content-Type: application/json" \
-d '{
"identifier": "alex@example.com",
"type": "email"
}'{
"status": true,
"message": "If this belongs to an account, we sent it a sign-in code.",
"expires_in": "10 minutes"
}Verify a code and get an access token
Returns the customer and a personal access token (valid 6 months; there is no refresh token — sign in again when it expires).
Limite de débit: 20/min per IP
Corps
identifierstringobligatoireThe email address the code was sent to.
typestringobligatoireemail. (phone is accepted, but codes are only ever emailed.)
codestringobligatoireThe 6-digit code.
Codes de statut
401{status: false, message, attempts_remaining} — wrong, expired or used-up code.422Validation failed: {message, errors}.
Bon à savoir
- Verifying an emailed code also links earlier guest orders placed here with that email to the account; linked_orders counts them and the stamps and points they brought.
curl -X POST "https://api.conciar.com/connect/v1/auth/otp/verify" \
-H "Accept: application/json" \
-H "X-Api-Key: pk_your_publishable_key" \
-H "Content-Type: application/json" \
-d '{
"identifier": "alex@example.com",
"type": "email",
"code": "123456"
}'{
"status": true,
"data": {
"customer": {
"id": 4242,
"first_name": "Alex",
"last_name": null,
"email": "alex@example.com",
"organization_customer_id": 77,
"shipping_addresses": [],
"phones": []
},
"access_token": "your_customer_access_token",
"token_type": "Bearer",
"linked_orders": {
"count": 0,
"stamps": 0,
"points": 0,
"queued": 0
}
}
}Resend a sign-in code
Same parameters and answers as requesting a code; the previous code stops working.
Limite de débit: 5/min per IP
Corps
identifierstringobligatoireThe email address.
typestringobligatoireemail. (phone is accepted, but no code is delivered to a phone.)
Codes de statut
422Validation failed: {message, errors}.429OTP_COOLDOWN, with retry_after.
curl -X POST "https://api.conciar.com/connect/v1/auth/otp/resend" \
-H "Accept: application/json" \
-H "X-Api-Key: pk_your_publishable_key" \
-H "Content-Type: application/json" \
-d '{
"identifier": "alex@example.com",
"type": "email"
}'{
"status": true,
"message": "If this belongs to an account, we sent it a new sign-in code.",
"expires_in": "10 minutes"
}