Skip to main content
GET
/
:projectId
/
users
/
by-foreign-id
Fetch User By Foreign Id
curl --request GET \
  --url https://api.replyke.com/api/v6/:projectId/users/by-foreign-id
{
  "user": {
    "id": "<string>",
    "projectId": "<string>",
    "foreignId": "<string>",
    "name": "<string>",
    "username": "<string>",
    "avatar": "<string>",
    "bio": "<string>",
    "birthdate": {},
    "reputation": 123,
    "location": {},
    "suspension": {
      "isSuspended": true,
      "reason": {},
      "startDate": {},
      "endDate": {}
    },
    "metadata": {},
    "createdAt": "<string>",
    "updatedAt": "<string>"
  },
  "created": true,
  "updated": true
}
Fetches a user by their foreignId. If no user exists, creates a new one. Also updates existing users if provided data differs.

Query Parameters

foreignId
string
required
A unique external user identifier
name
string
User’s display name
username
string
User’s handle/username
avatar
string
URL to the user’s avatar image
bio
string
User bio or description
metadata
string
JSON string of additional user metadata
secureMetadata
string
JSON string of secure metadata (not returned in response)

Response

user
object
The user object
created
boolean
Whether the user was created during this request
updated
boolean
Whether the user was updated during this request

Error Responses

{
  "error": "Missing or invalid foreign user ID.",
  "code": "user/invalid-identifier"
}
{
  "error": "Internal server error",
  "code": "user/server-error",
  "details": "<Error message>"
}

Notes

  • This endpoint is useful when managing users from external systems.
  • secureMetadata is accepted and used for updates, but never returned.
  • The response includes created and updated flags to indicate what occurred.
I