Skip to main content
Fetch User by Foreign ID
Finds a user within the project by their foreignId — the external identifier you provided when creating or syncing the user. This endpoint only reads: a user that doesn’t exist is 404 for every caller. To fetch a user or create them when missing, use Fetch or Create User by Foreign ID (POST, service key only), which takes the profile in the request body.
If the profile owner has blocked the viewer — the signed-in user, or the user a service key names in actingUserId — this returns 404 — the same response as a user who does not exist. The reverse is not true: a user you have blocked stays visible, so you keep a way to find and unblock them. Requires the moderation bundle.

Query Parameters

Acting user

string
Service key only: the user to read as. The response is exactly what that user’s own access token would get — a profile whose owner blocked them returns 404. Leave it out for the anonymous view. A user token always acts as its own user and must not send it, and neither may a request with no credentials (400 user/acting-user-not-allowed).
string
required
The external identifier from your system. It is matched exactly as sent. A blank or whitespace-only value returns 400 user/invalid-query (foreignId: Foreign ID is required).
string
Associations to include, as a comma-separated value or repeated params. The only value is:
  • files — the processed avatarFile and bannerFile objects
Matching ignores case. An unknown value returns 400 user/invalid-query.

Space-scoped reputation

This endpoint has no space in context, so the opt-in spaceReputationId accepts a space <uuid> or none only — context is rejected (400). It adds a spaceReputation field to each returned user, alongside the always-present reputation total. Requires the reputation bundle. See the Reputation data model.

Response

Returns HTTP 200 with the user object:
string
Unique user ID (UUID).
string | null
The foreign ID you provided.
string
Project this user belongs to.
string | null
Display name.
string | null
Unique username within the project.
string | null
Avatar image URL.
string | null
Short bio text.
object | null
Public custom key-value data.
number
Reputation score.
object | null
Processed avatar image with variants. Only present when include=files is requested.
object | null
Processed banner image with variants. Only present when include=files is requested.
string
ISO timestamp of account creation.

Error Responses

Returned for an invalid query: a missing or blank foreignId (foreignId: Foreign ID is required), or an unknown include value.
The request sent createIfNotFound or a profile field (name, username, avatar, bio, metadata, secureMetadata). This endpoint only reads; creating a user is POST /users/by-foreign-id, with the profile in the body. Returned for every caller.
For a profile field, the message names it:
A user token, or a request with no credentials, sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.

See Also