Skip to main content

Overview

The Onboarding API allows new users to quickly set up their portfolio by importing data from their GitHub profile. This process fetches repositories, profile information, and other relevant data.
Onboarding endpoints require authentication. The user must be signed in with Clerk.

Start Onboarding

Initiate the onboarding process by importing GitHub data.
POST /api/v1/onboarding

Headers

Authorization
string
required
Bearer token from Clerk authentication
Content-Type
string
required
Must be application/json

Request Body

githubURL
string
required
GitHub profile URL or usernameExamples:
  • https://github.com/johndoe
  • johndoe
authType
enum
required
The authentication method used during sign-in
  • GITHUB - Signed in with GitHub OAuth
  • GOOGLE - Signed in with Google OAuth
  • EMAIL - Signed in with email/password

What Gets Imported

The onboarding process imports:
  1. Profile Information
    • Name
    • Bio
    • Location
    • Avatar/Profile image
    • Follower/Following counts
    • Website URL
  2. Repositories
    • Repository name and description
    • Programming languages used
    • Star and fork counts
    • Topics/tags
    • Creation and update dates
    • Repository URL
  3. GitHub Stats
    • Total public repositories
    • Account creation date
    • Public gists

Response

status
boolean
true if onboarding succeeded, false otherwise
message
string
Human-readable message describing the result

Example Request

curl -X POST https://api.gitfolio.in/api/v1/onboarding \
  -H "Authorization: Bearer your_clerk_token" \
  -H "Content-Type: application/json" \
  -d '{
    "githubURL": "https://github.com/johndoe",
    "authType": "GITHUB"
  }'

Success Response

Status: 200 OK
{
  "status": true,
  "message": "Onboarding completed successfully"
}

Error Responses

Unauthorized

Status: 401 Unauthorized
{
  "status": false,
  "message": "Unauthorized"
}
This occurs when:
  • No authentication token is provided
  • The token is invalid or expired

Onboarding Failed

Status: 400 Bad Request
{
  "status": false,
  "message": "Failed to fetch GitHub data"
}
Possible causes:
  • Invalid GitHub URL or username
  • GitHub API rate limit exceeded
  • GitHub profile not found
  • Network connectivity issues

Internal Server Error

Status: 500 Internal Server Error
{
  "status": false,
  "message": "Internal Server Error"
}

Onboarding Status

After successful onboarding, the user’s onBoardingStatus field is set to true. This indicates that the user has completed the initial setup and their portfolio is ready. You can check the onboarding status by fetching user data:
GET /api/v1/dashboard
The response will include:
{
  "data": {
    "onBoardingStatus": true,
    // ... other user data
  }
}

Authentication Type Storage

The authType parameter is stored in the user’s profile and can be one of:
  • GITHUB - User authenticated with GitHub
  • GOOGLE - User authenticated with Google
  • EMAIL - User authenticated with email/password
This information is used to:
  • Customize the user experience
  • Determine available GitHub API access (OAuth users may have higher rate limits)
  • Track sign-in methods for analytics

GitHub API Rate Limits

The GitHub API has rate limits that may affect onboarding:
  • Unauthenticated requests: 60 requests per hour
  • Authenticated requests: 5,000 requests per hour
Users who sign in with GitHub OAuth will have higher rate limits.
If rate limits are exceeded, the onboarding process will fail with an error message. Users should wait before retrying.

Best Practices

Onboarding can take several seconds to complete. Show a loading indicator to users while the process is running.
Before sending the request, validate that the GitHub URL is in the correct format:
  • https://github.com/username
  • username only
Implement proper error handling for:
  • Network failures
  • Invalid GitHub profiles
  • Rate limit errors
  • Authentication issues
Onboarding should typically only be done once per user. Check onBoardingStatus before initiating onboarding.

After Onboarding

Once onboarding is complete:
  1. User data is populated in the database
  2. Repositories are imported and can be managed via the Dashboard API
  3. User can customize their portfolio template
  4. User can add additional information (education, experience)

Example: Complete Onboarding Flow

async function onboardUser(githubUsername, authType, clerkToken) {
  try {
    const response = await fetch('https://api.gitfolio.in/api/v1/onboarding', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${clerkToken}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        githubURL: githubUsername,
        authType: authType
      })
    });

    const data = await response.json();

    if (data.status) {
      console.log('Onboarding successful!');
      // Redirect to dashboard
      window.location.href = '/dashboard';
    } else {
      console.error('Onboarding failed:', data.message);
      // Show error to user
    }
  } catch (error) {
    console.error('Network error:', error);
  }
}

// Usage
onboardUser('johndoe', 'GITHUB', userClerkToken);

Build docs developers (and LLMs) love