(415) 300-0180
The Give Hub API provides RESTful endpoints for managing campaigns, donations, users, and impact metrics on the crowdfunding platform. All endpoints are accessed via HTTPS and return JSON responses.
https://api.thegivehub.com
All authenticated endpoints require a valid JWT token in the Authorization header:
Authorization: Bearer <token>
POST /api/auth/login
Authenticates a user and returns access tokens
Body:
{
"username": "string", // Email or username
"password": "string"
}
Response:
{
"success": true,
"user": {
"id": "string",
"email": "string",
"username": "string",
"profile": {...}
},
"tokens": {
"accessToken": "string",
"refreshToken": "string",
"expires": "number"
}
}
POST /api/auth/register
Creates a new user account
Body:
{
"email": "string",
"username": "string",
"password": "string",
"firstName": "string",
"lastName": "string",
"lang": "string",
"profile": {
// Additional profile fields
}
}
Response:
{
"success": true,
"message": "string",
"userId": "string"
}
POST
/api/auth/request-verification
Verifies user’s email with verification code
Body:
{
"email": "string",
"code": "string"
}
POST /api/campaigns
Creates a new fundraising campaign
Required Auth: Yes
Body:
{
"title": "string",
"description": "string",
"target_amount": "number",
"creator_id": "string",
"stellar_account": "string",
"milestones": [{
"description": "string",
"amount": "number",
"status": "string",
"verification_docs": ["string"]
}],
"status": "string"
}
/api/campaigns
status
: Filter by statuscategory
: Filter by categorypage
: Page numberlimit
: Results per pageGET /api/campaigns/:id
Returns detailed campaign information
Response:
{
"_id": "string",
"title": "string",
"description": "string",
"target_amount": "number",
"current_amount": "number",
"creator_id": "string",
"stellar_account": "string",
"milestones": [...],
"status": "string",
"created_at": "date"
}
POST /api/impactmetrics
Records impact metrics for a campaign
Required Auth: Yes
Body:
{
"campaignId": "string",
"category": "string",
"metrics": [{
"name": "string",
"baseline": "number",
"current": "number",
"target": "number",
"unit": "string",
"verificationMethod": "string"
}],
"beneficiaries": {
"direct": "number",
"indirect": "number"
}
}
/api/impactmetrics/:campaignId
from
: Start dateto
: End datePOST /api/updates
Posts an update to a campaign
Required Auth: Yes
Body:
{
"campaignId": "string",
"type": "string",
"title": "string",
"content": "string",
"media": [{
"type": "string",
"url": "string",
"caption": "string"
}]
}
/api/updates
campaignId
: Filter by campaigntype
: Update typepage
: Page numberlimit
: Results per pagePOST /api/donations
Records a new donation
Required Auth: Yes
Body:
{
"userId": "string",
"campaignId": "string",
"amount": {
"value": "number",
"currency": "string"
},
"transaction": {
"txHash": "string",
"stellarAddress": "string"
}
}
/api/donations
campaignId
: Filter by campaignuserId
: Filter by userstatus
: Filter by status/api/notifications
status
: Filter by statustype
: Filter by typepage
: Page numberPUT /api/notifications/:id
Updates notification status
Required Auth: Yes
Body:
{
"status": "string" // read, archived, deleted
}
All endpoints return error responses in the following format:
{
"success": false,
"error": "Error message"
}
Common HTTP status codes:
200
: Success400
: Bad Request401
: Unauthorized403
: Forbidden404
: Not Found451
: Government Blocked500
: Internal Server ErrorAPI requests are limited to:
The API can send webhook notifications for the following events:
A sandbox environment is available for testing:
https://sandbox-api.thegivehub.com
Official SDK libraries are available for: