@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api API V1
@base https://api.getchange.io
@version v1
@auth Bearer basic
@endpoints 8
@toc api(8)

@endpoint POST /api/v1/donations/create
@desc Create a donation
@required {amount: str # The amount of the donation in cents., nonprofit_id: str # The id of a nonprofit from the CHANGE network., funding_source: str(merchant/customer) # Source of the donation funds. If you are collecting payment from your customer for the donation, use `customer`.}
@optional {zip_code: str # The customer's zip code. Provide this to unlock geographic insights.}
@returns(200) Donation successful
@errors {400: Param `nonprofit_id` invalid}

@endpoint GET /api/v1/donations/show
@desc Retrieve a donation
@required {id: str # The id of a donation. Ids are returned when a donation is created.}
@returns(200) successful

@endpoint GET /api/v1/donations/index
@desc List your donations
@optional {page: num # Which page to return. This endpoint is paginated, and returns maximum 30 donations per page.}
@returns(200) successful

@endpoint GET /api/v1/donations/carbon_calculate
@desc Calculate shipping carbon offset
@required {weight_lb: num # The total weight (in pounds) of the shipment.}
@optional {origin_address: num # The origin zip code (US only) of the shipment. If you send this parameter, also send `destination_address`., destination_address: num # The destination zip code (US only) of the shipment. If you send this parameter, also send `origin_address`., distance_mi: num # The total distance (in miles) of the shipment. You can use this parameter in place of `origin_address` and `destination_address`., transportation_method: str(air/truck/rail/sea) # The primary transportation method of the shipment.}
@returns(200) successful

@endpoint GET /api/v1/donations/crypto_calculate
@desc Calculate crypto carbon offset
@required {currency: str(eth/btc) # The currency of the transaction.}
@optional {count: num # The number of transactions to offset.}
@returns(200) successful

@endpoint GET /api/v1/donations/carbon_stats
@desc Retrieve carbon offset stats
@optional {id: num # The id of a donation to the CarbonFund nonprofit. Ids are returned when a donation is created. If an ID is not provided, the total stats for all donations to CarbonFund are returned.}
@returns(200) successful

@endpoint GET /api/v1/nonprofits/show
@desc Show a nonprofit
@required {id: str # The id of a nonprofit from the CHANGE network.}
@returns(200) Show successful

@endpoint GET /api/v1/nonprofits/list
@desc Search a nonprofit
@optional {name: str # A string to search., page: num # The page to return. This endpoint is paginated, and returns up to 30 nonprofits at a time.}
@returns(200) List successful

@end
