Skip to content

Shopify API

The Shopify API (https://sprout-app.thegoodapi.com/app/api) lets Shopify merchants and integration partners build custom Customer Account Extensions, storefront impact portals, and loyalty integrations (such as Avada Joy, Yotpo, LoyaltyLion, and Klaviyo) to query customer/store impact, plant trees, recover ocean plastic, trigger charity donations, process reversals, and fetch verification evidence.


All requests must be made over HTTPS with your credentials passed in HTTP request headers.

Header NameTypeRequiredDescription
api_key (or X-API-Key)stringYesStore-scoped Shopify API Key (PROD-... or TEST-...).
shop_namestringYesYour Shopify store domain (e.g., my-store.myshopify.com).
Content-TypestringYes (POST)application/json (required for POST request bodies).
Idempotency-KeystringOptionalUnique token to safely retry POST operations without duplicate executions.

API keys are strictly scoped per Shopify store:

  1. In Shopify Admin for each store, open Sprout / GoodAPI → Advanced Settings → API Settings and generate that store’s PROD- and TEST- keys.
  2. In your server-to-server backend, maintain a shop_domain → api_key mapping and send matching shop_name + api_key headers on each request.
  3. All stores expose identical endpoints, schemas, and rate limits.

Rate limits are enforced per store using a 60-second fixed window:

BucketDefault LimitHeaders Included on Every Response
GET (Read endpoints)300 requests / minute per storeX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
POST (Write endpoints)60 requests / minute per storeX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

When exceeded, the API returns HTTP 429 Too Many Requests (RATE_LIMIT_EXCEEDED) with a Retry-After header indicating how many seconds to wait before retrying.

Recommended backend caching TTLs:

  • Customer Impact Profile (GET /app/api/customers/impact): Cache for 1–5 minutes keyed by (shop_name, customer_id/email, cursor) (responses include Cache-Control: private, max-age=60).
  • Store Impact Projects (GET /app/api/projects): Cache for 24 hours keyed by (shop_name, locale) (responses include Cache-Control: private, max-age=3600). Set include_projects=false on /app/api/customers/impact when caching projects separately.

Across query endpoints (/app/api/customers/impact, /app/api/plant, /app/api/plastic, /app/api/charity/donations, /app/api/impact/stats):

  • Customer ID (customer_id): Accepts either a numeric Shopify ID (123456789) or Shopify GID (gid://shopify/Customer/123456789) and performs an exact ID match.
  • Email (email / customer_email): Performs an exact, case-insensitive match. Providing both customer_id and email returns records matching either exact identifier.
  • Order ID (order_id): Matches with or without # prefix (1001 matches #1001 and vice versa).

GET https://sprout-app.thegoodapi.com/app/api/verify

Verifies your store API key and returns key mode (PROD vs TEST), store domain, status, and enabled impact features.

{
"status": "active",
"shop_domain": "my-store.myshopify.com",
"key_mode": "PROD",
"features": {
"tree_planting": true,
"plastic_removal": true,
"donations": true
}
}
Terminal window
curl -X GET "https://sprout-app.thegoodapi.com/app/api/verify" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com"

GET https://sprout-app.thegoodapi.com/app/api/customers/impact

Unified server-to-server endpoint designed for custom Shopify Customer Account Extensions and portals. Returns a customer’s lifetime impact totals, store-wide totals, cursor-paginated per-order impact breakdown (newest first), and active project metadata/media/UN SDGs in a single call.

ParameterTypeRequiredDescription
customer_idstring / integerConditional*Shopify customer numeric ID or gid://shopify/Customer/<id>. Exact match.
email / customer_emailstringConditional*Exact case-insensitive customer email. *At least one of customer_id or email is required.
include_ordersbooleanOptionalInclude paginated per-order impact breakdown (orders). Default: true.
include_projectsbooleanOptionalInclude store active projects, web-safe images, and UN SDGs (projects). Default: true.
include_store_totalsbooleanOptionalInclude store-wide totals (store_totals). Default: true.
limitintegerOptionalOrders per page (default: 25, max: 100).
cursorstringOptionalOpaque cursor from previous response’s orders.next_cursor.
localestringOptionalProject copy language (en, de, es, fr). Default: en.

CO2 Metrics Included:

  • co2_kg_annual: Estimated annual sequestration (trees * 12.3 kg/yr).
  • co2_tonnes_lifetime: Estimated lifetime sequestration matching GoodAPI Impact Hub (round(0.31 * 0.80 * trees, 2) tonnes).
{
"shop_domain": "my-store.myshopify.com",
"key_mode": "PROD",
"customer": {
"customer_id": 123456789
},
"features": {
"tree_planting": true,
"plastic_removal": false,
"donations": false
},
"totals": {
"trees": 12,
"plastic_bottles": 0,
"plastic_kg": 0,
"donations_usd": 0,
"co2_kg_annual": 147.6,
"co2_tonnes_lifetime": 2.98
},
"store_totals": {
"trees": 25000,
"plastic_bottles": 0,
"plastic_kg": 0,
"co2_kg_annual": 307500,
"co2_tonnes_lifetime": 6200
},
"orders": {
"items": [
{
"order_name": "#1042",
"created_at": "2026-11-25T14:22:00Z",
"trees": 2,
"plastic_bottles": 0,
"donations_usd": 0
}
],
"count": 1,
"has_more": true,
"next_cursor": "eyJ0IjoiMjAyNi0xMS0yNVQxNDoyMjowMFoiLCJpZCI6IjY5Y2EwMjE5MDA0OTcyMDRjMWM1NTA1ZCJ9"
},
"projects": [
{
"id": "veritree-kenya",
"type": "tree_planting",
"provider": "veritree",
"title": "Kilifi, Kenya",
"region": "Kenya",
"description": "With your support, we are restoring the mangrove forests in Kenya...",
"verified_by": "Planting verified by Veritree",
"gps_coordinates": "-2.51650, 40.48399",
"hero_image_url": "https://sprout-app.thegoodapi.com/treeshop-app-assets/kenya-mangroves-1.jpg?fm=webp&auto=format&w=900",
"images": [
"https://storage.googleapis.com/treeshop-app-assets/customer-account-extension-assets/trees/Kenya/Kilifi%20Nursery.jpeg"
],
"un_sdgs": [
{
"goal": 13,
"logo_url": "https://storage.googleapis.com/treeshop-app-assets/customer-account-extension-assets/UN%20SDG/E-WEB-Goal-13.svg",
"learn_more_url": "https://storage.googleapis.com/treeshop-app-assets/customer-account-extension-assets/UN%20SDG/SDG_report_2023_infographics_Goal%2013.jpg"
}
]
}
]
}
Terminal window
curl -X GET "https://sprout-app.thegoodapi.com/app/api/customers/impact?customer_id=gid://shopify/Customer/123456789&limit=25" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com"

GET https://sprout-app.thegoodapi.com/app/api/projects

Returns active tree-planting and ocean plastic removal projects for the store, including localized descriptions, GPS coordinates, UN SDGs, and web-ready images.

ParameterTypeRequiredDescription
localestringOptionalProject copy language (en, de, es, fr). Default: en.
{
"shop_domain": "my-store.myshopify.com",
"key_mode": "PROD",
"locale": "en",
"projects": [
{
"id": "veritree-kenya",
"type": "tree_planting",
"provider": "veritree",
"title": "Kilifi, Kenya",
"region": "Kenya",
"description": "With your support, we are restoring the mangrove forests in Kenya...",
"verified_by": "Planting verified by Veritree",
"gps_coordinates": "-2.51650, 40.48399",
"hero_image_url": "https://sprout-app.thegoodapi.com/treeshop-app-assets/kenya-mangroves-1.jpg?fm=webp&auto=format&w=900",
"images": [
"https://storage.googleapis.com/treeshop-app-assets/customer-account-extension-assets/trees/Kenya/Kilifi%20Nursery.jpeg"
],
"un_sdgs": [
{
"goal": 13,
"logo_url": "https://storage.googleapis.com/treeshop-app-assets/customer-account-extension-assets/UN%20SDG/E-WEB-Goal-13.svg",
"learn_more_url": "https://storage.googleapis.com/treeshop-app-assets/customer-account-extension-assets/UN%20SDG/SDG_report_2023_infographics_Goal%2013.jpg"
}
]
}
]
}
Terminal window
curl -X GET "https://sprout-app.thegoodapi.com/app/api/projects?locale=en" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com"

POST https://sprout-app.thegoodapi.com/app/api/plant

Trigger tree planting for a customer order or loyalty reward redemption.

ParameterTypeRequiredDescription
treesintegerYesNumber of trees to plant.
customer_idstring / integerOptionalShopify Customer ID (numeric or gid://shopify/Customer/<id>).
customer_emailstringOptionalCustomer email address (used for attribution and Klaviyo triggers).
customer_namestringOptionalCustomer full name.
order_idstringOptionalShopify Order ID or order reference.
notesstringOptionalIntegration notes or redemption details.
{
"status": "success",
"mode": "PROD",
"source": "api",
"id": "tree_1732700000000000000",
"tree_id": "tree_1732700000000000000",
"trees_planted": 5,
"project_id": "veritree-kenya",
"customer_id": 12345678,
"customer_email": "jane@example.com",
"customer_name": "Jane Doe",
"order_id": "1001",
"created_at": "2026-11-27T06:11:39Z"
}
Terminal window
curl -X POST "https://sprout-app.thegoodapi.com/app/api/plant" \
-H "Content-Type: application/json" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com" \
-H "Idempotency-Key: plant-1001" \
-d '{
"trees": 5,
"customer_id": 12345678,
"customer_email": "jane@example.com",
"customer_name": "Jane Doe",
"order_id": "1001",
"notes": "Loyalty Points Redemption"
}'

GET https://sprout-app.thegoodapi.com/app/api/plant

Query planted tree records with date range filtering and cursor pagination (sorted newest first).

ParameterTypeRequiredDescription
customer_idstring / integerOptionalFilter by exact Shopify Customer ID (numeric or gid://shopify/Customer/<id>).
email / customer_emailstringOptionalFilter by exact case-insensitive customer email.
order_idstringOptionalFilter by order name (supports # prefix matching, e.g. 1001 matches #1001).
start_datestringOptionalFilter records created on or after date (YYYY-MM-DD or RFC3339).
end_datestringOptionalFilter records created on or before date (YYYY-MM-DD or RFC3339).
limitintegerOptionalMax items to return (default: 50, max: 100).
afterstringOptionalCursor timestamp from next_cursor for fetching the next page.
{
"trees": [
{
"id": "69ca021900497204c1c5505d",
"shop_name": "my-store.myshopify.com",
"order_name": "#1001",
"count": 5,
"created_at": "2026-11-27T06:11:39.815Z",
"customer_id": 12345678,
"email": "jane@example.com",
"customer_name": "Jane Doe"
}
],
"count": 1,
"has_more": false,
"next_cursor": ""
}
Terminal window
curl -X GET "https://sprout-app.thegoodapi.com/app/api/plant?customer_id=gid://shopify/Customer/12345678&limit=20" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com"

POST https://sprout-app.thegoodapi.com/app/api/plastic

Trigger ocean plastic bottle recovery for a customer order or reward redemption.

ParameterTypeRequiredDescription
bottlesintegerYesNumber of plastic bottles to recover.
customer_idstring / integerOptionalShopify Customer ID (numeric or gid://shopify/Customer/<id>).
customer_emailstringOptionalCustomer email address.
customer_namestringOptionalCustomer full name for attribution.
order_idstringOptionalShopify Order ID.
notesstringOptionalIntegration notes.
{
"status": "success",
"mode": "PROD",
"id": "plastic_1732700000000000000",
"plastic_id": "plastic_1732700000000000000",
"bottles_rescued": 50,
"order_id": "1001",
"customer_id": 12345678,
"customer_email": "jane@example.com",
"customer_name": "Jane Doe",
"created_at": "2026-11-27T06:11:39Z"
}
Terminal window
curl -X POST "https://sprout-app.thegoodapi.com/app/api/plastic" \
-H "Content-Type: application/json" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com" \
-d '{
"bottles": 50,
"customer_id": 12345678,
"customer_email": "jane@example.com",
"customer_name": "Jane Doe",
"order_id": "1001"
}'

GET https://sprout-app.thegoodapi.com/app/api/plastic

Query ocean plastic recovery records with date range filtering and cursor pagination (sorted newest first).

ParameterTypeRequiredDescription
customer_idstring / integerOptionalFilter by exact Shopify Customer ID (numeric or gid://shopify/Customer/<id>).
email / customer_emailstringOptionalFilter by exact case-insensitive customer email.
order_idstringOptionalFilter by order name (supports # prefix matching).
start_datestringOptionalFilter records created on or after date (YYYY-MM-DD or RFC3339).
end_datestringOptionalFilter records created on or before date (YYYY-MM-DD or RFC3339).
limitintegerOptionalMax items to return (default: 50, max: 100).
afterstringOptionalCursor timestamp from next_cursor for fetching the next page.
{
"plastics": [
{
"id": "69ca021900497204c1c5505e",
"shop_name": "my-store.myshopify.com",
"order_name": "#1001",
"count": 50,
"created_at": "2026-11-27T06:11:39.815Z",
"customer_id": 12345678,
"email": "jane@example.com",
"customer_name": "Jane Doe"
}
],
"count": 1,
"has_more": false,
"next_cursor": ""
}

GET https://sprout-app.thegoodapi.com/app/api/charities

Search available non-profit charity partners configured for your store (supports ?query= or ?q=).

POST https://sprout-app.thegoodapi.com/app/api/charity/donate

Trigger a charitable donation allocation for a customer purchase or loyalty redemption.

ParameterTypeRequiredDescription
charity_idstringYesNon-profit charity partner ID (or configured charity name).
merchant_amountnumberConditional*Merchant-funded donation amount in USD (also accepts amount_dollars).
customer_amountnumberConditional*Customer-funded donation amount in USD (requires customer_id or customer_email). *At least one of merchant_amount or customer_amount must be > 0.
customer_idstring / integerOptionalShopify Customer ID (numeric or gid://shopify/Customer/<id>).
customer_emailstringOptionalCustomer email address.
customer_namestringOptionalCustomer full name.
order_idstringOptionalShopify Order ID.
{
"status": "success",
"mode": "PROD",
"id": "donation_1732700000000000000",
"donation_id": "donation_1732700000000000000",
"charity_id": "charity_trees_for_future",
"charity_name": "Trees for the Future",
"amount": 5.0,
"order_id": "1001",
"customer_id": 12345678,
"customer_email": "jane@example.com",
"created_at": "2026-11-27T06:11:39Z"
}
Terminal window
curl -X POST "https://sprout-app.thegoodapi.com/app/api/charity/donate" \
-H "Content-Type: application/json" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com" \
-d '{
"charity_id": "charity_trees_for_future",
"merchant_amount": 5.00,
"customer_id": 12345678,
"customer_email": "jane@example.com",
"customer_name": "Jane Doe"
}'

GET https://sprout-app.thegoodapi.com/app/api/charity/donations

Query charitable donation records by customer_id, email/customer_email, charity_id, order_id, start_date, end_date, limit (default 50), and after.


GET https://sprout-app.thegoodapi.com/app/api/impact/stats

Retrieve store-wide lifetime totals (when no customer filter is provided) or customer-scoped impact totals (trees, plastic_bottles, donations, co2_kg, customer_scoped). For combined store totals + customer totals + per-order history + project metadata, use GET /app/api/customers/impact.

ParameterTypeRequiredDescription
customer_idstring / integerOptionalFilter by exact Shopify Customer ID (numeric or gid://shopify/Customer/<id>).
email / customer_emailstringOptionalFilter by exact case-insensitive customer email.
{
"trees": 15,
"plastic_bottles": 100,
"donations": 10.0,
"co2_kg": 184.5,
"customer_scoped": true
}
Terminal window
curl -X GET "https://sprout-app.thegoodapi.com/app/api/impact/stats?customer_id=gid://shopify/Customer/12345678" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com"

POST https://sprout-app.thegoodapi.com/app/api/refund (or /app/api/donation/cancel for donations)

Reverses tree, plastic, or donation allocations when an order or loyalty redemption is cancelled. Donation cancellations mark the donation order CANCELLED and automatically reverse open-period Stripe metered billing usage.

ParameterTypeRequiredDescription
typestringYesUnit type to reverse (tree, plastic, or donation). Defaults to donation on /app/api/donation/cancel.
donation_id / id / uuid / order_idstringOptionalRecord UUID, donation ID, or order ID to reverse.
countintegerOptionalNumber of units to reverse (default: 1).
notesstringOptionalReason for reversal.
{
"status": "success",
"mode": "PROD",
"id": "refund_1732700000000000000",
"refund_id": "refund_1732700000000000000",
"refunded_type": "tree",
"count": 5,
"uuid": "1001",
"stripe_reversed": false,
"created_at": "2026-11-27T06:11:39Z"
}
Terminal window
curl -X POST "https://sprout-app.thegoodapi.com/app/api/refund" \
-H "Content-Type: application/json" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com" \
-d '{
"type": "tree",
"order_id": "1001",
"count": 5,
"notes": "Customer cancelled loyalty reward"
}'

GET https://sprout-app.thegoodapi.com/app/api/evidence

Retrieves planting evidence photos/videos, region metadata, and timeline events matching target impact dates or record IDs.

ParameterTypeRequiredDescription
tree_idstringOptionalTree record ID (tree_id, id, or tree).
impact_typestringOptionalImpact type (trees, default: trees).
created_atstringOptionalTarget impact date timestamp (YYYY-MM-DD or ISO timestamp).
project_public_idstringOptionalFilter by project public ID.
regionstringOptionalFilter by region name.
{
"tree_id": "test_tree_1001",
"record_id": "test_tree_1001",
"impact_type": "trees",
"impact_provider": "veritree",
"created_at": "2024-05-15T10:00:00Z",
"region": "Kenya",
"evidence_count": 5,
"timeline": [
{
"step": 1,
"event": "registered",
"status": "completed",
"date": "2024-05-15T10:00:00Z",
"timestamp": "2024-05-15T10:00:00Z"
},
{
"step": 2,
"event": "planted",
"status": "completed",
"date": "2024-05-15T14:30:00Z",
"timestamp": "2024-05-15T14:30:00Z"
}
]
}
Terminal window
curl -X GET "https://sprout-app.thegoodapi.com/app/api/evidence?tree_id=test_tree_1001" \
-H "api_key: PROD-8f92a1b3-4c56-7d89" \
-H "shop_name: my-store.myshopify.com"

Error CodeHTTP StatusDescriptionAction / Resolution
UNAUTHORIZED401 UnauthorizedMissing authentication headers.Pass valid api_key (or X-API-Key) and shop_name headers.
WRONG_KEY_TYPE401 UnauthorizedStandalone or platform key used on a Shopify API endpoint.Use a store PROD- or TEST- API key.
INVALID_KEY401 UnauthorizedInvalid API key or store domain.Verify shop_name and your API key in Shopify Admin → Advanced Settings → API Settings.
INSUFFICIENT_BUDGET402 Payment RequiredStore top-up budget or tree/plastic limit is exhausted.Top up balance in Shopify Admin → Sprout / GoodAPI → Billing.
BAD_REQUEST400 Bad RequestMalformed JSON payload or invalid request body.Validate JSON syntax and content type.
INVALID_PARAM / INVALID_PARAMETER400 Bad RequestMissing or invalid query/body parameter (e.g., malformed GID, invalid limit or cursor).Fix the parameter value indicated in message.
PAYLOAD_TOO_LARGE413 Payload Too LargeJSON request body exceeds the 256 KB maximum limit.Keep request payloads under 256 KB.
RATE_LIMIT_EXCEEDED429 Too Many RequestsRequest rate limit exceeded.Back off for the seconds specified in Retry-After and enable caching.
QUERY_ERROR500 Internal Server ErrorTransient server error while loading data.Retry with exponential backoff.