Developers API
The Developers API allows you to manage developer accounts, generate API keys, and access developer statistics and dashboard summaries.
Authentication
All endpoints require authentication using either:
- API Key: Include
x-api-keyheader - Cognito JWT: Include
Authorization: Bearer <token>header
Base URL
https://sdk.getjar.com/developers
Create Developer
Create a new developer account in the GetJar platform.
Endpoint
POST /developers
Request Body
{
cognitoUserId: string; // Required: AWS Cognito user ID
company?: string; // Company name
website?: string; // Company website URL
accountStatus?: string; // ACTIVE, INACTIVE, SUSPENDED, BANNED
accountTier?: string; // FREE, BASIC, PRO, ENTERPRISE
}
Response
{
developerId: string;
cognitoUserId: string;
company: string;
website: string;
accountStatus: string;
accountTier: string;
permissions: string[];
enabledFeatures: string[];
createdAt: string;
updatedAt: string;
}
Example
import { DevelopersApi } from "@getjar-iap/sdk";
const developersApi = new DevelopersApi(configuration);
const developer = await developersApi.createDeveloper({
createDeveloperDto: {
cognitoUserId: "us-east-1:12345678-1234-1234-1234-123456789012",
company: "Awesome Games Studio",
website: "https://awesomegames.com",
accountStatus: "ACTIVE",
accountTier: "FREE",
},
});
console.log("Developer ID:", developer.data.developerId);
Response Codes
| Code | Description |
|---|---|
| 201 | Developer created successfully |
| 400 | Invalid developer data |
| 401 | Unauthorized |
| 409 | Developer already exists |
Update Developer
Update developer profile information.
Endpoint
PUT /developers/:developerId
Parameters
| Parameter | Type | Description |
|---|---|---|
| developerId | string | The unique developer identifier |
Request Body
{
company?: string;
website?: string;
accountTier?: string;
permissions?: string[];
enabledFeatures?: string[];
webhookUrl?: string;
}
Example
const updated = await developersApi.updateDeveloper({
developerId: "dev_123",
updateDeveloperDto: {
company: "Awesome Games Studio Inc.",
accountTier: "PRO",
webhookUrl: "https://api.example.com/webhooks",
},
});
Response Codes
| Code | Description |
|---|---|
| 200 | Developer updated successfully |
| 400 | Invalid update data |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Developer not found |
Get Developer by ID
Retrieve detailed developer profile information.
Endpoint
GET /developers/:developerId
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| developerId | string | Yes | The unique developer identifier |
| fields | string | No | Comma-separated list of fields to include |
Example
const developer = await developersApi.getDeveloperById({
developerId: "dev_123",
fields: "developerId,company,accountTier,stats",
});
console.log("Company:", developer.data.company);
console.log("Total Apps:", developer.data.stats?.totalApps);
Response Codes
| Code | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized |
| 404 | Developer not found |
Get Developer by Cognito ID
Retrieve developer profile using their AWS Cognito user ID.
Endpoint
GET /developers/user/:cognitoUserId
Parameters
| Parameter | Type | Description |
|---|---|---|
| cognitoUserId | string | AWS Cognito user identifier |
Example
const developer = await developersApi.getDeveloperByCognitoId({
cognitoUserId: "us-east-1:12345678-1234-1234-1234-123456789012",
});
console.log("Developer ID:", developer.data.developerId);
Response Codes
| Code | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized |
| 404 | Developer not found |
Get Developer Summary
Retrieve comprehensive statistics and dashboard overview.
Endpoint
GET /developers/:developerId/summary
Response
{
developer: {
developerId: string;
company: string;
accountTier: string;
accountStatus: string;
}
stats: {
totalApps: number;
activeApps: number;
totalProducts: number;
totalRevenue: number;
totalUsers: number;
totalAchievements: number;
totalLeaderboards: number;
lastActivityAt: string;
}
recentActivity: Array<{
type: string;
description: string;
timestamp: string;
}>;
}
Example
const summary = await developersApi.getDeveloperSummary({
developerId: "dev_123",
});
console.log("Total Revenue:", summary.data.stats?.totalRevenue);
console.log("Total Users:", summary.data.stats?.totalUsers);
console.log("Recent Activity:", summary.data.recentActivity);
API Key Management
Generate API Key
Create a new API key with custom permissions. Important: The key will only be shown once.
Endpoint
POST /developers/:developerId/api-keys
Request Body
{
name: string; // Required: Friendly name for the key
permissions: string[]; // Required: Array of permissions
}
Example
const apiKey = await developersApi.generateApiKey({
developerId: "dev_123",
body: {
name: "Production Server Key",
permissions: [
"read:achievements",
"write:achievements",
"read:leaderboards",
"write:leaderboards",
],
},
});
// IMPORTANT: Save this key immediately!
console.log("API Key:", apiKey.data.key);
Response Codes
| Code | Description |
|---|---|
| 201 | API key generated successfully |
| 400 | Invalid key configuration |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Developer not found |
Get All API Keys
Retrieve a list of all API keys for a developer. Actual key values are never returned.
Endpoint
GET /developers/:developerId/api-keys
Response
{
keys: Array<{
name: string;
permissions: string[];
createdAt: string;
lastUsedAt: string | null;
expiresAt: string | null;
}>;
total: number;
}
Example
const keys = await developersApi.getDeveloperApiKeys({
developerId: "dev_123",
});
console.log("Total Keys:", keys.data.total);
keys.data.keys?.forEach((key) => {
console.log(`${key.name}: ${key.permissions?.join(", ")}`);
});
Update API Key
Update the name or permissions of an existing API key.
Endpoint
PUT /developers/:developerId/api-keys/:keyName
Parameters
| Parameter | Type | Description |
|---|---|---|
| developerId | string | Developer identifier |
| keyName | string | Current name of the API key |
Request Body
{
newName?: string; // New name for the key
permissions?: string[]; // Updated permissions
}
Example
const updated = await developersApi.updateApiKey({
developerId: "dev_123",
keyName: "Production Server Key",
body: {
newName: "Production API Key",
permissions: ["read:*", "write:*"],
},
});
Response Codes
| Code | Description |
|---|---|
| 200 | API key updated successfully |
| 400 | Invalid update data |
| 401 | Unauthorized |
| 404 | API key not found |
Revoke API Key
Permanently revoke and delete an API key. This action cannot be undone.
Endpoint
DELETE /developers/:developerId/api-keys/:keyName
Parameters
| Parameter | Type | Description |
|---|---|---|
| developerId | string | Developer identifier |
| keyName | string | Name of the API key to revoke |
Example
await developersApi.revokeApiKey({
developerId: "dev_123",
keyName: "Old Development Key",
});
console.log("API key revoked successfully");
Response Codes
| Code | Description |
|---|---|
| 204 | API key revoked successfully |
| 401 | Unauthorized |
| 404 | API key not found |
Common Permissions
Here are the standard permissions available for API keys:
| Permission | Description |
|---|---|
read:achievements | Read achievement data |
write:achievements | Create and modify achievements |
read:leaderboards | Read leaderboard data |
write:leaderboards | Submit scores and manage leaderboards |
read:products | Read product catalog |
write:products | Create and modify products |
read:users | Read user data |
write:users | Modify user data |
read:analytics | Access analytics and reports |
read:* | Read access to all resources |
write:* | Write access to all resources |
Complete Example
Here's a complete workflow for setting up a new developer:
import { Configuration, DevelopersApi } from "@getjar-iap/sdk";
// Initialize SDK
const configuration = new Configuration({
basePath: "https://sdk.getjar.com",
apiKey: "your-api-key",
});
const developersApi = new DevelopersApi(configuration);
async function setupNewDeveloper() {
try {
// 1. Create developer account
const developer = await developersApi.createDeveloper({
createDeveloperDto: {
cognitoUserId: "us-east-1:12345678-1234-1234-1234-123456789012",
company: "Indie Game Studio",
website: "https://indiegamestudio.com",
accountStatus: "ACTIVE",
accountTier: "FREE",
},
});
const developerId = developer.data.developerId!;
console.log("Developer created:", developerId);
// 2. Generate production API key
const productionKey = await developersApi.generateApiKey({
developerId,
body: {
name: "Production Server",
permissions: ["read:*", "write:*"],
},
});
console.log("Production API Key:", productionKey.data.key);
// 3. Generate development API key
const devKey = await developersApi.generateApiKey({
developerId,
body: {
name: "Development Environment",
permissions: ["read:*", "write:achievements", "write:leaderboards"],
},
});
console.log("Development API Key:", devKey.data.key);
// 4. Get developer summary
const summary = await developersApi.getDeveloperSummary({ developerId });
console.log("Developer Summary:", summary.data);
return {
developerId,
productionKey: productionKey.data.key,
developmentKey: devKey.data.key,
};
} catch (error) {
console.error("Error setting up developer:", error);
throw error;
}
}
// Run the setup
setupNewDeveloper().then((result) => {
console.log("Setup complete!", result);
});
Error Handling
All endpoints return standard HTTP status codes and error responses:
try {
const developer = await developersApi.getDeveloperById({
developerId: "invalid-id",
});
} catch (error) {
if (error.response) {
console.error("Status:", error.response.status);
console.error("Message:", error.response.data.message);
}
}
Common error response format:
{
statusCode: number;
message: string;
error?: string;
}
Best Practices
Security
- Store API keys securely: Never commit API keys to version control
- Use environment variables: Store keys in
.envfiles - Rotate keys regularly: Generate new keys and revoke old ones periodically
- Use least privilege: Grant only the permissions needed for each key
- Monitor key usage: Check
lastUsedAtto identify unused keys
Performance
- Cache developer data: Developer info changes infrequently
- Use field selection: Request only needed fields with the
fieldsparameter - Batch operations: Group related API calls when possible
Example: Secure Key Storage
// .env file
GETJAR_PRODUCTION_KEY=gjk_live_abc123...
GETJAR_DEVELOPMENT_KEY=gjk_dev_xyz789...
// config.ts
import { Configuration } from '@getjar-iap/sdk';
const configuration = new Configuration({
basePath: process.env.GETJAR_API_URL || 'https://sdk.getjar.com',
apiKey: process.env.GETJAR_PRODUCTION_KEY
});
export default configuration;
Support
For additional help or questions:
- Documentation: https://docs.getjar.com
- API Reference: https://sdk.getjar.com/api/docs
- Support: support@getjar.com