Skip to main content
GET
/
api
/
loyalty
/
account_streaks
JavaScript
import SnagSolutions from '@snagsolutions/sdk';

const client = new SnagSolutions({
  apiKey: 'My API Key',
});

const response = await client.loyalty.accountStreaks.getStreaks({
  loyaltyRuleId:
    'loyaltyRuleId=123e4567-e89b-12d3-a456-426614174001&loyaltyRuleId=123e4567-e89b-12d3-a456-426614174002',
});

console.log(response);
[
  {
    "id": "123e4567-e89b-12d3-a456-426614174001",
    "createdAt": "2025-01-01T00:00:00.000Z",
    "updatedAt": "2025-01-01T00:00:00.000Z",
    "expiresAt": "2025-01-01T00:00:00.000Z",
    "streakCount": 10,
    "userId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "loyaltyRuleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "walletAddress": "<string>",
    "milestone": [
      {
        "streakMilestone": 123,
        "streakAmount": 123
      }
    ]
  }
]

Authorizations

X-API-KEY
string
header
required

Query Parameters

userId
string<uuid>

User id to filter by

Example:

"123e4567-e89b-12d3-a456-426614174001"

walletAddress
string

Wallet address to filter by

Example:

"0x1234567890123456789012345678901234567890"

loyaltyRuleId
required

Loyalty rule id(s) to filter by, array or single id

Example:

"loyaltyRuleId=123e4567-e89b-12d3-a456-426614174001&loyaltyRuleId=123e4567-e89b-12d3-a456-426614174002"

startingAfter
string

Pagination cursor to start after a specific resource ID

Example:

"123e4567-e89b-12d3-a456-426614174010"

limit
number
default:10

Maximum number of records to return (max 1000)

Required range: 1 <= x <= 1000
Example:

50

Response

200

Response schema for getting loyalty account streaks, null if no streak

id
string<uuid> | null
required

ID of the loyalty account streak, null if no streak yet

Example:

"123e4567-e89b-12d3-a456-426614174001"

createdAt
string | null
required

Date and time the streak was created, null if no streak yet

Example:

"2025-01-01T00:00:00.000Z"

updatedAt
string | null
required

Date and time the streak was last updated, null if no streak yet

Example:

"2025-01-01T00:00:00.000Z"

expiresAt
string | null
required

Date and time the streak expires, null if no streak yet

Example:

"2025-01-01T00:00:00.000Z"

streakCount
number
required

Number of days in the streak, 0 if no streak

Example:

10

userId
string<uuid>
required
loyaltyRuleId
string<uuid>
required
walletAddress
string
required
milestone
object[]
required
I