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/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.login({
email: "user@example.com",
password: "password"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"id": "id",
"user_id": "user-id",
"ttl": 31536000,
"scope": "scope",
"entity_id": "entity-id",
"created_at": "2025-01-15T10:30:00.000Z",
"impersonator_user_id": "impersonator-user-id",
"updated_at": "2025-01-15T10:30:00.000Z",
"user": {
"id": "id",
"email": "user@example.com",
"name": "name",
"email_verified": true,
"account_id": "account-id",
"settings": "settings",
"metadata": "metadata",
"created_at": "2025-01-15T10:30:00.000Z",
"updated_at": "2025-01-15T10:30:00.000Z"
},
"redirect_origin": "redirect-origin"
}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/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.signup({
email: "user@example.com",
name: "name",
password: "password",
settings: "settings",
metadata: {
external_id: "123",
source: "shopify"
},
company_name: "company-name",
account_invitation_token: "account-invitation-token"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"id": "id",
"email": "user@example.com",
"name": "name",
"email_verified": true,
"account_id": "account-id",
"settings": "settings",
"metadata": {
"external_id": "123",
"source": "shopify"
},
"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/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.requestPasswordReset({
email: "user@example.com"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"message": "message"
}Confirm password reset
/users/password-reset/confirmReset a user password with a valid password reset token.
Body parameters
import SpaceInvoices from '@spaceinvoices/js-sdk/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.confirmPasswordReset({
token: "token",
password: "password"
}, {
entity_id: "YOUR_ENTITY_ID"
});
console.log(response);Returns
{
"message": "message"
}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": "retention-notice"
}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/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.update({
locale: "sl"
}, {
entity_id: "YOUR_ENTITY_ID"
});
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/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.updateFursSettings({
operator_tax_number: "12345678",
operator_label: "Alex Carter"
}, {
entity_id: "YOUR_ENTITY_ID"
});
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/sdk';
const sdk = new SpaceInvoices('YOUR_API_KEY');
const response = await sdk.users.updateFinaSettings({
operator_oib: "12345678901",
operator_label: "Ivan Horvat"
}, {
entity_id: "YOUR_ENTITY_ID"
});
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"
}