Skip to content

Users

Login user

POST/users/login

Authenticate 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

emailstring<email>required
passwordstringrequired
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

idstring
Other parameters
user_idstring
ttlnumber
scopestringnullable
entity_idstringnullable
created_atstring<date-time>
impersonator_user_idstringnullable
updated_atstring<date-time>
userobject
redirect_originstringnullable
json
{
  "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

POST/users/signup

Create 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

emailstring<email>required
passwordstringrequired
Other parameters
namestringoptionalnullable
settingsstringoptionalnullable
metadataobjectoptionalnullable
company_namestringoptional
account_invitation_tokenstringoptional
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

idstring
Other parameters
emailstring
namestringnullable
email_verifiedboolean
account_idstringnullable
settingsstringnullable
metadataobjectnullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "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

POST/users/password-reset

Request a password reset email. Always returns success to avoid email enumeration.

Body parameters

emailstring<email>required
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

messagestring
json
{
  "message": "message"
}

Confirm password reset

POST/users/password-reset/confirm

Reset a user password with a valid password reset token.

Body parameters

tokenstringrequired
passwordstringrequired
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

messagestring
json
{
  "message": "message"
}

Request account deletion

POST/users/me/account-deletion

Immediately 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_atstring<date-time>
retention_noticestring
json
{
  "requested_at": "2025-01-15T10:30:00.000Z",
  "retention_notice": "retention-notice"
}

List current user accounts

GET/users/me/accounts

Return the accounts the authenticated user belongs to, including display names and account-level roles.

Returns

dataarray of objects
json
{
  "data": [
    {
      "id": "acc_123",
      "name": "Space Invoices",
      "role": "owner"
    },
    {
      "id": "acc_456",
      "name": "Apollo",
      "role": "member"
    }
  ]
}

Get current user

GET/users/me

Retrieve the authenticated user's profile information. Returns the user details associated with the provided Bearer token.

Returns

idstring
Other parameters
emailstring
namestringnullable
email_verifiedboolean
account_idstringnullable
settingsstringnullable
metadatastringnullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "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

PATCH/users/me

Update the authenticated user's profile. Currently supports updating the display name and preferred UI language (locale).

Body parameters

namestringoptionalnullable
localestringoptionalnullable
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

idstring
Other parameters
emailstring
namestringnullable
email_verifiedboolean
account_idstringnullable
settingsstringnullable
metadatastringnullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "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

PUT/users/me/settings/furs

Update 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_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

operator_tax_numberstringoptional
operator_labelstringoptional
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

idstring
Other parameters
emailstring
namestringnullable
email_verifiedboolean
account_idstringnullable
settingsstringnullable
metadatastringnullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "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

PUT/users/me/settings/fina

Update 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_idstringoptional

Entity ID on which the request is made. Auto-selected when only one entity exists, required when multiple entities exist.

Body parameters

operator_oibstringoptional
operator_labelstringoptional
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

idstring
Other parameters
emailstring
namestringnullable
email_verifiedboolean
account_idstringnullable
settingsstringnullable
metadatastringnullable
created_atstring<date-time>
updated_atstring<date-time>
json
{
  "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"
}