Skip to main content

Auth

POST /auth/register

Register a new user account

Creates a new user with the provided email and password. Returns the new user's API key.

Parameters

NameTypeRequiredSourceDescription
emailstringbodyThe user's email address
passwordstringbodyThe user's password (min 8 chars, must include uppercase, lowercase, and number)

Returns

object - User object with API key

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/register';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"email": "[email protected]",
"password": "TestPassword1"
})
});
const data = await response.json();
console.log(data);

Response

Status: 201

{
"apiKey": "your-api-key-here",
"createdAt": "2026-04-20T04:05:55Z",
"email": "[email protected]",
"emailVerified": true,
"id": 379,
"sessionExpiresAt": "2026-05-20T04:05:55Z",
"sessionToken": "your-api-key-here",
"subscriptionStatus": "free"
}

POST /auth/login

Log in with email and password

Authenticates a user and returns their account details including API key.

Parameters

NameTypeRequiredSourceDescription
emailstringbodyThe user's email address
passwordstringbodyThe user's password

Returns

object - User object with API key

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/login';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"email": "[email protected]",
"password": "TestPassword123!"
})
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"apiKeyRotationRequired": false,
"createdAt": "2026-04-20T04:05:42Z",
"email": "[email protected]",
"emailVerified": true,
"id": 378,
"requestsThisMonth": 276,
"role": "user",
"sessionExpiresAt": "2026-05-20T04:05:55Z",
"sessionToken": "your-api-key-here"
}

POST /auth/regenerate-key

Regenerate API key

Generates a new API key for the authenticated user. The old key is invalidated.

Parameters

NameTypeRequiredSourceDescription
emailstringbodyThe user's email address
passwordstringbodyThe user's password

Returns

object - New API key

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/regenerate-key';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"email": "[email protected]",
"password": "TestPassword1"
})
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"apiKey": "your-api-key-here"
}

GET /auth/user-data

Get user data

Retrieves the authenticated user's account details including usage statistics and subscription status.

Returns

object - User data object

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/user-data';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': 'Bearer your-api-key-here'
}
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"apiKeyRotationRequired": false,
"email": "[email protected]",
"emailVerified": true,
"id": 379,
"limits": {
"monthlyLimit": 1000000,
"unlimitedMonthly": false
},
"requestsThisMonth": 0,
"role": "user",
"subscriptionStatus": "free"
}

GET /auth/export-data

Export user data

Exports all stored user data for GDPR data portability compliance.

Returns

object - Complete user data export

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/export-data';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'GET',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"apiAccess": {
"hasMasterKey": true
},
"exportDate": "2026-04-20T04:05:55Z",
"scopedKeys": [],
"subscription": {
"status": "free",
"stripeCustomerId": "",
"subscriptionId": ""
},
"usage": {
"requestsThisMonth": 276,
"requestsToday": 276
},
"user": {
"createdAt": "2026-04-20T04:05:42Z",
"email": "[email protected]",
"id": 378,
"updatedAt": "2026-04-20T04:05:55Z"
}
}

DELETE /auth/account

Delete user account

Permanently deletes the user's account and all associated data.

Parameters

NameTypeRequiredSourceDescription
confirmEmailstringbodyThe user's email address (must match account email)
passwordstringbodyThe user's password for verification

Returns

object - Confirmation of deletion

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/account';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'DELETE',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"confirmEmail": "[email protected]",
"password": "TestPassword1"
})
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"message": "Account successfully deleted",
"success": true
}

POST /auth/change-password

Change password while logged in

Allows an authenticated user to change their password.

Parameters

NameTypeRequiredSourceDescription
currentPasswordstringbodyThe user's current password
newPasswordstringbodyThe new password (min 8 chars, must include uppercase, lowercase, and number)

Returns

object - Success message

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/change-password';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"currentPassword": "TestPassword123!",
"newPassword": "ChangedPassword2"
})
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"message": "Password changed successfully"
}

POST /auth/forgot-password

Request a password reset

Sends a password reset email if the account exists.

Parameters

NameTypeRequiredSourceDescription
emailstringbodyThe email address associated with the account

Returns

object - Generic success message

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/forgot-password';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"email": "[email protected]"
})
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"message": "If an account with that email exists, a password reset link has been sent."
}

POST /auth/reset-password

Reset password with token

Resets the user's password using a valid reset token.

Parameters

NameTypeRequiredSourceDescription
tokenstringbodyThe password reset token from the email
passwordstringbodyThe new password (min 8 chars, must include uppercase, lowercase, and number)

Returns

object - Success message

Try It Out


GET /auth/validate-reset-token/:token

Validate a password reset token

Checks whether a password reset token is still valid before showing the reset form.

Parameters

NameTypeRequiredSourceDescription
tokenstringparamsThe password reset token to validate

Returns

object - Token validity status

Try It Out


POST /auth/api-keys

Create a new scoped API key

Creates a sub-key under the authenticated user's master key with optional restrictions.

Parameters

NameTypeRequiredSourceDescription
namestringbodyFriendly name for the key
scopedClientIdstringbodyLock to specific Foundry client ID
scopedUserIdstringbodyLock to specific Foundry user ID
monthlyLimitstringbodyPer-key monthly request cap
expiresAtstringbodyExpiry timestamp (ISO 8601)
foundryUrlstringbodyFoundry instance URL for headless sessions
foundryUsernamestringbodyFoundry login username
foundryPasswordstringbodyFoundry login password (encrypted at rest)

Returns

object - New scoped API key details

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/api-keys';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'POST',
headers: {
'x-api-key': 'your-api-key-here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Test Scoped Key",
"scopes": [
"entity:read",
"structure:read"
],
"monthlyLimit": "500"
})
});
const data = await response.json();
console.log(data);

Response

Status: 201

{
"createdAt": "2026-04-20T04:06:35Z",
"enabled": true,
"expiresAt": null,
"id": 2184,
"key": "your-api-key-here",
"monthlyLimit": 500,
"name": "Test Scoped Key",
"scopedClientId": "",
"scopedClientIds": null,
"scopedUserId": "",
"scopedUserIds": null,
"scopes": [
0: "entity:read",
1: "structure:read"
]
}

GET /auth/api-keys

List all scoped API keys

Returns all scoped keys for the authenticated user.

Returns

array - Array of scoped API keys

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/api-keys';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'GET',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"keys": [
0: {
"createdAt": "2026-04-20T04:06:35Z",
"enabled": true,
"expiresAt": null,
"id": 2184,
"isExpired": false,
"key": "e0c0c934...",
"monthlyLimit": 500,
"name": "Test Scoped Key",
"requestsThisMonth": 0,
"scopedClientId": "",
"scopedClientIds": null,
"scopedUserId": "",
"scopedUserIds": null,
"scopes": [ 2 items ],
"updatedAt": "2026-04-20T04:06:35Z"
}
]
}

DELETE /auth/api-keys/:id

Delete a scoped API key

Permanently deletes a scoped key.

Parameters

NameTypeRequiredSourceDescription
idstringparamsThe scoped key ID

Returns

object - Success message

Try It Out

Code Examples

const baseUrl = 'http://localhost:3010';
const path = '/auth/api-keys/2184';
const url = `${baseUrl}${path}`;

const response = await fetch(url, {
method: 'DELETE',
headers: {
'x-api-key': 'your-api-key-here'
}
});
const data = await response.json();
console.log(data);

Response

Status: 200

{
"message": "API key deleted",
"success": true
}