Skip to content

Entity Users

Entity Users

Manage user access to entities with role-based permissions (viewer, editor, admin).

Add user to entity

POST/entities/users

Add an existing user to the entity or send an invitation to a new user. If the user exists, they are immediately granted access. If not, an invitation email is sent.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.

Body parameters

emailstring<email>required

Email address of the user to add or invite

rolestringoptional

Role to assign to the user

Possible values: "viewer", "editor", "admin"

Default: "editor"

Other parameters
send_invitebooleanoptional
curl -X POST "https://eu.spaceinvoices.com/entities/users" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "newuser@example.com",
    "role": "editor",
    "send_invite": true
  }'
Example:
json
{
  "user_id": "user_new123",
  "entity_id": "ent_xyz789",
  "role": "editor",
  "email": "newuser@example.com",
  "name": "New User",
  "invited_by_user_id": "user_abc123",
  "created_at": "2024-01-20T00:00:00.000Z"
}
Example:

List entity users

GET/entities/users

Retrieve all users who have access to the current entity, including their roles.

Header parameters

entity_idstringoptional

Entity ID on which the request is made. Optional - defaults to the first created entity if not provided.

curl "https://eu.spaceinvoices.com/entities/users" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID"

Returns

dataarray of objects
json
{
  "data": [
    {
      "user_id": "user_abc123",
      "entity_id": "ent_xyz789",
      "role": "admin",
      "email": "admin@example.com",
      "name": "John Admin",
      "invited_by_user_id": null,
      "created_at": "2024-01-01T00:00:00.000Z"
    },
    {
      "user_id": "user_def456",
      "entity_id": "ent_xyz789",
      "role": "editor",
      "email": "editor@example.com",
      "name": "Jane Editor",
      "invited_by_user_id": "user_abc123",
      "created_at": "2024-01-15T00:00:00.000Z"
    }
  ]
}

Update user role

PATCH/entities/users/{user_id}

Update a user's role on the entity. Roles: viewer (read-only), editor (read+write), admin (full access).

Header parameters

entity_idstringoptional

Optional entity ID specifying which entity context to use for this operation.

Path parameters

user_idstring<resource-id>required

Space Invoices resource identifier (format: {prefix}_{hex24})

Body parameters

rolestringrequired

New role to assign to the user

Possible values: "viewer", "editor", "admin"

curl -X PATCH "https://eu.spaceinvoices.com/entities/users/{user_id}" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "role": "admin"
  }'
Example:

Returns

emailstring

User email

rolestring

User role on the entity

Possible values: "viewer", "editor", "admin"

user_idstring

User ID

namestring

User name

Other parameters
entity_idstring
invited_by_user_idstring
created_atstring<date-time>
json
{
  "user_id": "user_def456",
  "entity_id": "ent_xyz789",
  "role": "admin",
  "email": "editor@example.com",
  "name": "Jane Editor",
  "invited_by_user_id": "user_abc123",
  "created_at": "2024-01-15T00:00:00.000Z"
}

Remove user from entity

DELETE/entities/users/{user_id}

Remove a user's access to the entity. This does not delete the user account.

Header parameters

entity_idstringoptional

Optional entity ID specifying which entity context to use for this operation.

Path parameters

user_idstring<resource-id>required

Space Invoices resource identifier (format: {prefix}_{hex24})

curl -X DELETE "https://eu.spaceinvoices.com/entities/users/{user_id}" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID"

Returns

messagestring
json
{
  "message": "User removed from entity"
}

Generate user access token

POST/entities/users/{user_id}/token

Generate an access token for a WL user to enable SSO-like redirect. This allows account admins to redirect users to the web app without requiring them to login.

Header parameters

entity_idstringoptional

Optional entity ID specifying which entity context to use for this operation.

Path parameters

user_idstring<resource-id>required

Space Invoices resource identifier (format: {prefix}_{hex24})

curl -X POST "https://eu.spaceinvoices.com/entities/users/{user_id}/token" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-entity-id: YOUR_ENTITY_ID"
json
{
  "id": "session_e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "user_id": "user_def456",
  "ttl": 31536000,
  "scope": null,
  "created_at": "2024-01-20T10:00:00.000Z",
  "updated_at": "2024-01-20T10:00:00.000Z",
  "entity_id": "ent_xyz789"
}