Skip to content

Organizations API

Manage nonprofit organizations, verification status, and team members.

List Organizations

GET /api/v1/organizations

Retrieve a list of verified nonprofit organizations.

javascript
const API_BASE = 'https://api.fundlyhub.org/api/v1';

const response = await fetch(`${API_BASE}/organizations?verified=true&limit=20`);
const organizations = await response.json();

// Response format
[
  {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Local Food Bank",
    "slug": "local-food-bank",
    "ein": "12-3456789",
    "verified": true,
    "logo": "https://example.com/logo.jpg",
    "website": "https://localfoodbank.org",
    "description": "Serving families in need since 1985",
    "fundraiser_count": 12,
    "total_raised": 456000
  }
]

Get Organization

GET /api/v1/organizations/:slug

Get detailed information about a specific organization.

javascript
const API_BASE = 'https://api.fundlyhub.org/api/v1';
const slug = 'local-food-bank';

const response = await fetch(`${API_BASE}/organizations/${slug}`);
const org = await response.json();

console.log('Organization:', org.name);
console.log('Verified:', org.verified);
console.log('Total raised:', org.total_raised);

Create Organization

POST /api/v1/organizations 🔒 Requires Authentication

Register a new nonprofit organization (requires verification).

javascript
const API_BASE = 'https://api.fundlyhub.org/api/v1';

const response = await fetch(`${API_BASE}/organizations`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  credentials: 'include',
  body: JSON.stringify({
    name: 'Local Food Bank',
    ein: '12-3456789',
    website: 'https://localfoodbank.org',
    description: 'Serving families in need since 1985',
    logo: 'https://example.com/logo.jpg',
    mission: 'End hunger in our community'
  })
});

const org = await response.json();
console.log('Organization created (pending verification):', org);

Update Organization

PATCH /api/v1/organizations/:id 🔒 Requires Authentication

Update organization details (admin only).

javascript
const API_BASE = 'https://api.fundlyhub.org/api/v1';
const orgId = '123e4567-e89b-12d3-a456-426614174000';

const response = await fetch(`${API_BASE}/organizations/${orgId}`, {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json'
  },
  credentials: 'include',
  body: JSON.stringify({
    description: 'Updated description',
    website: 'https://newfoodbank.org'
  })
});

const updated = await response.json();
console.log('Organization updated');

Manage Members

POST /api/v1/organizations/:id/members 🔒 Requires Authentication

Add team members to an organization.

javascript
const API_BASE = 'https://api.fundlyhub.org/api/v1';
const orgId = '123e4567-e89b-12d3-a456-426614174000';

const response = await fetch(`${API_BASE}/organizations/${orgId}/members`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  credentials: 'include',
  body: JSON.stringify({
    user_id: '456e7890-e89b-12d3-a456-426614174000',
    role: 'admin'  // 'admin', 'member', 'viewer'
  })
});

if (response.ok) {
  console.log('Member added successfully');
}

Response Codes

  • 200 - Success
  • 201 - Created successfully
  • 400 - Bad request / Validation errors
  • 401 - Authentication required
  • 403 - Permission denied
  • 404 - Organization not found
  • 429 - Rate limit exceeded
  • 500 - Server error

Built with VitePress