Get endpoints
Get User History | Lynes Loyalty API

Get User Activity History

This endpoint returns a comprehensive history of all activities completed by a specific user, giving you a complete picture of their engagement with your gamification features.

Endpoint

GET /user/{userId}/history

Authentication

⚠️

Authentication Required

This endpoint requires a valid JWT token with appropriate permissions.

See our JWT Authentication guide for more details.

Path Parameters

ParameterTypeRequiredDescription
userIdstringYesThe unique identifier of the user

Query Parameters

ParameterTypeRequiredDefaultDescription
limitintegerNo20Number of items to return (max 100)
offsetintegerNo0Number of items to skip (for pagination)
fromstringNo-Start date in ISO format (e.g. "2025-01-01")
tostringNo-End date in ISO format (e.g. "2025-04-07")
typesstringNo-Filter by activity types (comma-separated list)
langstringNoenLanguage code for localized content

Valid types for filtering:

  • event - User completed events
  • redemption - Point redemption activities
  • challenge - Challenge completions
  • streak_milestone - Streak milestone achievements
  • streak_points - Points credited through streaks

Example Request

curl -X GET "https://api.lynesloyalty.com/v1/user/user_123/history?limit=10&types=event,challenge&lang=en" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"

Response

Success Response (200 OK)

{
  "data": [
    {
      "id": "act_123abc",
      "title": "First Purchase",
      "description": "You made your first purchase in our store",
      "points": 50,
      "type": "event",
      "timestamp": 1712491425000,
      "image": "https://assets.lynesloyalty.com/icons/purchase.png"
    },
    {
      "id": "act_124def",
      "title": "First Week Champion",
      "description": "You've completed the first week challenge",
      "points": 200,
      "type": "challenge",
      "timestamp": 1712405130000,
      "image": "https://assets.lynesloyalty.com/badges/week_champion.png"
    },
    {
      "id": "act_125ghi",
      "title": "10% Discount Coupon",
      "description": "You redeemed points for a discount coupon",
      "points": -500,
      "type": "redemption",
      "timestamp": 1712318532000,
      "image": "https://assets.lynesloyalty.com/rewards/discount.png"
    },
    {
      "id": "act_126jkl",
      "title": "One Week Streak",
      "description": "You've logged in for 7 days in a row",
      "points": 0,
      "type": "streak_milestone",
      "timestamp": 1712231122000,
      "image": "https://assets.lynesloyalty.com/streaks/week.png"
    },
    {
      "id": "act_127mno",
      "title": "Daily Login Bonus",
      "description": "You received points for maintaining your login streak",
      "points": 25,
      "type": "streak_points",
      "timestamp": 1712231122000,
      "image": "https://assets.lynesloyalty.com/streaks/points.png"
    }
  ],
  "pagination": {
    "total": 42,
    "limit": 10,
    "offset": 0,
    "has_more": true
  }
}

Error Responses

401 Unauthorized

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or expired authentication token"
  }
}

403 Forbidden

{
  "error": {
    "code": "forbidden",
    "message": "Insufficient permissions to access this resource"
  }
}

404 Not Found

{
  "error": {
    "code": "not_found",
    "message": "User with ID 'user_123' not found"
  }
}

History Event Structure

Each history event in the response follows this structure:

FieldTypeDescription
idstringUnique identifier for the history event
titlestringLocalized title of the event (based on lang parameter)
descriptionstringLocalized description (may be null, based on lang parameter)
pointsintegerPoints earned (positive) or spent (negative)
typestringEvent type (see below for available types)
timestampnumberUnix timestamp in milliseconds
imagestringURL to an image representing the event (may be null)

Activity Types

The history endpoint returns different types of activities:

Event

Records when a user has completed an event:

{
  "title": "First Purchase",
  "description": "You made your first purchase in our store",
  "points": 50,
  "type": "event",
  "timestamp": 1712491425000,
  "image": "https://assets.lynesloyalty.com/icons/purchase.png"
}

Redemption

Records when a user has redeemed points for a reward:

{
  "title": "10% Discount Coupon",
  "description": "You redeemed points for a discount coupon",
  "points": -500,
  "type": "redemption",
  "timestamp": 1712318532000,
  "image": "https://assets.lynesloyalty.com/rewards/discount.png"
}

Challenge

Records when a user has completed a challenge:

{
  "title": "First Week Champion",
  "description": "You've completed the first week challenge",
  "points": 200,
  "type": "challenge",
  "timestamp": 1712405130000,
  "image": "https://assets.lynesloyalty.com/badges/week_champion.png"
}

Streak Milestone

Records when a user has reached a milestone in their streak:

{
  "title": "One Week Streak",
  "description": "You've logged in for 7 days in a row",
  "points": 0,
  "type": "streak_milestone",
  "timestamp": 1712231122000,
  "image": "https://assets.lynesloyalty.com/streaks/week.png"
}

Streak Points

Records when a user has earned points from continuing a streak:

{
  "title": "Daily Login Bonus",
  "description": "You received points for maintaining your login streak",
  "points": 25,
  "type": "streak_points",
  "timestamp": 1712231122000,
  "image": "https://assets.lynesloyalty.com/streaks/points.png"
}