Skip to main content

Authenticating and Making Your First Call

This guide will walk you through authenticating with the BettorEdge API and making your first authenticated request.

Prerequisites

  • A BettorEdge account with username and password
  • API access enabled on your account (see Getting Started with API Access if you haven't requested access yet)
  • Access to make HTTP requests (curl, Postman, or your preferred programming language)

Step 1: Obtain a Bearer Token

To access protected endpoints, you need to authenticate and obtain an access token.

Login Request

Make a POST request to /v1/authenticate/login with:

  • Basic Authentication: Your credentials encoded as username:password in base64
  • Request Body: Specify "attribute": "username" to indicate you're logging in with username
curl -X POST https://proxy.bettoredge.com/players/v1/authenticate/login \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'your_username:your_password' | base64)" \
-d '{
"attribute": "username"
}'

Response

{
"result": "success",
"message": "Login successful",
"player_id": "player_abc123",
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expire_datetime": "2024-01-15T12:00:00Z"
}

Store Your Token

Important: Save the access_token securely. You'll need it for all subsequent authenticated requests.

// Example: Store in memory or secure storage
const accessToken = data.access_token;

Step 2: Make Your First Authenticated Request

Now that you have a Bearer token, let's make an authenticated request to get your player profile.

Get Player Profile Request

Make a GET request to /v1/players/player/me with your Bearer token in the Authorization header.

curl -X GET https://proxy.bettoredge.com/players/v1/players/player/me \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response

{
"message": "Success",
"player": {
"player_id": "player_abc123",
"username": "your_username",
"email": "you@example.com",
"type": "premium",
"verified": true,
"profile_pic": "https://...",
"first_name": "John",
"last_name": "Doe"
},
"player_premium_items": []
}

Success!

🎉 Congratulations! You've successfully:

  1. ✅ Authenticated with the BettorEdge API using Basic Auth
  2. ✅ Obtained a Bearer token
  3. ✅ Made an authenticated request to get your player profile

Next Steps

Now that you're authenticated, you can:

Tips

  • Token Expiration: Access tokens expire after a period of time. Store the refresh_token to obtain new access tokens without re-authenticating
  • Security: Never hardcode credentials in your application. Use environment variables or secure configuration
  • Error Handling: Always check for result: "fail" in responses and handle errors appropriately

Need help? Check out the API Reference for detailed endpoint documentation.