User Auth
JWT-based authentication for the console and custom UIs built on top of the Pharlo.
For server-to-server integrations, use API keys instead — see Authentication. JWT auth is intended for end-user sessions, not automated backends.
Base URL: https://pharlo.io
How it works
- Register or log in to receive a JWT token.
- Include the token as
Authorization: Bearer <token>on every protected request. - Tokens expire after a fixed period — re-call
/loginto get a fresh one.
JWT tokens identify a user, while API keys identify a workspace client. Use JWT when your integration involves human accounts (console UI, custom admin panels). Use API keys for everything else.
Endpoints
| Method | Path | Auth required | Description | Status |
|---|---|---|---|---|
| POST | /api/v1/auth/register | — | Register a new user, returns JWT | 201 |
| POST | /api/v1/auth/login | — | Authenticate, returns JWT | 200 |
| GET | /api/v1/auth/me | JWT | Current user profile | 200 |
| PATCH | /api/v1/auth/profile | JWT | Update profile fields | 200 |
| POST | /api/v1/auth/change-password | JWT | Change password | 200 |
POST /api/v1/auth/register
Creates a new user account and returns a JWT token immediately — no separate login step required.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Must be a valid email address and unique across the platform |
password | string | Yes | Minimum 8 characters |
name | string | Yes | Display name shown in the console |
Example request
curl -X POST https://pharlo.io/api/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "you@example.com",
"password": "your-password",
"name": "Your Name"
}'Response 201 Created
| Field | Type | Description |
|---|---|---|
token | string | JWT token — use this as Authorization: Bearer <token> |
user.id | UUID | Unique user identifier |
user.email | string | Registered email address |
user.name | string | Display name |
{
"token": "eyJhbGciOiJSUzI1NiJ9...",
"user": {
"id": "018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f",
"email": "you@example.com",
"name": "Your Name"
}
}POST /api/v1/auth/login
Authenticates an existing user and returns a fresh JWT token.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Registered email address |
password | string | Yes | Account password |
Example request
curl -X POST https://pharlo.io/api/v1/auth/login \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "password": "your-password"}'Response 200 OK
{
"token": "eyJhbGciOiJSUzI1NiJ9..."
}Pass the token as Authorization: Bearer <token> on all subsequent authenticated requests. Tokens expire after a fixed period — re-call this endpoint to get a new one. There is no refresh token mechanism; re-authentication is required when the token expires.
GET /api/v1/auth/me
Returns the authenticated user's profile.
Requires Authorization: Bearer <token> header. Returns 401 if the token is missing or expired.
Example request
curl https://pharlo.io/api/v1/auth/me \
-H "Authorization: Bearer $JWT_TOKEN"Response 200 OK
| Field | Type | Description |
|---|---|---|
id | UUID | Unique user identifier |
email | string | Email address |
name | string | Display name |
locale | string | Preferred locale code (e.g. en, uk) |
timezone | string | IANA timezone string (e.g. Europe/Kyiv) |
{
"id": "018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f",
"email": "you@example.com",
"name": "Your Name",
"locale": "en",
"timezone": "Europe/Kyiv"
}PATCH /api/v1/auth/profile
Updates one or more profile fields for the authenticated user. All fields are optional — only send the fields you want to change.
Requires Authorization: Bearer <token> header. Returns 401 if the token is missing or expired.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Display name |
locale | string | No | Locale code (e.g. en, uk) |
timezone | string | No | IANA timezone string (e.g. Europe/Kyiv, America/New_York) |
avatarUrl | string | No | Publicly accessible URL pointing to the user's avatar image |
Example request
curl -X PATCH https://pharlo.io/api/v1/auth/profile \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "New Name", "timezone": "America/New_York"}'Response 200 OK
Returns the full updated profile object. Same shape as GET /auth/me.
{
"id": "018e1f3a-7c2b-7000-8f4d-1a2b3c4d5e6f",
"email": "you@example.com",
"name": "New Name",
"locale": "en",
"timezone": "America/New_York"
}POST /api/v1/auth/change-password
Changes the authenticated user's password. Requires the current password for verification — this prevents unauthorized changes even if the JWT is compromised.
Requires Authorization: Bearer <token> header. Returns 401 if the token is missing or expired.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
currentPassword | string | Yes | The user's existing password — used to confirm identity |
newPassword | string | Yes | The new password. Minimum 8 characters |
Example request
curl -X POST https://pharlo.io/api/v1/auth/change-password \
-H "Authorization: Bearer $JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"currentPassword": "old-password", "newPassword": "new-password"}'Response 200 OK
{
"message": "Password changed successfully"
}The existing JWT token remains valid until it naturally expires. If you want to invalidate all active sessions immediately after a password change, prompt the user to log in again.
Error responses
Authentication errors
| Status | Reason |
|---|---|
401 | Missing, malformed, or expired JWT token on a protected endpoint |
403 | Token is valid but the user lacks permission for the action |
Validation errors
| Status | Endpoint | Reason |
|---|---|---|
400 | /register | Email already in use, invalid format, or password too short |
400 | /login | Wrong email or password |
400 | /change-password | currentPassword is incorrect, or newPassword is too short |
400 | /profile | Invalid timezone value or malformed avatarUrl |
All validation errors follow the standard error format:
{
"error": "Validation failed",
"details": {
"email": ["This value is already used."],
"password": ["This value is too short. It should have 8 characters or more."]
}
}See Error Handling for the full list of error codes and how to handle them in your integration.
See also
- Authentication guide — API key auth, JWT overview, and when to use each method
- OAuth / Channel Connect — connecting YouTube and Facebook channels via OAuth 2.0
- Organizations — managing organizations within a workspace
- Invitations — inviting users to join an organization