curl -X GET "https://vantio.app/api/v1/users/user_123abc" \
-H "Authorization: Bearer sk_your_secret_key_here"
{
"id": "user_123abc",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"program_id": "prog_123abc",
"profile_picture": "https://example.com/profiles/john-doe.jpg",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z",
"metadata": {
"student_id": "STU-2024-001",
"major": "Computer Science",
"year": "Junior"
}
}
Users
Get User
Retrieve detailed information about a specific student ambassador
GET
/
api
/
v1
/
users
/
{id}
curl -X GET "https://vantio.app/api/v1/users/user_123abc" \
-H "Authorization: Bearer sk_your_secret_key_here"
{
"id": "user_123abc",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"program_id": "prog_123abc",
"profile_picture": "https://example.com/profiles/john-doe.jpg",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z",
"metadata": {
"student_id": "STU-2024-001",
"major": "Computer Science",
"year": "Junior"
}
}
Retrieve detailed information about a specific student ambassador by their unique ID. Use this endpoint when you need complete details about a single user, such as their profile information, program enrollment, and activity statistics.
Overview
The Get User endpoint returns comprehensive information about a single student ambassador. This is useful for:- Displaying user profile pages
- Showing detailed ambassador information
- Fetching user data before making updates
- Building user detail views in dashboards
Authentication
This endpoint requires authentication using a Bearer token in the Authorization header:Authorization: Bearer sk_your_secret_key_here
Path Parameters
string
required
The unique identifier of the user (student ambassador) you want to retrieve. This ID is returned when you list users or create a new user.Example:
user_123abcRequest Example
curl -X GET "https://vantio.app/api/v1/users/user_123abc" \
-H "Authorization: Bearer sk_your_secret_key_here"
Response
The API returns a detailed user object containing all available information about the student ambassador:string
required
Unique identifier for the user.
string
required
First name of the student ambassador.
string
required
Last name of the student ambassador.
string
required
Email address of the student ambassador.
string
required
ID of the program this user belongs to.
string
URL to the user’s profile picture, if available.
string
required
ISO 8601 timestamp of when the user was created.
string
ISO 8601 timestamp of when the user was last updated.
object
Additional metadata associated with the user. This can include custom fields you’ve added.
Response Example
{
"id": "user_123abc",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@example.com",
"program_id": "prog_123abc",
"profile_picture": "https://example.com/profiles/john-doe.jpg",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-20T14:45:00Z",
"metadata": {
"student_id": "STU-2024-001",
"major": "Computer Science",
"year": "Junior"
}
}
Error Responses
object
Unauthorized - Invalid or missing API key
{
"error": "Unauthorized",
"message": "Invalid or missing API key"
}
object
Not Found - The user with the specified ID does not exist
{
"error": "Not Found",
"message": "User not found"
}
Use Cases
Displaying User Profile
Fetch user details to display in a profile page:async function getUserProfile(userId) {
try {
const response = await fetch(
`https://vantio.app/api/v1/users/${userId}`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
if (response.status === 404) {
throw new Error('User not found');
}
if (!response.ok) {
throw new Error('Failed to fetch user');
}
return await response.json();
} catch (error) {
console.error('Error fetching user:', error);
throw error;
}
}
Validating User Existence
Before performing operations on a user, verify they exist:async function userExists(userId) {
const response = await fetch(
`https://vantio.app/api/v1/users/${userId}`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
return response.status === 200;
}
Building User Detail Components
Use this endpoint to populate user detail views:async function UserDetail({ userId }) {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
async function fetchUser() {
try {
const response = await fetch(
`https://vantio.app/api/v1/users/${userId}`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
if (response.ok) {
const userData = await response.json();
setUser(userData);
}
} catch (error) {
console.error('Error:', error);
} finally {
setLoading(false);
}
}
fetchUser();
}, [userId]);
if (loading) return <div>Loading...</div>;
if (!user) return <div>User not found</div>;
return (
<div>
<h1>{user.first_name} {user.last_name}</h1>
<p>{user.email}</p>
{/* Render other user details */}
</div>
);
}
Best Practices
- Cache user data - User information doesn’t change frequently, so cache responses to reduce API calls
- Handle 404 errors - Always check if the user exists before displaying their information
- Validate user IDs - Ensure the ID format is correct before making the request
- Use error boundaries - Implement proper error handling in your UI components
Rate Limits
This endpoint is subject to rate limiting. Check the response headers for rate limit information.Was this page helpful?