Examples
Copy-paste examples for common API calls.
1. Login
const res = await fetch('http://localhost:3001/api/auth/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email: 'you@example.com', password: 'your-password' }),
});
const { accessToken, tenantId } = await res.json();
// Use: Authorization: Bearer <accessToken>, X-Tenant-Id: <tenantId>2. Create an app
await fetch('http://localhost:3001/api/apps', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + accessToken,
'X-Tenant-Id': tenantId,
},
body: JSON.stringify({
name: 'My App',
slug: 'my-app',
template: 'ecommerce',
}),
});3. Trigger a build
await fetch(`http://localhost:3001/api/apps/<appId>/builds`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + accessToken,
'X-Tenant-Id': tenantId,
},
body: JSON.stringify({ platform: 'ANDROID', type: 'APK' }),
});