Fetch User By Foreign Id
curl --request GET \
--url https://api.replyke.com/api/v6/:projectId/users/by-foreign-idimport requests
url = "https://api.replyke.com/api/v6/:projectId/users/by-foreign-id"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.replyke.com/api/v6/:projectId/users/by-foreign-id', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.replyke.com/api/v6/:projectId/users/by-foreign-id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.replyke.com/api/v6/:projectId/users/by-foreign-id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.replyke.com/api/v6/:projectId/users/by-foreign-id")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.replyke.com/api/v6/:projectId/users/by-foreign-id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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
}User Endpoints
Fetch User By Foreign Id
Get or create user by their external foreign ID
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-idimport requests
url = "https://api.replyke.com/api/v6/:projectId/users/by-foreign-id"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.replyke.com/api/v6/:projectId/users/by-foreign-id', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.replyke.com/api/v6/:projectId/users/by-foreign-id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.replyke.com/api/v6/:projectId/users/by-foreign-id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.replyke.com/api/v6/:projectId/users/by-foreign-id")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.replyke.com/api/v6/:projectId/users/by-foreign-id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"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
string
required
A unique external user identifier
string
User’s display name
string
User’s handle/username
string
URL to the user’s avatar image
string
User bio or description
string
JSON string of additional user metadata
string
JSON string of secure metadata (not returned in response)
Response
object
The user object
Show properties
Show properties
string
User’s unique identifier
string
ID of the project this user belongs to
string
External reference ID
string
User’s full name
string
User’s username
string
URL to user’s avatar image
string
User’s biography
string | null
User’s birthdate
number
User’s reputation score
object | null
User’s location
object
object
Custom public metadata
string
Account creation timestamp
string
Last update timestamp
boolean
Whether the user was created during this request
boolean
Whether the user was updated during this request
Error Responses
Missing or Invalid Foreign ID - 400 Bad Request
Missing or Invalid Foreign ID - 400 Bad Request
{
"error": "Missing or invalid foreign user ID.",
"code": "user/invalid-identifier"
}
Server Error - 500 Internal Server Error
Server Error - 500 Internal Server Error
{
"error": "Internal server error",
"code": "user/server-error",
"details": "<Error message>"
}
Notes
- This endpoint is useful when managing users from external systems.
secureMetadatais accepted and used for updates, but never returned.- The response includes
createdandupdatedflags to indicate what occurred.

