API Reference
Donations

Donations

The Daffy API let's you get information about users donations and creating new ones.

⚠️

Only public donations will be shown for users other than yourself. Also, the donation info will be limited for other user donations.

Get Own Donations

Resource

GET    /v1/donations

Sample Response

{
  "items": [
    {
      "id": 1,
      "amount": 20,
      "status": "completed",
      "note": "Thank you",
      "scheduled_donation_id": null,
      "visibility": "public",
      "created_at": "2022-11-23T01:28:17.821Z",
      "mailed_at":  "2022-11-26T01:00:00.821Z",
      "non_profit": {
        "ein": "261544963",
        "name": "Khan Academy",
        "website": "https://www.khanacademy.org/",
        "city": "Mountain View",
        "state": "CA",
        "logo": "https://s3.us-west-2.amazonaws.com/production-daffy-static-content/non_profit/logos/4904275",
        "public_path": "/charities/261544963-khan-academy-mountain-view-ca",
        "public_url": "https://www.daffy.org/charities/261544963-khan-academy-mountain-view-ca",
        "cause_id": 1
      }
      "fund": {
        "id": 1,
        "name": "Charitable Fund"
      },
      "user": {
        "id": 1,
        "name": "Api User",
        "city": "Sunnyvale, California",
        "avatar": "https://static.daffy.org/avatars/1/api-user-avatar",
        "slug": "api-user-one"
      }
    },
    ...]
  "meta": {
    "count": 52,
    "last": 2,
    "page": 1
  }
}

Response Reference

Domain objects live under the items key, see pagination for more details.

NameTypeDescription
idnumberDonation ID
amountnumberDonation amount in USD
statusstringThe status of the donation [scheduled, waiting_for_funds, approved, rejected, completed, not_completed, check_mailed]
notestringThe public donation note if present
scheduled_donation_idnumberThe ID of the scheduled donation, if present
visibilitystringWether this donation is public or not
created_atiso dateWhen the donation was created
mailed_atiso dateWhen the donation was mailed (or null)
non_profit.einstringNon Profit Employer Identification Number
non_profit.namestringNon Profit name
non_profit.websitestringNon Profit URL
non_profit.citystringNon Profit city
non_profit.statestringNon Profit state
non_profit.logourlNon Profit Logo
non_profit.public_pathpathNon Profit path (on daffy.org)
non_profit.public_urlurlNon Profit URL (on daffy.org)
non_profit.cause_idnumberNon Profit cause ID
fund.idnumberFund ID
fund.namestringFund name
user.idnumberUser ID
user.namestringUser name
user.citystringUser city
user.avatarurlUser avatar URL
user.slugstringUser slug / nickname

Sample Request

curl "https://public.daffy.org/v1/donations" -H 'X-Api-Key: <YOUR KEY HERE>'

Get Users Donations

Resource

GET    /v1/users/:user_id/donations

Path Params

NameTypeDescription
:user_idnumberThe user ID whose donations you want to get

Sample Response

{
  "items": [
    {
      "id": 1,
      "user_id": 1234,
      "status": "completed",
      "note": "Thank you",
      "created_at": "2022-11-23T01:28:17.821Z",
      "mailed_at": "2022-11-26T02:25:13.532Z",
      "non_profit": {
        "ein": "261544963",
        "name": "Khan Academy",
        "website": "https://www.khanacademy.org/",
        "city": "Mountain View",
        "state": "CA",
        "logo": "https://s3.us-west-2.amazonaws.com/production-daffy-static-content/non_profit/logos/4904275",
        "public_path": "/charities/261544963-khan-academy-mountain-view-ca",
        "public_url": "https://www.daffy.org/charities/261544963-khan-academy-mountain-view-ca",
        "cause_id": 1
      }
    },
    ...
  ],
  "meta": {
    "count": 10,
    "last": 1,
    "page": 1
  }
}
 

Response Reference

Domain objects live under the items key, see pagination for more details.

NameTypeDescription
idnumberDonation ID
user_idnumberUser ID
statusstringThe status of the donation [scheduled, waiting_for_funds, approved, rejected, completed, not_completed, check_mailed]
notestringThe public donation note if present
created_atiso dateWhen the donation was created
mailed_atiso dateWhen the donation was mailed (or null)
non_profit.einstringNon Profit Employer Identification Number
non_profit.namestringNon Profit name
non_profit.websitestringNon Profit URL
non_profit.citystringNon Profit city
non_profit.statestringNon Profit state
non_profit.logourlNon Profit Logo
non_profit.public_pathpathNon Profit path (on daffy.org)
non_profit.public_urlurlNon Profit URL (on daffy.org)
non_profit.cause_idnumberNon Profit cause ID

Sample Request

curl "https://public.daffy.org/v1/users/1234/donations" -H 'X-Api-Key: <YOUR KEY HERE>'

Get Donation

Resource

GET    /v1/users/:user_id/donations/:donation_id

Path Params

NameTypeDescription
:user_idnumberThe user ID whose donation you want to get
:donation_idnumberThe donation ID

Sample Response

Same as GET /v1/users/:user_id/donations items.

Sample Request

curl "https://public.daffy.org/v1/users/1234/donations/5678" -H 'X-Api-Key: <YOUR KEY HERE>'

Create Donation

Resource

POST    /v1/donations

Sample Request Body

{
  "amount": 25,
  "ein": "941156258",
  "note": "love what they do!",
  "private_memo": "This is the private memo, is not displayed publicly."
}
NameTypeDescription
amountnumberThe amount of the donation in dollars
einstringThe Employer Identification Number of the non-profit
notestringThe public note attached to the donation
private_memostringA private memo attached to the donation, not displayed publicly

Sample Response

Same as GET /v1/users/:user_id/donations/:donation_id

Sample Request

CURL -X POST "https://public.daffy.org/v1/users/1234/donations" \
  -H 'X-Api-Key: <YOUR KEY HERE>' \
  -H 'Content-Type: application/json' \
  -d '{"amount":25,"ein":"941156258","note":"love what they do!","private_memo": "This is the private memo, is not displayed publicly."}'

Cancel Donation

Resource

DELETE    /v1/donations/:donation_id
⚠️

You can only cancel donations for the user that owns the provided API key and that haven't been already accepted or rejected by Daffy.

Path Params

NameTypeDescription
:donation_idnumberThe donation ID

Sample Response

{}

Sample Request

CURL -X DELETE "https://public.daffy.org/v1/donations/1234" -H 'X-Api-Key: <YOUR KEY HERE>'