Build email and password authentication
Use these JSON endpoints to register users, verify email, sign in and recover passwords with your own form. Signup uses your application's public client ID and requires no registration key, developer token or OAuth client secret. Keep client/workspace context consistent across the flow. For a form hosted by SyAuth, use OAuth hosted sign-in.
Choose this guide if you are testing direct API requests or a developer is building your own login form. The commands below display responses in a terminal; they do not display a registration page, login screen or success page in the browser. To try those screens without an app, use the manual hosted-login test.
Replace the placeholders and sample email/password directly, keeping the surrounding quotes. No environment setup is required. Windows examples use Command Prompt (CMD). Follow the steps in order: verification uses the user created in step 1, and profile access uses the token returned in step 3.
Before you start
Complete dashboard setup, including an application and an email_verification template in the same workspace. Prepare these values:
| Value in the examples | What to use |
|---|---|
YOUR_PUBLIC_CLIENT_ID | The application's OAuth client_id from Applications, not the configuration record's id. The oauth_client field uses this value even for a confidential client. |
[email protected] | Replace every occurrence with the same real email address you control. The example address cannot receive mail. |
ExamplePass!7264X | Replace every occurrence with your test user's password. For SyAuth-managed users, use at least 12 characters, including uppercase, lowercase, a number and a special character. Set confirm_password to the same value. |
CODE_FROM_EMAIL | The code sent after creating this user or resending verification. Keep it as a string, including any leading zeros. |
YOUR_APPLICATION_TOKEN | The token from a completed login in step 3; it is not your developer token or client secret. |
Keep the same email and oauth_client through signup, verification, login and password recovery.
Run commands in Terminal on macOS/Linux or Command Prompt on Windows. Use the tab for your system, copy the whole command after replacing sample values, and press Enter. The first API call guide explains how to check that curl is available. Each response starts with an HTTP status and then a JSON body. If a step fails, read the error and correct it before running the next step.
1. Prepare a user
Enable Allow email and password signup for your application in Applications. The application and its workspace must be active, with available capacity in the workspace owner's plan. Machine-to-machine-only applications do not support end-user signup.
Send the application's public client_id as oauth_client. Do not send a workspace, developer_id, verification status, roles or other management fields. The server resolves the workspace from the application. first_name and last_name are required; the six fields shown below form the public signup contract.
- macOS / Linux
- Windows (CMD)
curl -i "https://api.syauth.com/e/v1/register/" \
-H 'Content-Type: application/json' \
--data-raw '{"oauth_client":"YOUR_PUBLIC_CLIENT_ID","email":"[email protected]","password":"ExamplePass!7264X","confirm_password":"ExamplePass!7264X","first_name":"Alex","last_name":"Developer"}'
curl.exe -i "https://api.syauth.com/e/v1/register/" -H "Content-Type: application/json" --data-raw "{\"oauth_client\":\"YOUR_PUBLIC_CLIENT_ID\",\"email\":\"[email protected]\",\"password\":\"ExamplePass!7264X\",\"confirm_password\":\"ExamplePass!7264X\",\"first_name\":\"Alex\",\"last_name\":\"Developer\"}"
For SyAuth-managed users, expect 201, requires_verification: true and verification_managed_by: "syauth". No token is issued at signup. Creation does not guarantee email delivery: continue at step 2 and use the resend request if needed.
For browser forms, add the form's origin to the application's Allowed web origins. Use an exact scheme, host and optional port, for example https://app.example.com; callback origins are also accepted. An origin belonging to another application is insufficient. Server-to-server requests can omit Origin.
Email uniqueness is scoped to the workspace: applications in the same workspace share users, while the same email can register in a different workspace. If a user already exists, continue with verification/login rather than submitting signup again. You can also prepare a test user through the dashboard or management API, which is an administrative operation.
With an active custom database, signup creates the user there. The response uses requires_verification: false and verification_managed_by: "external_database": verification belongs to that external system, and the flag does not certify that the email is verified. An unhealthy database never falls back to local storage. If a write times out, its result remains pending; a retry checks the previous write instead of creating another account. Try signing in or ask the workspace administrator to resolve a pending operation.
2. Verify the email
If the user is already marked email verified, continue at step 3. Otherwise, replace CODE_FROM_EMAIL with the actual code delivered to the mailbox used in step 1. Use the same email and OAuth client:
- macOS / Linux
- Windows (CMD)
curl -i "https://api.syauth.com/e/v1/email/verify/" \
-H 'Content-Type: application/json' --data-raw '{"email":"[email protected]","code":"CODE_FROM_EMAIL","oauth_client":"YOUR_PUBLIC_CLIENT_ID"}'
curl.exe -i "https://api.syauth.com/e/v1/email/verify/" -H "Content-Type: application/json" --data-raw "{\"email\":\"[email protected]\",\"code\":\"CODE_FROM_EMAIL\",\"oauth_client\":\"YOUR_PUBLIC_CLIENT_ID\"}"
Expect 200 with {"message":"Email verified successfully"}. If you need a new code, send this request, then retry verification with the code from the new email:
- macOS / Linux
- Windows (CMD)
curl -i "https://api.syauth.com/e/v1/email/verify/resend/" \
-H 'Content-Type: application/json' \
--data-raw '{"email":"[email protected]","oauth_client":"YOUR_PUBLIC_CLIENT_ID"}'
curl.exe -i "https://api.syauth.com/e/v1/email/verify/resend/" -H "Content-Type: application/json" --data-raw "{\"email\":\"[email protected]\",\"oauth_client\":\"YOUR_PUBLIC_CLIENT_ID\"}"
See email troubleshooting when delivery fails. A verification code is sent by SyAuth; do not generate it yourself or reuse a password-reset code here.
3. Sign in
Use the verified application's user email and password from step 1. Your dashboard account credentials do not sign in this user.
- macOS / Linux
- Windows (CMD)
curl -i "https://api.syauth.com/e/v1/login/" \
-H 'Content-Type: application/json' --data-raw '{"email":"[email protected]","password":"ExamplePass!7264X","oauth_client":"YOUR_PUBLIC_CLIENT_ID","remember_me":false}'
curl.exe -i "https://api.syauth.com/e/v1/login/" -H "Content-Type: application/json" --data-raw "{\"email\":\"[email protected]\",\"password\":\"ExamplePass!7264X\",\"oauth_client\":\"YOUR_PUBLIC_CLIENT_ID\",\"remember_me\":false}"
A completed login returns user data, token, refresh_token, and message: "Login successful". Copy the full token value from the JSON response for step 4. If mfa_required is true, login is pending: use mfa_ticket and the available methods to complete the challenge. Do not create an authenticated application session from a challenge response. Review MFA availability before enabling it.
For the first test without MFA, the expected result is a completed login with token. If instead you see mfa_required, the command has reached an extra sign-in check, not completed login. Follow the supported MFA flow or ask the developer responsible for that configuration; do not copy the ticket into the profile request as a token.
4. Fetch the profile
Use the value returned in token:
- macOS / Linux
- Windows (CMD)
curl -i "https://api.syauth.com/e/v1/user/profile/" \
-H "Authorization: Bearer YOUR_APPLICATION_TOKEN"
curl.exe -i "https://api.syauth.com/e/v1/user/profile/" -H "Authorization: Bearer YOUR_APPLICATION_TOKEN"
Expect 200 with this application user's profile. Store authentication state according to your application architecture; do not log tokens or include them in URLs. These application tokens cannot be refreshed using the OAuth token endpoint; use the OAuth flow if you need its documented refresh lifecycle.
Check that the returned user ID/email belongs to your test user. You have completed the basic API test when signup or existing-user preparation, verification, login and profile retrieval all succeed. The password-recovery test below is a separate check; it changes this test user's password.
5. Test password recovery
Create the workspace's reset_password email template first. Request a reset for the same user and client:
- macOS / Linux
- Windows (CMD)
curl -i "https://api.syauth.com/e/v1/password/reset/" \
-H 'Content-Type: application/json' \
--data-raw '{"email":"[email protected]","oauth_client":"YOUR_PUBLIC_CLIENT_ID"}'
curl.exe -i "https://api.syauth.com/e/v1/password/reset/" -H "Content-Type: application/json" --data-raw "{\"email\":\"[email protected]\",\"oauth_client\":\"YOUR_PUBLIC_CLIENT_ID\"}"
Generic HTTP 200 responses intentionally do not reveal whether an account exists and do not prove email delivery. Copy the code from the password-reset email into RESET_CODE_FROM_EMAIL. Replace YOUR_NEW_PASSWORD in both fields with the same new password meeting the policy above, then submit:
- macOS / Linux
- Windows (CMD)
curl -i "https://api.syauth.com/e/v1/password/reset/confirm/" \
-H 'Content-Type: application/json' \
--data-raw '{"email":"[email protected]","code":"RESET_CODE_FROM_EMAIL","new_password":"YOUR_NEW_PASSWORD","confirm_password":"YOUR_NEW_PASSWORD","oauth_client":"YOUR_PUBLIC_CLIENT_ID"}'
curl.exe -i "https://api.syauth.com/e/v1/password/reset/confirm/" -H "Content-Type: application/json" --data-raw "{\"email\":\"[email protected]\",\"code\":\"RESET_CODE_FROM_EMAIL\",\"new_password\":\"YOUR_NEW_PASSWORD\",\"confirm_password\":\"YOUR_NEW_PASSWORD\",\"oauth_client\":\"YOUR_PUBLIC_CLIENT_ID\"}"
After a successful reset, repeat step 3 using the new password. A completed login with that password is the final check that recovery worked. Verification codes and reset codes have different purposes; use the code from the matching email.
Profile changes and common errors
Authenticated password changes use /user/password/update/; profile PATCH does not accept passwords. Passwords for SyAuth-managed users must meet the service policy, including at least 12 characters and uppercase, lowercase, numeric and special characters. Display returned validation errors rather than assuming length alone is sufficient.
| Where you are stuck | Next action |
|---|---|
| Signup asks for an API key | Check that the deployment supports public signup and send oauth_client; the public contract requires no registration key |
registration_unavailable | Check the client ID, active workspace/application and signup setting; an existing email in this workspace must use verification/login |
| HTTP 403 on signup | Check the browser origin or ask the workspace owner to check plan capacity |
| HTTP 429 | Respect Retry-After before retrying |
| HTTP 503 | Registration dependencies are temporarily unavailable or an external write is pending; do not switch workspaces or generate arbitrary keys |
| Account already exists | Use verification/login for that user; do not repeat signup |
| Verification email is missing | Check your real recipient address, workspace, client and template; use the resend request above |
| Code is invalid or expired | Request a fresh code for the same purpose, email and client, then use it before expiry |
| Profile returns 401 | Use the full token from a completed application login, keeping Authorization: Bearer |
See the authentication reference for schemas, status codes and custom-database variations.