Skip to main content

Auth Endpoints

These endpoints manage account registration, login, session tokens, and password resets. Auth endpoints use standard JSON request/response bodies and do not require an API key — they are used to obtain JWT Bearer tokens for portal management endpoints.

POST /api/auth/register

Register a new organization and owner account. Sends an email verification link to the owner's email address.

Rate limit: 3 requests / hour / IP

Request

POST https://api.pdfcanon.com/api/auth/register
Content-Type: application/json
FieldTypeRequiredDescription
orgNamestringDisplay name for the organization
orgSlugstringURL-safe identifier for the organization
ownerEmailstring (email)Email address for the owner account
ownerPasswordstringPassword (minimum 8 characters)
captchaTokenstringNoCAPTCHA verification token

Responses

StatusDescription
200Organization and owner created; verification email sent
400Validation error (invalid email, slug taken, weak password)

Example

curl -X POST https://api.pdfcanon.com/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"orgName": "Acme Corp",
"orgSlug": "acme",
"ownerEmail": "admin@acme.com",
"ownerPassword": "s3cur3passw0rd"
}'

POST /api/auth/login

Authenticate with email and password. Returns a short-lived JWT access token and sets an HttpOnly refresh cookie.

Rate limit: 5 requests / 15 min / IP

Request

POST https://api.pdfcanon.com/api/auth/login
Content-Type: application/json
FieldTypeRequiredDescription
emailstring (email)Account email address
passwordstringAccount password

Response (200 OK)

FieldTypeDescription
access_tokenstringShort-lived JWT access token
token_typestringAlways "Bearer"
expires_inintegerToken lifetime in seconds

An HttpOnly refresh_token cookie is also set.

StatusDescription
200Login successful; access token returned
401Invalid email or password

Example

curl -X POST https://api.pdfcanon.com/api/auth/login \
-H "Content-Type: application/json" \
-c cookies.txt \
-d '{
"email": "admin@acme.com",
"password": "s3cur3passw0rd"
}'

POST /api/auth/refresh

Exchange the HttpOnly refresh cookie for a new short-lived access token. No request body is required — the refresh token is read from the cookie.

Request

POST https://api.pdfcanon.com/api/auth/refresh

The HttpOnly refresh_token cookie must be present (set during login).

Response (200 OK)

Returns the same structure as login: access_token, token_type, expires_in.

StatusDescription
200New access token issued
401Refresh token missing, invalid, or expired

Example

curl -X POST https://api.pdfcanon.com/api/auth/refresh \
-b cookies.txt \
-c cookies.txt

POST /api/auth/logout

Invalidate the current session. Clears the refresh cookie.

Request

POST https://api.pdfcanon.com/api/auth/logout
Authorization: Bearer <access_token>

Response

StatusDescription
200Session invalidated

Example

curl -X POST https://api.pdfcanon.com/api/auth/logout \
-H "Authorization: Bearer eyJ..." \
-b cookies.txt

POST /api/auth/forgot-password

Request a password reset email. Always returns 200 to prevent account enumeration — the response does not reveal whether the email address is registered.

Rate limit: 3 requests / hour / IP

Request

POST https://api.pdfcanon.com/api/auth/forgot-password
Content-Type: application/json
FieldTypeRequiredDescription
emailstring (email)Email address to send the reset link to

Response

StatusDescription
200Request accepted (email sent if address is registered)

Example

curl -X POST https://api.pdfcanon.com/api/auth/forgot-password \
-H "Content-Type: application/json" \
-d '{"email": "admin@acme.com"}'

POST /api/auth/reset-password

Reset a password using the token delivered in the reset email.

Request

POST https://api.pdfcanon.com/api/auth/reset-password
Content-Type: application/json
FieldTypeRequiredDescription
tokenstringPassword reset token from the email link
newPasswordstringNew password (minimum 8 characters)

Response

StatusDescription
200Password updated
400Token invalid, expired, or new password too short

Example

curl -X POST https://api.pdfcanon.com/api/auth/reset-password \
-H "Content-Type: application/json" \
-d '{
"token": "abc123resettoken",
"newPassword": "newS3cur3pass!"
}'