Authenticated Lockers API
Access your own lockers with full content using API key authentication.
Endpoint
GET /api/v1/lockers
This endpoint returns all active lockers for the authenticated user with full content including destination URLs and display text.
Authentication
This endpoint requires API key authentication. Include your API key in the Authorization header:
Required Header
Authorization: Bearer sk_your_api_key_here
Generate your API key from the dashboard settings.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| type | string | No | Filter by unlock type: "redirect" or "text" (query parameter) |
Request Example
curl -H "Authorization: Bearer sk_your_api_key" \
https://socialunlocks.com/api/v1/lockers
curl -H "Authorization: Bearer sk_your_api_key" \
https://socialunlocks.com/api/v1/lockers?type=redirect
curl -H "Authorization: Bearer sk_your_api_key" \
https://socialunlocks.com/api/v1/lockers?type=text
https://socialunlocks.com/api/v1/lockers
curl -H "Authorization: Bearer sk_your_api_key" \
https://socialunlocks.com/api/v1/lockers?type=redirect
curl -H "Authorization: Bearer sk_your_api_key" \
https://socialunlocks.com/api/v1/lockers?type=text
Replace "sk_your_api_key" with your actual API key from the dashboard. Add ?type=redirect or ?type=text to filter by unlock type.
Response Schema
Success Response
{
"lockers": [
{
"id": "uuid-string",
"title": "Premium Content Access",
"description": "Unlock premium content by completing tasks",
"slug": "premium-content-access",
"thumbnail": "https://example.com/image.jpg",
"unlockType": "redirect",
"destination": "https://example.com/premium-content",
"content": null,
"unlockCount": 42
},
{
"id": "another-uuid",
"title": "Display Text Locker",
"description": "Shows important information",
"slug": "display-text-locker",
"thumbnail": "https://example.com/image2.jpg",
"unlockType": "text",
"destination": null,
"content": "This is the important information to display",
"unlockCount": 15
}
]
}
"lockers": [
{
"id": "uuid-string",
"title": "Premium Content Access",
"description": "Unlock premium content by completing tasks",
"slug": "premium-content-access",
"thumbnail": "https://example.com/image.jpg",
"unlockType": "redirect",
"destination": "https://example.com/premium-content",
"content": null,
"unlockCount": 42
},
{
"id": "another-uuid",
"title": "Display Text Locker",
"description": "Shows important information",
"slug": "display-text-locker",
"thumbnail": "https://example.com/image2.jpg",
"unlockType": "text",
"destination": null,
"content": "This is the important information to display",
"unlockCount": 15
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier for the locker |
| title | string | Title of the locker |
| description | string | Description of the locker content |
| slug | string | URL-friendly identifier |
| thumbnail | string | URL to the locker thumbnail image |
| unlockType | string | Type of unlock: "redirect" or "text" |
| destination | string | null | Redirect URL (only for redirect type) |
| content | string | null | Display text content (only for text type) |
| unlockCount | number | Number of times this locker has been unlocked |
Status Codes
200Success- Request completed successfully
401Unauthorized- Invalid or missing API key
500Internal Server Error- Server error occurred
Important Notes
- • Authentication required: API key must be included in Authorization header
- • Own lockers only: Returns only lockers created by the authenticated user
- • Full content: Includes destination URLs and display text (not available in public API)
- • Active lockers only: Returns only lockers with status "active"
- • Excludes key system: Does not return lockers with unlockType "key"
- • Ordered by date: Results are ordered by creation date (newest first)
Example Integration
JavaScript Example
async function getMyLockers(apiKey, type = null) {
try {
let url = '/api/v1/lockers';
if (type) {
url += `?type=${type}`;
}
const response = await fetch(url, {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
if (response.ok) {
const data = await response.json();
return data.lockers;
} else {
console.error('Failed to fetch lockers');
return [];
}
} catch (error) {
console.error('Error:', error);
return [];
}
}
try {
let url = '/api/v1/lockers';
if (type) {
url += `?type=${type}`;
}
const response = await fetch(url, {
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
}
});
if (response.ok) {
const data = await response.json();
return data.lockers;
} else {
console.error('Failed to fetch lockers');
return [];
}
} catch (error) {
console.error('Error:', error);
return [];
}
}
Genarating API Keys
To use this endpoint, you need to generate an API key from your dashboard:
- Go to your dashboard settings
- Navigate to the "API" section
- Click "Generate API Key" if you don't have one
- Copy your API key (starts with "sk_")
- Use the key in the Authorization header as shown in the examples above