Skip to main content

curl Examples

Once your Authenik8 server is running locally, you can test endpoints immediately using curl or any API client.

Base URL: http://localhost:3000


POST /auth/login

Authenticate a user and receive access + refresh tokens.

curl -X POST http://localhost:3000/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"test@test.com","password":"password123"}'

Response:

{
"accessToken": "your-access-token",
"refreshToken": "your-refresh-token"
}

POST /auth/refresh

Get a new access token using a refresh token.

curl -X POST http://localhost:3000/auth/refresh \
-H "Content-Type: application/json" \
-d '{"refreshToken":"your-refresh-token"}'

Response:

{
"accessToken": "new-access-token",
"refreshToken": "new-refresh-token"
}

GET /protected

Use the access token to access protected endpoints.

curl http://localhost:3000/protected \
-H "Authorization: Bearer your-access-token"

Response:

{
"message": "Authenticated",
"user": { "id": "...", "role": "user" }
}

POST /auth/register (Auth mode only)

Only available when email/password authentication is enabled.

curl -X POST http://localhost:3000/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"test@test.com","password":"password123"}'

Response:

{
"message": "User registered",
"userId": "..."
}

Notes

  • Replace tokens with actual values returned from your API
  • The /auth routes are available in password and password + OAuth templates
  • The JWT-only template uses POST /refresh instead of /auth/refresh
  • Use tools like Postman or Insomnia if preferred