Getting Started
Quick start guide for the Happy To Deliver API
Prerequisites
Before you begin, ensure you have:
- A Happy To Deliver account with API access
- Your API credentials (API Key and Secret)
- Basic understanding of REST APIs
- Node.js 18+ or your preferred programming language
Authentication
All API requests require authentication using your API credentials:
const response = await fetch('https://api.happytodeliver.com/v1/accounts', {
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
});Base URL
https://api.happytodeliver.com/v1Making Your First Request
Here's a simple example to get your account information:
// Get account information
const getAccount = async () => {
const response = await fetch('https://api.happytodeliver.com/v1/accounts/me', {
headers: {
'Authorization': `Bearer ${API_KEY}`,
},
});
const account = await response.json();
console.log(account);
};Response Format
All API responses follow a consistent format:
{
"success": true,
"data": {
// Response data here
},
"meta": {
"timestamp": "2024-01-01T00:00:00Z"
}
}Error Handling
Errors return appropriate HTTP status codes and error messages:
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid API key"
}
}