Skip to main content

Project API

The Project API provides 8 methods for managing projects. Projects are the top-level organisational unit in the ONE platform -- each project has its own API keys, feature flags, usage quotas, and webhook configurations.

Methods

MethodParametersReturnsDescription
getProjects()--ApiResponse<Project[]>Lists all projects owned by the authenticated user.
createProject(input)input: CreateProjectInputApiResponse<Project>Creates a new project and returns it with generated API keys.
getProject(projectId)projectId: stringApiResponse<Project>Returns details for a single project.
updateProject(projectId, input)projectId: string, input: UpdateProjectInputApiResponse<Project>Updates a project's name, description, or settings.
getProjectFeatures(projectId)projectId: stringApiResponse<ProjectFeatures>Returns the feature flags enabled for a project.
updateProjectFeatures(projectId, features)projectId: string, features: ProjectFeaturesUpdateApiResponse<ProjectFeatures>Enables or disables feature flags for a project.
regenerateProjectApiKey(projectId)projectId: stringApiResponse<ProjectApiKeys>Regenerates the API keys for a project. Previous keys are immediately invalidated.
deleteProject(projectId)projectId: stringApiResponse<{ deleted: boolean }>Permanently deletes a project and all associated data.

Types

Project

interface Project {
id: string;
name: string;
description?: string;
ownerId: string;
/** Client ID for API authentication. */
clientId: string;
/** Masked secret key (only full key shown on creation / regeneration). */
secretKey: string;
plan: 'free' | 'starter' | 'pro' | 'enterprise';
status: 'active' | 'suspended' | 'archived';
/** Allowed origins for CORS (web apps). */
allowedOrigins: string[];
/** API calls used in the current billing period. */
apiCallsUsed: number;
/** API call limit for the current plan. */
apiCallLimit: number;
createdAt: string;
updatedAt: string;
}

CreateProjectInput

interface CreateProjectInput {
/** Project name (must be unique per user). */
name: string;
/** Optional description. */
description?: string;
/** Allowed origins for CORS. Default: ["*"]. */
allowedOrigins?: string[];
}

UpdateProjectInput

interface UpdateProjectInput {
name?: string;
description?: string;
allowedOrigins?: string[];
}

ProjectFeatures

interface ProjectFeatures {
projectId: string;
/** Feature flags and their enabled/disabled state. */
features: {
wallet: boolean;
swap: boolean;
onramp: boolean;
offramp: boolean;
aiTrading: boolean;
forex: boolean;
contracts: boolean;
nfts: boolean;
bills: boolean;
staking: boolean;
bridge: boolean;
webhooks: boolean;
/** Free price endpoints are always enabled. */
price: true;
};
updatedAt: string;
}

ProjectFeaturesUpdate

interface ProjectFeaturesUpdate {
wallet?: boolean;
swap?: boolean;
onramp?: boolean;
offramp?: boolean;
aiTrading?: boolean;
forex?: boolean;
contracts?: boolean;
nfts?: boolean;
bills?: boolean;
staking?: boolean;
bridge?: boolean;
webhooks?: boolean;
}

ProjectApiKeys

interface ProjectApiKeys {
projectId: string;
/** New client ID. */
clientId: string;
/** New secret key (shown in full only at generation time). */
secretKey: string;
/** Timestamp when new keys become active. */
generatedAt: string;
}

Examples

List Projects

const res = await engine.getProjects();

if (res.success && res.data) {
for (const proj of res.data) {
console.log(`${proj.name} (${proj.id}) | Plan: ${proj.plan} | Usage: ${proj.apiCallsUsed}/${proj.apiCallLimit}`);
}
}

Create a Project

const res = await engine.createProject({
name: 'My DApp',
description: 'Production application',
allowedOrigins: ['https://mydapp.com', 'https://staging.mydapp.com'],
});

if (res.success && res.data) {
const proj = res.data;
console.log('Project created:', proj.id);
console.log('Client ID:', proj.clientId);
console.log('Secret Key:', proj.secretKey);
// Store these credentials securely
}

Update a Project

const res = await engine.updateProject('proj_abc123', {
name: 'My DApp (Production)',
allowedOrigins: [
'https://mydapp.com',
'https://staging.mydapp.com',
'https://preview.mydapp.com',
],
});

if (res.success && res.data) {
console.log('Project updated:', res.data.name);
}

Get Project Details

const res = await engine.getProject('proj_abc123');

if (res.success && res.data) {
const proj = res.data;
console.log(`Name: ${proj.name}`);
console.log(`Plan: ${proj.plan}`);
console.log(`Status: ${proj.status}`);
console.log(`Usage: ${proj.apiCallsUsed} / ${proj.apiCallLimit} calls`);
console.log(`Origins: ${proj.allowedOrigins.join(', ')}`);
}

Manage Feature Flags

// Check current features
const featRes = await engine.getProjectFeatures('proj_abc123');

if (featRes.success && featRes.data) {
const f = featRes.data.features;
console.log('Enabled features:');
for (const [key, value] of Object.entries(f)) {
if (value) console.log(` - ${key}`);
}
}

// Enable AI trading and forex
const updateRes = await engine.updateProjectFeatures('proj_abc123', {
aiTrading: true,
forex: true,
});

if (updateRes.success) {
console.log('Features updated');
}

Regenerate API Keys

const res = await engine.regenerateProjectApiKey('proj_abc123');

if (res.success && res.data) {
console.log('New Client ID:', res.data.clientId);
console.log('New Secret Key:', res.data.secretKey);
console.log('Generated at:', res.data.generatedAt);
// Update your environment variables with the new keys
// The old keys are immediately invalidated
}
caution

Regenerating API keys immediately invalidates the previous keys. All active clients using the old keys will receive "unauthorized" errors. Update your application configuration before regenerating keys in production.

Delete a Project

const res = await engine.deleteProject('proj_abc123');

if (res.success && res.data?.deleted) {
console.log('Project permanently deleted');
}
danger

Deleting a project is irreversible. All associated data, webhooks, and usage history are permanently removed.

Project Lifecycle

createProject() --> getProject() --> updateProject() --> deleteProject()
|
+--> getProjectFeatures() / updateProjectFeatures()
|
+--> regenerateProjectApiKey()

Plan Limits

FeatureFreeStarterProEnterprise
API calls / month1,00010,000100,000Unlimited
Webhooks21050Unlimited
Team members1310Unlimited
AI Trading--YesYesYes
Forex----YesYes
Priority support----YesYes

Next Steps

  • Admin API -- admin-level project management.
  • Webhooks API -- configure event notifications for your project.
  • Engine Client -- use the project API keys to create a client.