API Reference v1.0 2 min read

API introduction

Get started with the 2perks API. Learn about authentication and basic endpoints to manage perks and categories for your business.

API introduction

Welcome to the 2perks API! Our simple REST API allows you to manage perks and categories for your business programmatically.

Base URL

All API requests should be made to:

https://api.2perks.com/api/v1

Authentication

The API uses API keys for authentication. Generate your API key from your dashboard.

Using your API key

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

Getting your API key

  1. Log in to your 2perks dashboard
  2. Go to ProfileAPI Keys
  3. Click Create API Key
  4. Copy and store your key securely

⚠️ Important: Keep your API key secure and never expose it in client-side code.

Request format

  • Use HTTPS for all requests
  • Include Content-Type: application/json header for POST/PUT requests
  • Send data as JSON in the request body

Error codes

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

Common errors

Missing API key

{
  "success": false,
  "message": "Access denied. No API key provided. Include your API key in the 'X-2PERKS-API-KEY' header."
}

Invalid API key

{
  "success": false,
  "message": "Invalid API key"
}

Rate limits

The API has rate limits to ensure service quality. When you exceed the limit, you'll get a 429 Too Many Requests response.

Ready to start? Get your API key and explore your first categories!

Share this documentation

On this page