Authentication
To use the Juleb ERP API, you must have a valid API key. Currently, API keys are provided exclusively through our customer success or sales team.
Getting Your API Keyโ
Contact your dedicated customer success manager or reach out to our support team.
Speak with our sales team to learn about Juleb ERP and get started with API access.
Authentication Method: OAuth 2.0โ
The Juleb ERP API uses OAuth 2.0 for secure authentication. This industry-standard protocol ensures your data remains protected while providing seamless access to your ERP system.
How It Worksโ
- Request API Key - Contact our team
- Receive API Key - Secure token provided
- Make API Calls - Include in headers
Adding Authentication to Your Requestsโ
Include your API key in the Authorization header of every request:
- ๐ Header Format
- ๐ง Code Examples
Authorization: Bearer {YOUR_API_KEY}
Always replace {YOUR_API_KEY} with your actual API key. Never commit API keys to version control!
- JavaScript
- Python
- cURL
const apiKey = process.env.JULEB_API_KEY; // Store securely in environment variables
const accountName = process.env.JULEB_ACCOUNT_NAME;
const headers = {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
};
// Example API call
const response = await fetch(
`https://${accountName}.juleb.com/api/v1/inventory/product`,
{
method: "GET",
headers: headers,
}
);
const data = await response.json();
console.log(data);
import os
import requests
# Load from environment variables
api_key = os.getenv('JULEB_API_KEY')
account_name = os.getenv('JULEB_ACCOUNT_NAME')
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {api_key}'
}
# Example API call
response = requests.get(
f'https://{account_name}.juleb.com/api/v1/inventory/product',
headers=headers
)
if response.status_code == 200:
data = response.json()
print(data)
else:
print(f'Error: {response.status_code} - {response.text}')
# Set environment variables first
export JULEB_API_KEY="your-api-key-here"
export JULEB_ACCOUNT_NAME="your-account-name"
# Make authenticated request
curl -X GET \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $JULEB_API_KEY" \
"https://$JULEB_ACCOUNT_NAME.juleb.com/api/v1/inventory/product"
API Base URL and Versioningโ
URL Structureโ
https://{ACCOUNT_NAME}.juleb.com/api/v1/{endpoint}
{ACCOUNT_NAME}: Your unique Juleb account identifier (subdomain)api: API namespacev1: API version (ensures backward compatibility){endpoint}: Specific API endpoint (e.g.,inventory/product)
Examples by Accountโ
- Demo Account
- Your Account
https://demo.juleb.com/api/v1/inventory/product
https://demo.juleb.com/api/v1/pos/order
https://demo.juleb.com/api/v1/resources/partner
https://yourpharmacy.juleb.com/api/v1/inventory/product
https://yourpharmacy.juleb.com/api/v1/pos/order
https://yourpharmacy.juleb.com/api/v1/resources/partner
Security Best Practicesโ
Security Best Practicesโ
- Store API keys in environment variables
- Use server-side applications for API calls
- Rotate API keys regularly
- Monitor API usage and logs
- Use HTTPS for all requests
- Hardcode API keys in your source code
- Expose API keys in client-side JavaScript
- Share API keys via email or chat
- Use API keys in URLs or query parameters
- Commit API keys to version control
Testing Your Authenticationโ
Try the Interactive API Explorerโ
Before building your integration, test your API key with our interactive documentation:
Interactive documentation where you can test endpoints directly in your browser
๐ Open API Explorer (opens in new tab)
Quick Authentication Testโ
- Simple Test
- Detailed Test
- Browser Console Test
curl -X GET \
-H "Authorization: Bearer YOUR_API_KEY" \
"https://YOUR_ACCOUNT.juleb.com/api/v1/inventory/product?limit=1"
Expected Response:
{
"data": [...],
"meta": { "count": 1, "total": 150 },
"pagination": { ... }
}
Before running this code, make sure to:
- Replace
YOUR_API_KEY_HEREandYOUR_ACCOUNT_NAME_HEREwith your actual values, OR - Set environment variables:
JULEB_API_KEYandJULEB_ACCOUNT_NAME
async function testAuthentication() {
// Replace these with your actual values or set them as environment variables
const apiKey = process.env.JULEB_API_KEY || "YOUR_API_KEY_HERE";
const accountName =
process.env.JULEB_ACCOUNT_NAME || "YOUR_ACCOUNT_NAME_HERE";
// Check if API key and account name are properly set
if (
apiKey === "YOUR_API_KEY_HERE" ||
accountName === "YOUR_ACCOUNT_NAME_HERE"
) {
console.log(
"โ Please replace YOUR_API_KEY_HERE and YOUR_ACCOUNT_NAME_HERE with your actual values"
);
return;
}
try {
const response = await fetch(
`https://${accountName}.juleb.com/api/v1/inventory/product?limit=1`,
{
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
}
);
if (response.ok) {
const data = await response.json();
console.log("โ
Authentication successful!");
console.log("Sample data:", data);
} else {
console.log("โ Authentication failed:", response.status);
const errorText = await response.text();
console.log("Error details:", errorText);
}
} catch (error) {
console.log("โ Network error:", error.message);
}
}
testAuthentication();
For quick testing in your browser's developer console:
// Replace these with your actual values
const API_KEY = "your-actual-api-key";
const ACCOUNT_NAME = "your-actual-account-name";
fetch(`https://${ACCOUNT_NAME}.juleb.com/api/v1/inventory/product?limit=1`, {
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
})
.then((response) => response.json())
.then((data) => console.log("โ
Success:", data))
.catch((error) => console.log("โ Error:", error));
Common Authentication Errorsโ
| Status Code | Error | Solution |
|---|---|---|
| 401 | Unauthorized | Check your API key and ensure it's included in the Authorization header |
| 403 | Forbidden | Your API key may not have permission for this endpoint or account |
| 404 | Not Found | Verify your account name in the URL is correct |
| 429 | Rate Limited | Slow down your requests or contact support for higher limits |
Now that you're authenticated, learn how to explore API queries to get the most out of your API calls!