LogstackLogstack

Authentication API

User authentication endpoints for Logstack.

Authentication API

Endpoints for user registration, login, and token management.

POST /v1/auth/signup

Create a new user account.

Request

curl -X POST https://api.logstack.tech/v1/auth/signup \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "securepassword123"
  }'

Request Body

FieldTypeRequiredDescription
emailstringValid email address
passwordstringMinimum 8 characters

Response (201 Created)

{
  "user": {
    "id": "usr_abc123xyz789",
    "email": "user@example.com",
    "createdAt": "2024-01-15T10:30:00Z"
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIs...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIs..."
}

POST /auth/login

Authenticate an existing user.

Request

curl -X POST https://api.logstack.tech/v1/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "user@example.com",
    "password": "securepassword123"
  }'

Response (200 OK)

{
  "user": {
    "id": "usr_abc123xyz789",
    "email": "user@example.com",
    "createdAt": "2024-01-15T10:30:00Z"
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIs...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIs..."
}

Errors

StatusCodeDescription
401INVALID_CREDENTIALSEmail or password incorrect
429RATE_LIMITEDToo many login attempts

POST /auth/refresh

Refresh an expired access token.

Request

curl -X POST https://api.logstack.tech/v1/auth/refresh \
  -H "Content-Type: application/json" \
  -d '{
    "refreshToken": "eyJhbGciOiJIUzI1NiIs..."
  }'

Response (200 OK)

{
  "accessToken": "eyJhbGciOiJIUzI1NiIs...",
  "refreshToken": "eyJhbGciOiJIUzI1NiIs..."
}

Refresh tokens are single-use. A new refresh token is returned with each refresh request.


POST /auth/logout

Invalidate the current refresh token.

Request

curl -X POST https://api.logstack.tech/v1/auth/logout \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "refreshToken": "eyJhbGciOiJIUzI1NiIs..."
  }'

Response (204 No Content)

No response body.


GET /auth/me

Get the current authenticated user.

Request

curl https://api.logstack.tech/v1/auth/me \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

Response (200 OK)

{
  "id": "usr_abc123xyz789",
  "email": "user@example.com",
  "createdAt": "2024-01-15T10:30:00Z",
  "subscription": {
    "plan": "pro",
    "status": "active",
    "periodEnd": "2024-02-15T10:30:00Z"
  }
}

Token Expiration

Token TypeExpirationConfigurable
Access Token15 minutesACCESS_TOKEN_EXPIRY env var
Refresh Token7 daysREFRESH_TOKEN_EXPIRY env var

Security Best Practices

  1. Store tokens securely — Use HttpOnly cookies or secure storage
  2. Refresh proactively — Refresh before expiration to avoid interruptions
  3. Handle rotation — Always use the newest refresh token
  4. Logout on suspicious activity — Invalidate tokens if compromise suspected