API Endpoints
The Audience API provides user-facing endpoints for end-users to interact with their loyalty profiles, view transactions, manage notifications, redeem products, and track challenge progress. This API is designed for integration with mobile apps, web applications, and other user-facing platforms.
Overview
Key Features:
User profile management
Transaction history viewing
Product browsing and redemption
Notification system
Challenge tracking
Internal bulk operations for administrative tasks
Authentication: All audience endpoints require JWT authentication with appropriate scopes.
User-Facing Endpoints
Get User Profile
Retrieve the authenticated user's profile, loyalty data, and active challenges.
GET /v1/audience/profileRequired Scope: audience:read
Example Request:
Example Response:
Update User Profile
Update the authenticated user's profile information.
Required Scope: audience:write
Request Body:
displayName
string
No
User's display name
firstName
string
No
First name
lastName
string
No
Last name
avatarUrl
string
No
Avatar image URL
customFields
object
No
Custom profile fields
Example Request:
Example Response:
Transaction History
List User Transactions
View the authenticated user's transaction history.
Required Scope: audience:read
Query Parameters:
type
string
No
Filter by type: points, xp, coins
limit
number
No
Number of results (default: 20, max: 50)
offset
number
No
Offset for pagination (default: 0)
Example Request:
Example Response:
Challenge Tracking
List User Challenges
View the authenticated user's active and completed challenges.
Required Scope: audience:read
Query Parameters:
status
string
No
Filter by status: active, completed, expired
Example Request:
Example Response:
Product Management
List Available Products
Browse products available for redemption.
Required Scope: audience:read
Query Parameters:
type
string
No
Filter by type: badge, merchandise, ticket, entry
category
string
No
Filter by category
inStockOnly
boolean
No
Show only in-stock products (default: true)
limit
number
No
Number of results (default: 20)
Example Request:
Example Response:
Redeem Product
Redeem a product using points or coins.
Required Scope: audience:write
Request Body:
productId
string
Yes
Product ID to redeem
quantity
number
No
Quantity to redeem (default: 1)
deliveryAddress
object
No
Delivery address for physical products
Example Request:
Example Request (Physical Product with Delivery):
Example Response:
Notifications
List User Notifications
Get the authenticated user's notifications.
Required Scope: audience:read
Query Parameters:
unread
boolean
No
Show only unread notifications
limit
number
No
Number of results (default: 20, max: 50)
offset
number
No
Offset for pagination
Example Request:
Example Response:
Mark Notification as Read
Mark a notification as read.
Required Scope: audience:write
Path Parameters:
notificationId
string
Yes
Notification ID
Example Request:
Example Response:
Internal Bulk Operations
These endpoints are for internal/administrative use and require elevated permissions.
Report User Action
Report a user action for campaign processing (internal use).
Request Body:
userId
string
Yes
User ID
actionType
string
Yes
Action type (e.g., video_watched, poll_voted)
metadata
object
No
Action metadata
Example Request:
Bulk Report Actions
Report multiple user actions in a single request (internal use).
Request Body:
actions
array
Yes
Array of action objects
Example Request:
Get Batch User Profiles
Retrieve multiple user profiles in a single request (internal use).
Query Parameters:
userIds
string
Yes
Comma-separated list of user IDs
Example Request:
Update Batch User Profiles
Update multiple user profiles in a single request (internal use).
Search Users
Search for users based on criteria (internal use).
Query Parameters:
query
string
No
Search query (email, name, userId)
tier
string
No
Filter by tier
minPoints
number
No
Minimum points
limit
number
No
Number of results
Bulk Grant Rewards
Grant rewards to multiple users (internal use).
Create User Export
Create a bulk export of user data (internal use).
Get Export Status
Check the status of a user data export (internal use).
Error Responses
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
409 Conflict
Authentication & Authorization
JWT Scopes
Audience endpoints require JWT authentication with specific scopes:
audience:read- Read user profile, transactions, challenges, notificationsaudience:write- Update profile, redeem products, mark notifications readaudience:admin- Internal bulk operations (admin only)
Example JWT Payload
Best Practices
JWT Management: Implement proper JWT token refresh mechanisms
Error Handling: Handle insufficient balance errors gracefully
Notifications: Poll notifications periodically or use webhooks
Product Availability: Check stock levels before allowing redemption
Transaction History: Paginate transaction lists for performance
Challenge Progress: Update challenge UI in real-time when steps complete
Related APIs
User Profiles API - Admin profile management
Products API - Product catalog management
Campaigns API - Challenge configuration
Transactions API - Transaction management
Support
For questions about the Audience API:
Documentation: https://products.monterosa.co/mic/reference
Support: support@monterosa.co
Last updated

