Skip to content

Charity Donations

Search vetted charities, record donations, and list donation history. All endpoints use the base URL https://app.thegoodapi.com.

All endpoints require an API key via the Authorization header:

Authorization: <your_api_key>

GET https://app.thegoodapi.com/charities/search

Search for charities by name or EIN.

NameTypeRequiredDescription
namestringNoSearch by charity name
einstringNoEmployer Identification Number
page_sizeintegerNoResults per page (1-20, default 20)
pageintegerNoPage number (minimum 1, default 1)
{
"total_items": 42,
"total_pages": 3,
"charities": [
{
"nonprofit_id": "n_abc123",
"name": "American Red Cross",
"ein": "53-0196605",
"description": "Prevents and alleviates human suffering",
"website": "https://www.redcross.org",
"icon_url": "https://example.com/redcross-icon.png"
}
]
}
FieldTypeDescription
nonprofit_idstringProvider-specific nonprofit ID
namestringCharity name
einstringEmployer Identification Number
descriptionstringCharity description or mission
websitestringCharity website URL
icon_urlstringCharity icon image URL
StatusReason
403Invalid or missing API key
500Charity search failed
Terminal window
curl -H "Authorization: your-api-key" \
"https://app.thegoodapi.com/charities/search?name=red+cross"

POST https://app.thegoodapi.com/charities/donate

Record a charity donation for your organization.

{
"amount_cents": 5000,
"ein": "53-0196605",
"nonprofit_id": "n_abc123",
"charity_name": "American Red Cross",
"idempotency_key": "order-12345-donate",
"attribution": "checkout-flow",
"metadata": {
"order_id": "12345",
"customer_email": "user@example.com"
}
}
FieldTypeRequiredDescription
amount_centsintegerYesDonation amount in cents (must be > 0)
einstring*Employer Identification Number of the charity
nonprofit_idstring*Provider-specific nonprofit identifier
charity_namestringNoHuman-readable charity name (auto-filled from search if omitted)
idempotency_keystringNoUnique key to prevent duplicate donations
attributionstringNoAttribution tag (e.g. checkout, campaign-xyz)
metadataobjectNoArbitrary key-value pairs for your records
{
"donation_id": "abc123def456",
"amount_cents": 5000,
"charity_name": "American Red Cross",
"ein": "53-0196605",
"nonprofit_id": "n_abc123",
"total_donations": 15,
"donation_details": [
{
"id": "abc123def456",
"amount_cents": 5000,
"currency": "USD",
"ein": "53-0196605",
"nonprofit_id": "n_abc123",
"charity_name": "American Red Cross",
"created_at": "2025-06-15T10:30:00Z",
"idempotency_key": "order-12345-donate",
"attribution": "checkout-flow",
"metadata": {
"order_id": "12345",
"customer_email": "user@example.com"
},
"refunded": false
}
]
}
FieldTypeDescription
donation_idstringUnique ID of the created donation
amount_centsintegerDonation amount in cents
charity_namestringCharity name (auto-filled from search if omitted)
einstringEIN (if provided)
nonprofit_idstringNonprofit ID (if provided)
total_donationsintegerTotal non-refunded donations for your org
donation_detailsarrayArray containing the created donation record

When idempotency_key is provided and a donation with the same key already exists for your organization:

  • The existing donation is returned.
  • The response includes the header Idempotent-Replayed: true.
  • No new donation is created.

The provided ein or nonprofit_id is validated against the charity search provider. If no matching charity is found, the request is rejected with a 400 error. When a charity is found and charity_name was not provided, it’s automatically populated from the search result.

StatusReason
400Missing ein and nonprofit_id
400amount_cents is missing or <= 0
400Invalid request body
400No charity found for the provided ein
400No charity found for the provided nonprofit_id
403Invalid or missing API key
500Internal server error

Basic donation by EIN:

Terminal window
curl -X POST -H "Authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{"amount_cents": 5000, "ein": "53-0196605"}' \
"https://app.thegoodapi.com/charities/donate"

Donation with idempotency and attribution:

Terminal window
curl -X POST -H "Authorization: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"amount_cents": 2500,
"nonprofit_id": "n_abc123",
"idempotency_key": "order-789-donate",
"attribution": "checkout",
"metadata": {"order_id": "789"}
}' \
"https://app.thegoodapi.com/charities/donate"

GET https://app.thegoodapi.com/charities/donations

Retrieve paginated donations for your organization with optional filtering.

NameTypeRequiredDescription
attributionstringNoFilter by attribution tag
metadata_keystringNoFilter by metadata key existence
metadata_valuestringNoFilter by metadata value (requires metadata_key)
start_datestringNoFilter on or after this date (YYYY-MM-DD)
end_datestringNoFilter on or before this date (YYYY-MM-DD)
pageintegerNoPage number (minimum 1, default 1)
page_sizeintegerNoResults per page (1-100, default 20)
{
"total_items": 50,
"total_pages": 5,
"page": 1,
"page_size": 10,
"donations": [
{
"id": "abc123def456",
"amount_cents": 5000,
"currency": "USD",
"ein": "53-0196605",
"nonprofit_id": "n_abc123",
"charity_name": "American Red Cross",
"created_at": "2025-06-15T10:30:00Z",
"idempotency_key": "order-12345-donate",
"attribution": "checkout-flow",
"metadata": {
"order_id": "12345"
},
"refunded": false
}
]
}
FieldTypeDescription
total_itemsintegerTotal number of matching donations
total_pagesintegerTotal number of pages (0 if no results)
pageintegerCurrent page number
page_sizeintegerNumber of items per page
donationsarrayArray of donation records
FieldTypeDescription
idstringUnique donation ID
amount_centsintegerDonation amount in cents
currencystringCurrency code (always USD)
einstringEIN of the charity
nonprofit_idstringProvider-specific nonprofit ID
charity_namestringHuman-readable charity name
created_atstringISO 8601 timestamp
idempotency_keystringIdempotency key (if provided)
attributionstringAttribution tag
metadataobjectArbitrary key-value pairs
refundedbooleanWhether the donation has been refunded
StatusReason
400Invalid date format
403Invalid or missing API key
500Internal server error

List all donations:

Terminal window
curl -H "Authorization: your-api-key" \
"https://app.thegoodapi.com/charities/donations"

Filter by attribution with pagination:

Terminal window
curl -H "Authorization: your-api-key" \
"https://app.thegoodapi.com/charities/donations?attribution=checkout&page=1&page_size=10"

Filter by date range:

Terminal window
curl -H "Authorization: your-api-key" \
"https://app.thegoodapi.com/charities/donations?start_date=2025-01-01&end_date=2025-06-30"

Filter by metadata:

Terminal window
curl -H "Authorization: your-api-key" \
"https://app.thegoodapi.com/charities/donations?metadata_key=order_id&metadata_value=12345"