Get User Profile
curl --request GET \
--url https://harbor-parking.vercel.app/api/profileimport requests
url = "https://harbor-parking.vercel.app/api/profile"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://harbor-parking.vercel.app/api/profile', 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://harbor-parking.vercel.app/api/profile",
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://harbor-parking.vercel.app/api/profile"
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://harbor-parking.vercel.app/api/profile")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/profile")
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{
"profile": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "john.doe@example.com",
"full_name": "John Doe",
"apartment_number": "12A",
"phone_number": "+1234567890",
"is_approved": true,
"is_admin": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "john.doe@example.com",
"email_confirmed_at": "2024-01-15T10:30:00Z",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Profile & Authentication
Get User Profile
Retrieve the authenticated user’s profile information and basic user data
GET
/
api
/
profile
Get User Profile
curl --request GET \
--url https://harbor-parking.vercel.app/api/profileimport requests
url = "https://harbor-parking.vercel.app/api/profile"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://harbor-parking.vercel.app/api/profile', 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://harbor-parking.vercel.app/api/profile",
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://harbor-parking.vercel.app/api/profile"
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://harbor-parking.vercel.app/api/profile")
.asString();require 'uri'
require 'net/http'
url = URI("https://harbor-parking.vercel.app/api/profile")
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{
"profile": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "john.doe@example.com",
"full_name": "John Doe",
"apartment_number": "12A",
"phone_number": "+1234567890",
"is_approved": true,
"is_admin": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "john.doe@example.com",
"email_confirmed_at": "2024-01-15T10:30:00Z",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Overview
This endpoint retrieves comprehensive profile and authentication data for the currently authenticated user. It returns both the user’s profile information (managed by Harbor Parking) and their basic authentication data (managed by Supabase Auth).Authentication
Response
object
required
User’s Harbor Parking profile information
Show Profile Object
Show Profile Object
string
required
Unique profile identifier (UUID)
string
required
User’s email address
string
User’s full name (optional)
string
required
User’s apartment number in the building
string
User’s phone number (optional)
boolean
required
Whether the user has been approved by a building administrator
boolean
required
Whether the user has administrator privileges
string
required
Profile creation timestamp (ISO 8601)
string
required
Profile last update timestamp (ISO 8601)
object
required
User’s authentication data from Supabase
Example Request
curl -X GET "https://harbor-parking.vercel.app/api/profile" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json"
const response = await fetch('https://harbor-parking.vercel.app/api/profile', {
method: 'GET',
headers: {
'Authorization': `Bearer ${yourJwtToken}`,
'Content-Type': 'application/json'
}
});
const profileData = await response.json();
console.log(profileData);
import requests
url = "https://harbor-parking.vercel.app/api/profile"
headers = {
"Authorization": f"Bearer {your_jwt_token}",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
profile_data = response.json()
print(profile_data)
<?php
$url = 'https://harbor-parking.vercel.app/api/profile';
$headers = [
'Authorization: Bearer ' . $your_jwt_token,
'Content-Type: application/json'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$profile_data = json_decode($response, true);
curl_close($ch);
print_r($profile_data);
?>
Example Response
{
"profile": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "john.doe@example.com",
"full_name": "John Doe",
"apartment_number": "12A",
"phone_number": "+1234567890",
"is_approved": true,
"is_admin": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "john.doe@example.com",
"email_confirmed_at": "2024-01-15T10:30:00Z",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
Error Responses
{
"error": "Authentication required"
}
{
"error": "User profile not found"
}
{
"error": "Internal server error"
}
Use Cases
Check User Approval Status
const { profile } = await fetch('/api/profile').then(r => r.json());
if (!profile.is_approved) {
// Redirect to pending approval page
showPendingApprovalMessage();
} else {
// User can access full features
redirectToDashboard();
}
Display User Information
const { profile, user } = await fetch('/api/profile').then(r => r.json());
const userInfo = {
displayName: profile.full_name || user.email,
apartment: profile.apartment_number,
isAdmin: profile.is_admin,
memberSince: new Date(user.created_at).toLocaleDateString()
};
Profile Completeness Check
function checkProfileCompleteness(profile) {
const missing = [];
if (!profile.full_name) missing.push('full_name');
if (!profile.phone_number) missing.push('phone_number');
return {
isComplete: missing.length === 0,
missingFields: missing,
completionPercentage: ((4 - missing.length) / 4) * 100
};
}
Rate Limiting
This endpoint is rate limited to:- 10 requests per minute per user
- 100 requests per hour per user
Security Notes
- Profile data is protected by Row Level Security (RLS)
- Users can only access their own profile data
- Administrators can view all profiles through separate admin endpoints
- Email and phone data should be handled securely in client applications
Next: Update Profile
Learn how to update user profile information