Getting and Managing Your API Key
MomentScience provides a suite of APIs for offer delivery, offer management, and performance reporting. This guide explains how to get your API key, understand scope permissions, explore available endpoints, manage existing keys, and troubleshoot common issues.
Overview
In this guide, you will learn how to:
- Generate an API key from your account
- Assign scopes to control access
- Explore supported API endpoints
- Modify, regenerate, or delete existing keys
Generate your API key
To use MomentScience APIs, youโll need an API key tied to your account.
- Click Generate API Key.
- Enter a descriptive name (e.g., "Test Key" or "Production Key").
- Select the appropriate scopes based on the APIs you'll use.
- Click Generate to create the key.
After creation, securely copy the key and add it to your environment configuration.
If you need further assistance, you can refer to the quick playable demo for a visual guide on how to generate your API Key.
API Scopes
Scopes define the permissions granted to an API key. You can assign multiple scopes to the same key, depending on the needs of your integration. Select only the scopes required for your use case.
Scope | Description |
|---|---|
Ads/Offers | Grants access to the MomentPerks, Perkswall, and Offer Catalog APIs. Use this scope to retrieve and display available offers. |
Reports | Provides access to the Reporting API, enabling retrieval of detailed analytics, including impressions, clicks, revenue, click-through rates (CTR), and other performance data. |
Configurations | Allows programmatic updates to account-level configurations such as themes, branding, and general settings. |
Offers Management | Enables the creation, editing, and status control of offers. You can update both endemic and third-party offers, including setting them to "Paused" or "Active," or editing creative elements like headlines and descriptions. |
Accounts | Grants permission to create and update sub-accounts within your organization. |
PerksWallet | Authorizes access to the PerksWallet feature ( save for later). This scope allows the API key to authenticate and manage saved offers, including deletion. |
Managing API keys
Once an API key is created, you can update its name and scopes, regenerate it to invalidate the current value, or delete it if it's no longer needed.
Modify an existing API key
- Click the Action menu next to the API key you want to modify.
- Select Modify API Access.
- Edit the keyโs name or adjust its scopes.
- Click Update to save changes.
Regenerate an API key
Regenerating a key disables the old one and generates a new value immediately.
- From the Action menu, select Regenerate API Key.
- A new key will be shown. The previous key will no longer be valid.
- Copy and store the new key securely.
Delete an API key
To permanently delete an API key:
- Click the Action menu next to the key you want to remove.
- Select Delete API Key.
- Click Confirm to finalize the deletion.
Deleted API keys cannot be recovered. Make sure the key is no longer in use before deleting.
Current Endpoints
The following endpoints are available based on the scopes assigned to your API key:
API | Purpose | Endpoint | Required Scope |
|---|---|---|---|
Moments API | Serve offers during key moments in the user journey (e.g. after checkout or reward unlock). | POST/native/v2/offers.json | Ads/Offers |
Perkswall API | Retrieve all Perkswall-enabled offers for building a branded offer gallery. | POST/native/v4/perkswall.json | Ads/Offers |
Offer Catalog API | Get a real-time JSON feed of all active offers, including creatives and tracking metadata. | GET/native/v3/catalog.json | Ads/Offers |
Reporting API | Access detailed performance data including impressions, revenue, clicks, and eCPM. | GETnative/activity.json | Reports |
Security Best Practices
Storage Guidelines:
// โ Never expose API keys in client-side code
const apiKey = 'pk_live_abcd1234...'; // Visible to users
// โ
Use environment variables for server-side code
const apiKey = process.env.MOMENTSCIENCE_API_KEY;
// โ
Use secure storage for mobile apps
const apiKey = await SecureStore.getItemAsync('ms_api_key');Key Rotation:
- Rotate API keys regularly (recommended: every 90 days)
- Implement graceful key transitions in production
- Monitor key usage for anomalies
If you have any questions during setup or integration, reach out to us at [email protected]. We're here to support you.