Skip to main content

Quick Start Guide

Get up and running with the Huntrecht Platform API in 5 minutes.

Prerequisites​

  • Huntrecht API credentials (client_id and client_secret)
  • Python 3.8+ or Node.js 18+
  • A code editor (VS Code recommended)

Step 1: Get Your Credentials​

  1. Go to your Profile at your Profile page (sign in if prompted — you will be redirected back)
  2. Open the Developer tab (requires a developer role and an eligible plan)
  3. Create an API client and copy your client_id and client_secret (the secret is shown only once)

No Developer tab? Your account needs the developer role for API access — contact support to request it.

Security

Never expose your client_secret in client-side code or public repositories.

Step 2: Install the SDK​

pip install huntrecht-sdk
from huntrecht import HuntrechtClient

client = HuntrechtClient(
client_id="hnt_your_client_id",
client_secret="your_secret"
)

Step 3: Authenticate​

# Authenticate and get access token
tokens = client.authenticate()
access_token = tokens["access_token"]
print(f"Token expires in: {tokens.get('expires_in', 1800)} seconds")
const tokens = await client.authenticate();
console.log(`Token expires in: ${tokens.expires_in} seconds`);

Step 4: Make Your First API Call​

Create a Customer Account​

# Create a B2B customer
customer = client.customers.create({
"email": "buyer@acme.com",
"company_name": "Acme Corporation",
"contact_name": "John Buyer",
"phone": "+1-555-123-4567"
})

print(f"Customer ID: {customer['id']}")
print(f"Status: {customer['status']}")

Get Customer Credit Score​

# Get credit score for the customer
credit = client.credit_risk.get_score(customer_id=customer['id'])

print(f"Credit Score: {credit['score']}")
print(f"Risk Level: {credit['risk_level']}")
print(f"Max Credit: ${credit['max_credit_limit']}")

Create an Order with Payment Terms​

# Create an order with Net 30 payment terms
order = client.orders.create({
"customer_id": customer['id'],
"line_items": [
{"product_id": "prod_001", "quantity": 10}
],
"payment_terms": "net_30"
})

print(f"Order ID: {order['id']}")
print(f"Total: ${order['total']}")
print(f"Due Date: {order['payment_due_date']}")

Step 5: Process a Subscription​

# Create a subscription with installments
subscription = client.subscriptions.create({
"customer_id": customer['id'],
"product_id": "prod_subscription_001",
"installments": 12,
"monthly_amount": 458.33
})

print(f"Subscription ID: {subscription['id']}")
print(f"Status: {subscription['status']}")
print(f"Next billing: {subscription['next_billing_date']}")

Full Example Script​

#!/usr/bin/env python3
"""
Huntrecht Platform API - Quick Start Example
"""

from huntrecht import HuntrechtClient
import os

def main():
# Initialize client
client = HuntrechtClient(
client_id=os.environ.get("HUNTRECHT_CLIENT_ID"),
client_secret=os.environ.get("HUNTRECHT_CLIENT_SECRET")
)

# Authenticate
print("Authenticating...")
tokens = client.authenticate()
print(f"✓ Authenticated (expires in {tokens.get('expires_in', 'N/A')}s)")

# Create customer
print("\nCreating customer...")
customer = client.customers.create({
"email": "buyer@company.com",
"company_name": "Test Company LLC",
"contact_name": "Jane Doe"
})
print(f"✓ Customer created: {customer['id']}")

# Check credit
print("\nChecking credit score...")
credit = client.credit_risk.get_score(customer_id=customer['id'])
print(f"✓ Credit Score: {credit['score']} ({credit['risk_level']})")

# Create order
print("\nCreating order...")
order = client.orders.create({
"customer_id": customer['id'],
"line_items": [
{"product_id": "prod_001", "quantity": 5}
],
"payment_terms": "net_30"
})
print(f"✓ Order created: {order['id']} - ${order['total']}")

print("\n✓ Quick start complete!")

if __name__ == "__main__":
main()

Environment Variables​

Create a .env file:

export HUNTRECHT_CLIENT_ID="hnt_your_client_id"
export HUNTRECHT_CLIENT_SECRET="your_client_secret"
export HUNTRECHT_BASE_URL="https://api.huntrecht.com/api/v1"

Common Errors​

ErrorCauseSolution
401 UnauthorizedInvalid credentialsCheck client_id and client_secret
403 ForbiddenInsufficient scopesRequest required scopes
429 Too Many RequestsRate limit exceededImplement backoff
400 Bad RequestInvalid request bodyValidate JSON structure

Next Steps​