Developer documentation · API v1

DaGiftFoundation API

Read granted business plans and goals, then make scoped goal updates after a workspace owner approves access.

Download OpenAPI JSON

Quick start

Use a sandbox credential first. The base URL for this site is:

https://<this-host>/api/v1
  1. 1. Register
    Create or sign in to your DaGiftFoundation account.
  2. 2. Create an integration
    Choose the scopes and generate a sandbox key in the portal.
  3. 3. Call the API
    Replace the placeholders with your key and returned sample plan id.

Runnable cURL · sample shape only

API_BASE="https://<this-host>/api/v1"
curl -sS "$API_BASE/business-plans" \
  -H "Authorization: Bearer YOUR_SANDBOX_KEY" \
  -H "Accept: application/json"

Create a goal · sample request

curl -i -X POST "$API_BASE/business-plans/PLAN_ID/goals" \
  -H "Authorization: Bearer YOUR_SANDBOX_KEY" \
  -H "Origin: https://<this-host>" \
  -H "Content-Type: application/json" \
  -d '{"title":"Review the sample launch plan","priority":"medium"}'

Update a goal · sample request

curl -i -X PATCH "$API_BASE/goals/GOAL_ID" \
  -H "Authorization: Bearer YOUR_SANDBOX_KEY" \
  -H "Origin: https://<this-host>" \
  -H "Content-Type: application/json" \
  -d '{"completed":true}'

The POST example includes an Origin header because the platform CSRF guard requires the exact DaGiftFoundation app origin on every mutation. Requests without it or with a third-party Origin receive 403. Use the sandbox key to keep writes isolated.

Authentication

Send the integration credential as an HTTP Bearer token. Sandbox keys begin with dg_sbx_. production keys begin with dg_live_. The full secret is shown once when created or rotated; only a one-way hash is stored.

  • Sandbox keys access only synthetic sandbox plans and goals, never production workspace records.
  • Production keys require a published integration and an active workspace grant for each plan and scope.
  • Credential validity alone does not grant customer data access. Revoking either the key or the workspace grant blocks later requests.
Server-client mutation requirement. GET requests need the Bearer token only. The goal POST and PATCH endpoints also require an Origin header whose value exactly matches this app’s public origin. Missing or different origins receive HTTP 403 before credential validation. A server client that cannot send that header can use the read endpoints but cannot create or update goals. The Origin header is not authentication; the Bearer credential and workspace grant are still required.

Permission scopes

Supported API scopes and permissions
ScopeAllows
business-plans:readList only plans covered by an active workspace grant.
goals:readRead goals on a granted plan.
goals:writeCreate or update goals on a granted plan. Mutations also require an accepted Origin header.

A workspace owner reviews the developer name, purpose, compatibility, and requested scopes before selecting a plan and approving only the scopes they choose. Callers cannot widen access by supplying another plan id.

Endpoints

All paths below are relative to the displayed /api/v1 base URL. Collection endpoints accept limit (default 50, maximum 100) and cursor (the returned nextCursor) query parameters.

GET/Public

Returns the current version, supported versions, compatibility guidance, and changelog URL.

GET/business-plansbusiness-plans:read

Returns plans with active grants for this integration.

GET/business-plans/{businessPlanId}/goalsgoals:read

Returns the goals for one plan covered by an active grant.

POST/business-plans/{businessPlanId}/goalsgoals:write

Creates a goal with title, optional description, targetDate (YYYY-MM-DD or null), and priority (high, medium, low, or null). Requires the app Origin header.

PATCH/goals/{goalId}goals:write

Updates one or more of title, description, targetDate, priority, or completed. Requires the app Origin header and a grant for the goal’s parent plan.

List response example · values are illustrative only

{
  "environment": "SANDBOX",
  "items": [{
    "id": "<plan_id>",
    "title": "Sample business plan",
    "summary": "Synthetic sandbox workspace for API quick-start requests.",
    "executiveSummary": "This record is isolated test data and is not a customer workspace.",
    "targetCustomer": "Sample local service business",
    "customerProblem": "The example team needs a clear plan for its next launch milestone.",
    "solution": "Use goals and next actions to organize the launch work.",
    "revenueModel": "Sample subscription revenue model.",
    "nextMilestone": "Complete the sample launch checklist.",
    "updatedAt": "<ISO-8601 timestamp>"
  }],
  "limit": 50,
  "hasMore": false,
  "nextCursor": null
}

Create-goal response example · values are illustrative only

{
  "environment": "SANDBOX",
  "item": {
    "id": "<goal_id>",
    "businessPlanId": "<plan_id>",
    "title": "Review the sample launch plan",
    "description": "",
    "targetDate": null,
    "priority": "medium",
    "completed": false,
    "createdAt": "<ISO-8601 timestamp>",
    "updatedAt": "<ISO-8601 timestamp>"
  }
}

Errors and rate limits

HTTP 400

Invalid JSON, query parameters, or fields.

HTTP 401

Missing, invalid, or revoked Bearer credential.

HTTP 403

No active workspace grant is available, the integration did not request a scope, production listing is unpublished, or the mutation Origin is blocked.

HTTP 404

Resource is missing or not available under an active grant.

HTTP 429

This credential exceeded its current request window.

HTTP 500

Unexpected request failure. Include the request id when asking for help.

Error body example

{
  "error": { "code": "invalid_request", "message": "Goal fields are invalid." },
  "requestId": "<request_id>"
}

Each credential is limited to 60 requests per 60-second fixed window. Successful and failed calls with a recognized active credential are counted; unauthenticated attempts are not charged to a credential. Credential-validated responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and X-Request-Id. A 401 or an Origin rejection still includes a request id; a 429 also includes Retry-After seconds.

Versions and change guidance

Only v1 is currently supported. Within v1, optional fields and new endpoints are compatible additions; existing fields keep their meaning. A breaking change requires a new major version. Deprecations and migration guidance will be published in the changelog before removal. No v1 end-of-life date is set.

The supported-version response at GET /api/v1 is the live contract. Review the changelog before upgrading.