Data API
Fetch an embed's configuration and data as JSON.
Every embed is backed by two public endpoints. The embed script uses them, and you can call them directly to build your own display of the same data. Staff can see both on the embed's Settings tab under Data API.
Authentication
Pass the embed's access token in the token query parameter. The token is in the embed
code (data-token), and staff can find it on the embed's Settings tab.
The token only allows what that one embed does: reading the data it shows and, for an embed with a form, submitting that form. It's meant to be public, like the embed code itself.
Endpoints
Embed config
GET https://churchkit.io/api/embed?token=<token>Returns the embed's configuration, including its type and style settings.
Embed data
GET https://churchkit.io/api/embed/data?token=<token>Returns the embed's data from Planning Center. Only public-facing fields are returned.
Responses
- Successful responses are JSON.
- Both endpoints allow cross-origin requests (CORS), so you can call them from browser code on your site.
- If the embed has Allowed origins set, browser requests from other sites are rejected. See Allowed origins.
Caching
Responses can be cached for up to 60 seconds, so a change in Planning Center can take about a minute to appear. You don't need to poll more often than that. Responses for embeds with Allowed origins set aren't shared between sites through that cache.
Rate limits
Requests to the embed data endpoint are rate limited, both for each token overall and
for each token from a single network. Visitors on the same network, such as a church's
Wi-Fi, share that network's limit. If you go over a limit, you get
429 Too Many Requests with a Retry-After header giving the number of seconds to
wait. Wait that long before trying again.
Errors
Errors return a JSON body with an error message. Several causes share a status code,
so read the message to tell them apart.
| Status | Meaning |
|---|---|
400 Bad Request | The token parameter is missing, the request is malformed, or the church's Planning Center account isn't connected. |
403 Forbidden | The request came from a site that isn't in the embed's Allowed origins, or the church's Planning Center connection doesn't have access to the app the embed uses. |
410 Gone | The token doesn't work: it was regenerated, the embed was deleted, or the church's plan no longer includes Embeds. |
429 Too Many Requests | Rate limited. Wait for the number of seconds in Retry-After. |
A 410 won't recover on its own. Ask your church for the embed's current code. If
their plan lapsed, the same code works again once Embeds is back on their plan.