API introduction
Get started with the 2perks API. Learn about authentication and basic endpoints to manage perks and categories for your business.
Get started with the 2perks API. Learn about authentication and basic endpoints to manage perks and categories for your business.
Welcome to the 2perks API! Our simple REST API allows you to manage perks and categories for your business programmatically.
All API requests should be made to:
https://api.2perks.com/api/v1
The API uses API keys for authentication. Generate your API key from your dashboard.
Include your API key in the X-2PERKS-API-KEY
header:
curl -H "X-2PERKS-API-KEY: YOUR_API_KEY" \
https://api.2perks.com/api/v1/categories
⚠️ Important: Keep your API key secure and never expose it in client-side code.
Content-Type: application/json
header for POST/PUT requestsAll responses are JSON with this structure:
{
"success": true,
"data": [
{
"id": "1",
"name": "Food & Dining",
"slug": "food_dining"
}
]
}
{
"success": false,
"message": "Access denied. No API key provided. Include your API key in the 'X-2PERKS-API-KEY' header."
}
Get all available perk categories.
GET /v1/categories
Example:
curl -H "X-2PERKS-API-KEY: YOUR_API_KEY" \
https://api.2perks.com/api/v1/categories
Response:
{
"success": true,
"data": [
{
"id": 1,
"name": "SaaS",
"slug": "saas"
},
{
"id": 2,
"name": "Fintech",
"slug": "fintech"
},
{
"id": 3,
"name": "E-commerce",
"slug": "e-commerce"
},
{
"id": 4,
"name": "Marketing & Advertising",
"slug": "marketing-advertising"
},
{
"id": 5,
"name": "Developer Tools",
"slug": "developer-tools"
}
],
"total": 38
}
Get all perks for a specific organization's perk listing.
GET /v1/orgs/{orgId}/listings/{perkListingId}/perks
Path parameters:
orgId
- The organization IDperkListingId
- The perk listing IDExample:
curl -H "X-2PERKS-API-KEY: YOUR_API_KEY" \
https://api.2perks.com/api/v1/orgs/org123/listings/listing456/perks
Response:
{
"success": true,
"data": [
{
"id": "perk123",
"title": "15% Off Business Class Flights",
"description": "Save 15% on Business Class tickets for international flights with Air France",
"type": "discount",
"value": "15%",
"redemptionMethod": "code",
"code": "BUSINESS15",
"redemptionInstructions": "Enter code at checkout",
"tags": ["travel", "business", "international"],
"ctaButtonLabel": "Book Flight",
"org": {
"name": "Air France",
"logo": "https://api.2perks.com/api/files/logo123",
"website": "https://airfrance.com",
"category": "travel-hospitality"
}
}
]
}
Code | Description |
---|---|
UNAUTHORIZED |
Invalid or missing API key |
FORBIDDEN |
Insufficient permissions |
NOT_FOUND |
Resource not found |
VALIDATION_ERROR |
Request validation failed |
INTERNAL_ERROR |
Internal server error |
{
"success": false,
"message": "Access denied. No API key provided. Include your API key in the 'X-2PERKS-API-KEY' header."
}
{
"success": false,
"message": "Invalid API key"
}
{
"success": false,
"message": "Perk listing not found"
}
The API has rate limits to ensure service quality. When you exceed the limit, you'll get a 429 Too Many Requests
response.
Your API key usage is automatically tracked:
You can monitor your usage through the dashboard or by calling the API key management endpoints.
Ready to start? Get your API key and explore your first categories!