# Add a /users REST API endpoint

**URL:** <https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982>\
**Category:** Development\
**Tags:** rest, proposal\
**Created:** [November 27, 2025, 8:39am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982 "2025-11-27T08:39:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![pjeanjean](https://forum.xwiki.org/user_avatar/forum.xwiki.org/pjeanjean/32/5901_2.png) [@pjeanjean](https://forum.xwiki.org/u/pjeanjean)\
**Post date:** [November 27, 2025, 8:39am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/1 "2025-11-27T08:39:16Z")

</div>

Hi everyone,

This proposal is about adding an endpoint to the current REST API to access information about the existing users on a XWiki instance.

Right now, there is no easy way to externally get public user information, such as display name, email address and avatar (some of them can be obtained by accessing properties in `XWikiUsers` XObject instances, but display name for example still needs to be reconstructed manually). Having these would be useful to fix a few Cristal issues, namely:

- [CRISTAL-271: Can’t access the user profile from chrome with XWiki Backend](https://jira.xwiki.org/browse/CRISTAL-271)
- [CRISTAL-757: Use display name in UI for XWiki backend](https://jira.xwiki.org/browse/CRISTAL-757)
- [CRISTALINT-18: Find a way to display user details when logged-in](https://jira.xwiki.org/browse/CRISTALINT-18)

If it could also expose technical details, such as `displayHiddenDocuments`, this could also be useful to update Cristal’s navigation tree accordingly.

As such, I suggest the following endpoints:

- `GET /wikis/{wikiName}/users/{userId}`
- `GET /wikis/{wikiName}/users/current` (to have direct access to the information of the connected user)

I’m still not sure on the format that should be returned by these, however. In XWiki, we have the class `UserProperties` that includes both basic and technical information, but it’s missing properties available in the `XWikiUsers` XObject such as public blog and company. Both these options also do not include the link to the current avatar.

What do you think?

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 27, 2025, 9:14am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/2 "2025-11-27T09:14:46Z")

</div>

+1 in general. Make sure to check if the REST user has view permissions on the user profile page.

> [@pjeanjean](#):
>
> As such, I suggest the following endpoints:
> 
> - `GET /wikis/{wikiName}/users/{userId}`
> - `GET /wikis/{wikiName}/users/current` (to have direct access to the information of the connected user)

Personally I’d prefer:

- `GET /users/{userId}` → user `userId` in the main wiki
- `GET /users/{userId}/wikis/{wikiName}` → user `userId` on wiki `wikiName`
- `GET /users/current` → current user (doesn’t matter which wiki since it’s the current logged in user, we can’t have a current user in a given wiki)

I also prefer the most specific path segment first (ie here we’re not asking about wikis but about users), but I don’t know what’s the best practice in REST.

Thx

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 27, 2025, 9:15am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/3 "2025-11-27T09:15:16Z")

</div>

> [@vmassol](#):
>
> `GET /users/current` → current user (doesn’t matter which wiki since it’s the current logged in user, we can’t have a current user in a given wiki)

or `GET /user`

---

<div class="post-metadata">

**Author:** ![MichaelHamann](https://forum.xwiki.org/user_avatar/forum.xwiki.org/michaelhamann/32/3813_2.png) [@MichaelHamann](https://forum.xwiki.org/u/MichaelHamann)\
**Post date:** [November 27, 2025, 9:20am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/4 "2025-11-27T09:20:19Z")

</div>

> [@vmassol](#):
>
> `GET /users/current` → current user (doesn’t matter which wiki since it’s the current logged in user, we can’t have a current user in a given wiki)

I tend to agree, but we have the problem that authentication for subwiki users might not work unless you specify the subwiki, see [XWIKI-17936](https://jira.xwiki.org/browse/XWIKI-17936). This seems painful, but I fear it means that we need the wiki in the path as suggested by @pjeanjean.

Also, it’s not clear to me what `userId` is in the path as we have no concept of user IDs as far as I know. The only string serialization of user references that I’m aware of are full document references.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [November 27, 2025, 9:32am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/5 "2025-11-27T09:32:41Z")

</div>

> [@vmassol](#):
>
> `GET /users/{userId}/wikis/{wikiName}` → user `userId` on wiki `wikiName`

It would IMO make a lot more sense to use the more standard `/wikis/{wikiName}/users/{userId}` as suggested by @pjeanjean for consistency, and proper authentication.

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 27, 2025, 9:33am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/6 "2025-11-27T09:33:17Z")

</div>

> [@MichaelHamann](#):
>
> Also, it’s not clear to me what `userId` is in the path as we have no concept of user IDs as far as I know. The only string serialization of user references that I’m aware of are full document references.

For the API, we have `UserReferenceSerializer` (specifically `ConfiguredStringUserReferenceSerializer`), but indeed the reference format depends on the storage config. So for me the reference needs to be in the storage format configured on the wiki being targeted.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [November 27, 2025, 9:35am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/7 "2025-11-27T09:35:14Z")

</div>

> [@pjeanjean](#):
>
> As such, I suggest the following endpoints:
> 
> - `GET /wikis/{wikiName}/users/{userId}`
> - `GET /wikis/{wikiName}/users/current` (to have direct access to the information of the connected user)

You did not mention anything to list users, but sounds like a very common need. I would have imagined something like `/wikis/{wikiName}/users/`.

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 27, 2025, 9:38am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/8 "2025-11-27T09:38:10Z")

</div>

> [@tmortagne](#):
>
> It would IMO make a lot more sense to use the more standard `/wikis/{wikiName}/users/{userId}` as suggested by @pjeanjean for consistency, and proper authentication.

I’m not entirely sure I agree with this. It makes sense to start with `/wikis` for requests about the model, i.e. anything related to entities. Even if currently the user is an entity, we want to get away from this (hence the new user api).

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [November 27, 2025, 9:38am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/9 "2025-11-27T09:38:21Z")

</div>

> [@vmassol](#):
>
> So for me the reference needs to be in the storage format configured on the wiki being targeted.

So `.../users/xwiki%3AXWiki.SomeUser` ?

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [November 27, 2025, 9:42am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/10 "2025-11-27T09:42:12Z")

</div>

> [@vmassol](#):
>
> I’m not entirely sure I agree with this. It makes sense to start with `/wikis` for requests about the model, i.e. anything related to entities.

I reacted to your `/users/{userId}/wikis/{wikiName}` proposal, which does contain the wiki. To me, if you have the wiki, it should be put before (again because it’s a standard XWiki REST prefix and because it’s also used for authentication).

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 27, 2025, 9:46am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/11 "2025-11-27T09:46:12Z")

</div>

> [@tmortagne](#):
>
> So `.../users/xwiki%3AXWiki.SomeUser` ?

Maybe without the `wiki` part if we want the wiki part to be specified as a REST path segment, to be more generic (in case other storages don’t specify the wiki in the reference).

We might need a `local` `DocumentStringUserReferenceSerializer` impl for this though.

Or indeed we request a full path, idk.

(more thinking) Another option is, for the “document” store case, to only use the last part of the user name. AFAIR we have some resolver for it, so that would work. It seems nicer/cleaner and closer to what we would use with a different store. We would just need some `verylocal` component impl on the serialization part.

So +1 for the later.

Thx

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [November 27, 2025, 9:48am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/12 "2025-11-27T09:48:13Z")

</div>

> [@vmassol](#):
>
> Maybe without the `wiki` part if we want the wiki part to be specified as a REST path segment, to be more generic (in case other storages don’t specify the wiki in the reference).

Actually it’s the opposite, the wiki part is part of the user id (its storage location in the case of a document based user). It might not make any sense for another kind of user. What’s in the path is only supposed to indicate from where you are accessing the user, not where the user is stored.

---

<div class="post-metadata">

**Author:** ![vmassol](https://forum.xwiki.org/user_avatar/forum.xwiki.org/vmassol/32/6_2.png) [@vmassol](https://forum.xwiki.org/u/vmassol)\
**Post date:** [November 27, 2025, 9:52am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/13 "2025-11-27T09:52:00Z")

</div>

> [@tmortagne](#):
>
> Actually it’s the opposite, the wiki part is part of the user id (its storage location in the case of a document based user). It might not make any sense for another kind of user. What’s in the path is only supposed to indicate from where you are accessing the user, not where the user is stored.

What I meant is that for the “document” store we can reconstruct the full path with:

`GET /wikis/{wikiname}/users/{userid using just the page name}`

→ `{wikiname}:XWiki.{userid using just the page name}`

---

<div class="post-metadata">

**Author:** ![watery](https://forum.xwiki.org/user_avatar/forum.xwiki.org/watery/32/4228_2.png) [@watery](https://forum.xwiki.org/u/watery)\
**Post date:** [November 27, 2025, 6:15pm UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/14 "2025-11-27T18:15:24Z")

</div>

> [@pjeanjean](#):
>
> What do you think?

Yes please! It would be of help for [REST API: get myself check groups and permissions](https://forum.xwiki.org/t/rest-api-get-myself-check-groups-and-permissions/13616) 😊

---

<div class="post-metadata">

**Author:** ![pjeanjean](https://forum.xwiki.org/user_avatar/forum.xwiki.org/pjeanjean/32/5901_2.png) [@pjeanjean](https://forum.xwiki.org/u/pjeanjean)\
**Post date:** [January 21, 2026, 4:37pm UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/15 "2026-01-21T16:37:34Z")

</div>

Thanks everyone for your replies!

Reading through them, it seems that I forgot to detail in my proposal that we actually need to consider wikis at two different levels for this API to work:

- for users stored in documents, the wiki inside which they are actually stored (part of what I generically called the `userId` in my original post),
- a “context wiki”, in which to perform the request. It would also be used to authenticate the user making the request and handle their rights accordingly.

In which case it would not be possible to simply ignore the `/wikis/{wikiName}` part of the request. Taking into account the rest of the feedback, we would end up with the following:

- `GET /wikis/{wikiName}/user` to get information on the current user _iff_ they can successfully authenticate on `wikiName`,
- `GET /wikis/{wikiName}/users` to list the users of a given wiki, probably including whether they are local or global users, _iff_ the authenticated user has access to the user index for `wikiName`,
- `GET /wikis/{wikiName}/users/{userWikiName}%3AXWiki.{userId}` to get information on a specific user _iff_ they are an actual user of `wikiName` (if the user does exist on `userWikiName` but is not a user of `wikiName`, we would return a `404`) and the current user has read permissions on their profile.

Did I miss anything? @vmassol @tmortagne @MichaelHamann

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [January 22, 2026, 10:23am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/16 "2026-01-22T10:23:05Z")

</div>

> [@pjeanjean](#):
>
> `GET /wikis/{wikiName}/users/{userWikiName}%3AXWiki.{userId}` to get information on a specific user _iff_ they are an actual user of `wikiName` (if the user does exist on `userWikiName` but is not a user of `wikiName`, we would return a `404`) and the current user has read permissions on their profile.

I don’t understand the description of that one. To me such an API would access the user `{userWikiName}%3AXWiki.{userId}` (which is the full user id) from the context of the wiki `{wikiName}` (and that wiki is only used for that, context). I don’t see why it **should** be located in `{wikiName}` if `{userWikiName}` indicates something else. Of course, if `{userWikiName}` is not indicated, then the user id will be resolved based on the context.

---

<div class="post-metadata">

**Author:** ![pjeanjean](https://forum.xwiki.org/user_avatar/forum.xwiki.org/pjeanjean/32/5901_2.png) [@pjeanjean](https://forum.xwiki.org/u/pjeanjean)\
**Post date:** [January 22, 2026, 10:40am UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/17 "2026-01-22T10:40:45Z")

</div>

I’m not saying they should be located in `{wikiName}`, but that if they are a global user located in `{userWikiName}` but not a part of the user list of `{wikiName}` (which is used for the context of the request) then the request should fail with a not found. This makes sense to me since then they would technically not be a user of `{wikiName}`, even though their user page might be accessible globally.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [January 22, 2026, 12:23pm UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/18 "2026-01-22T12:23:15Z")

</div>

> [@pjeanjean](#):
>
> I’m not saying they should be located in `{wikiName}`

Well that’s exactly what you are saying in practice. If you get a 404 every time `{wikiName}` and `{userWikiName}` are different then the only queries that work is when the target user is part of `{wikiName}`. This basically makes `{userWikiName}` totally useless, and even very error-prone.

It would IMO makes a lot more sense to only see `{wikiName}` as a contextual information. And then you get the metadata of the target user (which should be just a black box `userid` without any details of what constitute a user identifier, since that’s how user reference are supposed to be manipulated in the API anyway) if the context user is allowed to access it. You don’t need to express more constraints than that.

---

<div class="post-metadata">

**Author:** ![pjeanjean](https://forum.xwiki.org/user_avatar/forum.xwiki.org/pjeanjean/32/5901_2.png) [@pjeanjean](https://forum.xwiki.org/u/pjeanjean)\
**Post date:** [January 22, 2026, 1:49pm UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/19 "2026-01-22T13:49:52Z")

</div>

My main issue with what you are suggesting is that `GET /wikis/{wikiName}/users/{userWikiName}%3AXWiki.{userId}` could return users not present in `GET /wikis/{wikiName}/users`, which might not be much of an issue when the two endpoints are properly documented, but might still be counter-intuitive.

And, yes, the syntax for the `userId` doesn’t need to be detailed, I just did it here to showcase how the requests would look like in practice. Now, in the case the user does not specify `{userWikiName}`, I’m not sure which user should be returned in priority when `{userId}` exists both as a global and a local user.

---

<div class="post-metadata">

**Author:** ![tmortagne](https://forum.xwiki.org/user_avatar/forum.xwiki.org/tmortagne/32/4930_2.png) [@tmortagne](https://forum.xwiki.org/u/tmortagne)\
**Post date:** [January 22, 2026, 2:09pm UTC](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982/20 "2026-01-22T14:09:16Z")

</div>

> [@pjeanjean](#):
>
> I’m not sure which user should be returned in priority when `{userId}` exists both as a global and a local user.

Deciding that is the user reference resolver job, not a choice made by the REST endpoint (its only job is putting the right context and pass the userid string to the resolver).

[Next page](https://forum.xwiki.org/t/add-a-users-rest-api-endpoint/17982.md?page=2)
