Demo All names and records here are made up, and the data resets every night. Please do not enter real personal information. ← Back to Find Care Scotland software · All software
Care Core

Documentation › API › API keys, scopes and authentication

API keys, scopes and authentication

Creating keys, what they may do, and keeping them safe.

API keys

An API key identifies one integration. Create them in Admin › Integrations › API keys (administrators only).

SettingMeaning
NameThe system that will use it, for example “Payroll sync”. It appears in the activity log as system:api:Payroll sync on everything the key does, so you can always tell who made a change.
ScopesWhat the key may do. Tick the least it needs.
Allowed addressesOptional. IP addresses or ranges (such as 203.0.113.5 or 198.51.100.0/24, IPv4 or IPv6), separated by commas. The key is refused from anywhere else. Empty means any address.
Expires onOptional. The key stops working at the end of that day.
Requests per minute10 to 6000. Default 120.

The key looks like cc_1a2b3c4d_ followed by 48 more characters. It is shown once, when you create it. Care Core keeps only a one-way hash, so a lost key cannot be recovered: revoke it and create another. The list shows the first part (cc_1a2b3c4d…), the scopes, when it was last used and when it expires.

Using a key

Send it as a bearer token on every request:

Authorization: Bearer cc_1a2b3c4d_0123456789abcdef0123456789abcdef0123456789abcdef
  • Always use HTTPS. The API refuses plain HTTP on a real host (403 https_required). Only localhost is allowed over HTTP, for development.
  • Keep keys on your server, in a secrets store or environment variable. Never put one in a web page, mobile app or code repository. The API sends no CORS headers, because it is for server-to-server use.
  • Give each system its own key, so you can revoke one without disturbing the others.

Scopes

Every endpoint names the scope it needs. A call without it gets 403 forbidden, with a message naming the missing scope.

ScopeAllows
people.readRead people (names, contact details, whether staff or supported).
people.writeCreate and edit people.
staff.readRead employments, employment terms, the non-sensitive staff profile and pending profile changes.
staff.writeStart, change and end employments (joiner, mover, leaver); edit terms and the staff profile.
staff.sensitiveRead and write National Insurance and bank details. Grant to as few keys as possible.
compliance.readRead registrations, supervisions, appraisals and learning, and what is due.
compliance.writeAdd and remove registrations, supervisions, appraisals and learning records.
teams.readRead teams and their members.
teams.writeCreate, edit and close teams; add and end team places.
care.readRead support episodes, care needs, contacts and key workers.
care.writeStart and end support; manage care needs, contacts and key workers.
recruitment.readRead job roles, vacancies, candidates and their checks.
recruitment.writeCreate roles and vacancies, add and move candidates, record offers and checks, and hire.
referrals.readRead referrals: who was referred, why, what they need and the decision.
referrals.writeRecord referrals, move them through assessment, decide them and link them to a person.
tasks.readRead tasks.
tasks.writeMark tasks done or skipped.
events.readRead the event feed.
webhooks.manageCreate, change and delete webhook endpoints and read their deliveries.
audit.readRead the activity log.
admin.readRead the logins list and the consistency checks.

Least privilege is built in

  • Without care.read, people who only receive support are invisible: they are not listed, a direct request for them returns 404, and is_supported is null. A payroll system never learns who receives care.
  • Without people.write, the free-text notes on a person are left out.
  • National Insurance and bank details are in the profile only for keys with staff.sensitive, and only such keys can change them. They are encrypted at rest, and never written to the activity log or to events.
  • Webhook secrets are returned once, when the endpoint is created.

Any valid key can call GET /ping and GET /scopes (which lists every scope and whether this key has it).

Rotating and revoking

  • Rotate: create a new key with the same scopes, switch the integration over, then revoke the old one. Both work in the meantime.
  • Revoke on the same page: the key stops working at once (401).
  • Set an expiry on keys for short-lived projects, and put a reminder in your calendar for the others.
  • A key that has not been used for a long time shows “never” or an old date under Last used: revoke it.

Authentication errors

StatusCodeCause
401unauthorizedNo Authorization header, a malformed or unknown key, or a revoked or expired key. The response carries WWW-Authenticate: Bearer.
403forbiddenThe key lacks the scope, or is used from an address it is not allowed from.
403https_requiredThe request was not sent over HTTPS.

Every use of a key by a system is attributed to it in the activity log. Creating and revoking keys is logged too (never the key itself).

Next: Conventions.