Entity Users
Entity Users
Manage user access to entities with role-based permissions (viewer, editor, admin).
Add user to entity
/entities/usersAdd 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 ID on which the request is made. Optional - defaults to the first created entity if not provided.
Body parameters
Email address of the user to add or invite
Role to assign to the user
Possible values: "viewer", "editor", "admin"
Default: "editor"
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
}'{
"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"
}List entity users
/entities/usersRetrieve all users who have access to the current entity, including their roles.
Header parameters
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
{
"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
/entities/users/{user_id}Update a user's role on the entity. Roles: viewer (read-only), editor (read+write), admin (full access).
Header parameters
Optional entity ID specifying which entity context to use for this operation.
Path parameters
Space Invoices resource identifier (format: {prefix}_{hex24})
Body parameters
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"
}'Returns
User email
User role on the entity
Possible values: "viewer", "editor", "admin"
User ID
User name
{
"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
/entities/users/{user_id}Remove a user's access to the entity. This does not delete the user account.
Header parameters
Optional entity ID specifying which entity context to use for this operation.
Path parameters
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
{
"message": "User removed from entity"
}Generate user access token
/entities/users/{user_id}/tokenGenerate 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
Optional entity ID specifying which entity context to use for this operation.
Path parameters
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"{
"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"
}