Goodstack Services

Introduction
Goodstack API allows you to build good into your product by facilitating charitable donations. We achieve this through the API's listed and specified in this documentation.
For all donations using the Goodstack API, Goodstack handles the vetting and validation of the good causes and onward the disbursement of the donation.
The Goodstack API is organised around REST. All API responses, including errors, return JSON and use standard HTTP response codes. In all API requests you must specify the content-type HTTP header as application/json. All API requests must be made over HTTPS.
Authentication
Authenticate your API requests by setting your live secret API key in the Authorization header.
Two keys are provided to you, a publishable key prefixed with pk_ and a secret key prefixed with sk_.
Publishable API keys are meant solely to identify your goodstack account. These can safely be published in places like your JavaScript code, or in an Android or iPhone app and are meant for usage with our SDKs.
Secret API keys should be kept confidential and only used in secure server environments.
Anywhere that accepts a Publishable key will also accept a Secret key, but routes marked to accept a Secret key will not accept a Publishable key.
Formats
Dates
Dates are encoded as strings following the ISO 8601 standard 2021-08-01T12:00:00.000Z.
Pagination
A maximum of 100 objects can be returned per request and the limit can be specified by using the pageSize query parameter. By default, the pageSize is set to 25.
Metadata
Some objects have a metadata parameter that you can use to store key-value data.
You can specify up to 20 keys, with key names up to 40 characters long and values up to 250 characters long.
Errors
The API returns standard HTTP response codes to indicate success or failure of API requests. Errors may include a custom error message.
Error objects have these attributes, an id, a message corresponding to the HTTP response phrase of the error,
an optional invalid-params attribute detailing issues with the request.
An example error object returned from the API:
{
error: {
code: 'bad_request',
title: 'Bad request',
message: 'Something is wrong with your request, please check any parameters and try again',
reasons: ['amount is a required field']
}
}
A summary of the HTTP status codes returned from the api is listed in the table below.
| Code | Title | Description |
|---|---|---|
| 200 | Success | Request successful |
| 204 | No Content | Request successful with no content returned |
| 400 | Bad Request | Request was invalid |
| 401 | Unauthorised | Authorization header is invalid |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource does not exist |
| 429 | Too Many Requests | Rate Limited |
| 500s | Internal Server Error | Something went wrong with the Goodstack API |
Retry recommendations
Although rare, network requests may fail due to their inherent unreliability. To ensure a robust integration with Goodstack we recommend that you implement a retry mechanism, so that if a network request fails you are able to retry the request. Goodstacks API supports idempotency for safely retrying requests through usage of idempotency keys.
For some POST endpoints we allow clients to specify an idempotency key in the Idempotency-Key header. This allows the client to retry requests without accidentally performing the same operation twice.
If the same idempotency key is used for multiple requests, only the first successful request will be actioned and subsequent calls will return the result of the first request. Failed requests may be retried with the same idempotency key.
Requests with the same idempotency key and different payload will fail.
The idempotency key expires after 21 days. After this time, a new request with the same idempotency key will be treated as a new request.
Webhooks
Use webhooks to subscribe to updates on particular events that occur in Goodstack. Each time an event that you have subscribed to occurs, Goodstack submits a POST request to the designated webhook URL with information about the event.
To receive webhook notifications, use the webhook subscriptions API.
For detailed webhook event specifications, see the webhook events section.
Webhook Structure
All webhook payloads contain object and data fields. The data record contains:
| Parameter | Type | Description |
|---|---|---|
| id | string | Id of the event |
| createdAt | string | Timestamp of when the event was created |
| eventType | string | The type of the event e.g. validation_request.approved |
| eventData | record | Data associated with the event |
Webhook Security & Delivery
IP Addresses: Webhook notifications come from these IP addresses:
Production: 54.228.234.204, 54.76.67.168, 34.248.188.89, 34.243.152.218
Sandbox: 79.125.45.124, 54.76.168.240, 99.81.243.145, 54.220.118.167
Response Requirements: Your endpoint must return a 2xx HTTP status code to acknowledge receipt.
Retry Policy: Failed webhooks are retried 4 times over 14 hours with increasing delays.
Verification: Each webhook includes a Goodstack-Signature header generated using HMAC SHA-256 with your webhook subscription secret as the key.
Idempotency: Use the event id to handle duplicate webhook deliveries idempotently.
Authentication
- API Key: PublishableApiKey
- API Key: SecretApiKey
- API Key: DonationSessionToken
- HTTP: Bearer Auth
API key starting with 'pk_' that can be made public
Security Scheme Type: | apiKey |
|---|---|
Header parameter name: | Authorization |
API key starting with 'sk_' that must be kept secure
Security Scheme Type: | apiKey |
|---|---|
Header parameter name: | Authorization |
Donation session token
Security Scheme Type: | apiKey |
|---|---|
Header parameter name: | donation-session-token |
SCIM API key issued for the partner, presented as a bearer token in the
Authorization header. The key is bound to a single partner and the
partner must have the scim_api scope enabled. A missing or invalid key
returns 401; a valid key for a partner without the scope also returns
401 (detail: "scim feature not enabled for this partner").
Security Scheme Type: | http |
|---|---|
HTTP Authorization Scheme: | bearer |
Contact
Api support: engineering-support@goodstack.io
Validation submission events
See the Validation submission events reference.
Donation events
See the Donation events reference.