Users
Users
User authentication and profile operations. Users can access multiple entities and manage their account settings.
Login user
/users/loginAuthenticate a user with email and password. Returns an access token and the resolved user profile for the current brand or white-label origin.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.login({
email: "string",
password: "string"
});
console.log(response);Returns
{
"id": "string",
"user_id": "string",
"ttl": 31536000,
"scope": "string",
"created_at": "2025-01-15T10:30:00.000Z",
"impersonator_user_id": "string",
"updated_at": "2025-01-15T10:30:00.000Z",
"user": {
"id": "string",
"email": "string",
"name": "string",
"email_verified": true,
"account_id": "string",
"settings": "string",
"metadata": "string",
"created_at": "2025-01-15T10:30:00.000Z",
"updated_at": "2025-01-15T10:30:00.000Z"
},
"redirect_origin": "string"
}Create user
/users/signupCreate a new user account. For regular main-app signups this provisions an initial account membership unless a valid account invitation token joins the user to an existing account. White-label signups remain entity-user signups and ignore account invitation tokens.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.signup({
email: "string",
name: "string",
password: "string",
settings: "string",
metadata: {},
company_name: "string",
account_invitation_token: "string"
});
console.log(response);Returns
{
"id": "string",
"email": "string",
"name": "string",
"email_verified": true,
"account_id": "string",
"settings": "string",
"metadata": {},
"created_at": "2025-01-15T10:30:00.000Z",
"updated_at": "2025-01-15T10:30:00.000Z"
}Request password reset
/users/password-resetRequest a password reset email. Always returns success to avoid email enumeration.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.requestPasswordReset({
email: "string"
});
console.log(response);Returns
{
"message": "string"
}Confirm password reset
/users/password-reset/confirmReset a user password with a valid password reset token.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.confirmPasswordReset({
token: "string",
password: "string"
});
console.log(response);Returns
{
"message": "string"
}Request account deletion
/users/me/account-deletionImmediately disables login and records a request to erase personal data that is not subject to statutory retention. Invoices and accounting records remain for the legally required period. Sign in with Apple authorization is revoked when a revocation token is available; provider failures are queued for retry without blocking the deletion request.
Returns
{
"requested_at": "2025-01-15T10:30:00.000Z",
"retention_notice": "string"
}List current user accounts
/users/me/accountsReturn the accounts the authenticated user belongs to, including display names and account-level roles.
Returns
{
"data": [
{
"id": "acc_123",
"name": "Space Invoices",
"role": "owner"
},
{
"id": "acc_456",
"name": "Apollo",
"role": "member"
}
]
}Get current user
/users/meRetrieve the authenticated user's profile information. Returns the user details associated with the provided Bearer token.
Returns
{
"id": "6595a27b5d35015c3ef0c3fd",
"email": "example@spaceinvoices.com",
"email_verified": false,
"name": null,
"account_id": null,
"metadata": {},
"settings": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}Update current user
/users/meUpdate the authenticated user's profile. Currently supports updating the display name and preferred UI language (locale).
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.update({
locale: "sl"
});
console.log(response);Returns
{
"id": "6595a27b5d35015c3ef0c3fd",
"email": "example@spaceinvoices.com",
"email_verified": false,
"name": null,
"account_id": null,
"metadata": {},
"settings": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}Update user FURS operator settings
/users/me/settings/fursUpdate FURS operator settings (tax number, label) for the current user. Settings are stored per-entity using the x-entity-id header. These settings are used when the user creates invoices through the web interface.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.updateFursSettings({
operator_tax_number: "12345678",
operator_label: "Alex Carter"
});
console.log(response);Returns
{
"id": "6595a27b5d35015c3ef0c3fd",
"email": "example@spaceinvoices.com",
"email_verified": false,
"name": null,
"account_id": null,
"metadata": {},
"settings": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}Update user FINA operator settings
/users/me/settings/finaUpdate FINA operator settings (OIB, label) for the current user. Settings are stored per-entity using the x-entity-id header. These settings are used when the user creates invoices through the web interface.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.updateFinaSettings({
operator_oib: "12345678901",
operator_label: "Ivan Horvat"
});
console.log(response);Returns
{
"id": "6595a27b5d35015c3ef0c3fd",
"email": "example@spaceinvoices.com",
"email_verified": false,
"name": null,
"account_id": null,
"metadata": {},
"settings": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}Update user Portugal operator settings
/users/me/settings/ptUpdate PT operator snapshot settings for the current user. Settings are stored per-entity using the x-entity-id header and used to auto-fill PT operator fields when the user creates PT documents.
Header parameters
Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.updatePtSettings({
account_first_name: "Joao",
account_last_name: "Silva",
account_tax_number: "123456789"
});
console.log(response);Returns
{
"id": "6595a27b5d35015c3ef0c3fd",
"email": "example@spaceinvoices.com",
"email_verified": false,
"name": null,
"account_id": null,
"metadata": {},
"settings": {},
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z"
}