curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def get_user_by_id(api_key: str, user_id: str) -> dict:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
response.raise_for_status()
return response.json()
# Example usage
try:
user = get_user_by_id("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890")
print(f"User: {user['name']}")
print(f"Email: {user['email']}")
except Exception as e:
print(f"Failed to fetch user: {str(e)}")
const axios = require('axios');
async function getUserById(apiKey, userId) {
try {
const response = await axios.get(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return response.data;
} catch (error) {
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
throw error;
}
}
// Example usage
getUserById('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890')
.then(user => {
console.log(`User: ${user.name}`);
console.log(`Email: ${user.email}`);
})
.catch(error => console.error('Failed:', error.message));
{
"id": "1234567890",
"name": "John Doe",
"language": "en",
"occupation": "Salesman",
"location": "London",
"timezone": "Europe/London",
"email": "john.doe@example.com",
"isBanned": false,
"role": {
"alias": "learner"
},
"fromApi": false,
"image": null,
"attributes": {}
}
{
"status": 404,
"message": "Not found"
}
Users
Get User by ID
Get user personal information by user ID
GET
/
users
/
{userId}
curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def get_user_by_id(api_key: str, user_id: str) -> dict:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
response.raise_for_status()
return response.json()
# Example usage
try:
user = get_user_by_id("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890")
print(f"User: {user['name']}")
print(f"Email: {user['email']}")
except Exception as e:
print(f"Failed to fetch user: {str(e)}")
const axios = require('axios');
async function getUserById(apiKey, userId) {
try {
const response = await axios.get(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return response.data;
} catch (error) {
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
throw error;
}
}
// Example usage
getUserById('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890')
.then(user => {
console.log(`User: ${user.name}`);
console.log(`Email: ${user.email}`);
})
.catch(error => console.error('Failed:', error.message));
{
"id": "1234567890",
"name": "John Doe",
"language": "en",
"occupation": "Salesman",
"location": "London",
"timezone": "Europe/London",
"email": "john.doe@example.com",
"isBanned": false,
"role": {
"alias": "learner"
},
"fromApi": false,
"image": null,
"attributes": {}
}
{
"status": 404,
"message": "Not found"
}
Retrieve detailed information about a specific user using their unique ID.
Request Headers
string
required
API Key. Go to your Konstantly site > Settings > API and copy the value from there.
URL Parameters
string
required
User API ID (alphanumeric unique identifier)
Response
string
required
User ID, alphanumeric unique identifier
string
required
Full name of the user
string
required
Interface language (de, en, es, fr, pl, pt, ru)
string
Job title
string
Location
string
required
Timezone in TZ format
string
required
Email address
boolean
required
Whether user is banned from login
string
required
User role alias/identifier
boolean
required
Whether user is managed via API only
object
object
Custom user attributes
Error Responses
object
curl --request GET \
--url 'https://YOURSITE.konstant.ly/openapi/v1/users/1234567890' \
--header 'X-API-KEY: 1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv'
import requests
def get_user_by_id(api_key: str, user_id: str) -> dict:
url = f"https://YOURSITE.konstant.ly/openapi/v1/users/{user_id}"
headers = {"X-API-KEY": api_key}
response = requests.get(url, headers=headers)
if response.status_code == 404:
raise ValueError(f"User {user_id} not found")
response.raise_for_status()
return response.json()
# Example usage
try:
user = get_user_by_id("1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv", "1234567890")
print(f"User: {user['name']}")
print(f"Email: {user['email']}")
except Exception as e:
print(f"Failed to fetch user: {str(e)}")
const axios = require('axios');
async function getUserById(apiKey, userId) {
try {
const response = await axios.get(
`https://YOURSITE.konstant.ly/openapi/v1/users/${userId}`,
{
headers: { 'X-API-KEY': apiKey }
}
);
return response.data;
} catch (error) {
if (error.response?.status === 404) {
throw new Error(`User ${userId} not found`);
}
throw error;
}
}
// Example usage
getUserById('1qaz2wsx3edc4rfv1qaz2wsx3edc4rfv', '1234567890')
.then(user => {
console.log(`User: ${user.name}`);
console.log(`Email: ${user.email}`);
})
.catch(error => console.error('Failed:', error.message));
{
"id": "1234567890",
"name": "John Doe",
"language": "en",
"occupation": "Salesman",
"location": "London",
"timezone": "Europe/London",
"email": "john.doe@example.com",
"isBanned": false,
"role": {
"alias": "learner"
},
"fromApi": false,
"image": null,
"attributes": {}
}
{
"status": 404,
"message": "Not found"
}
Was this page helpful?
⌘I