Skip to main content
Developer docs menu

Developers

Quickstart

From a new key to your first list of policies. You need a terminal with curl, and an organisation admin to create the key.

1. Get an API key

An organisation admin opens Integrations in Quick Policy, chooses Create API Key, gives it a name and ticks read:policies (add read:incidents if you need incidents). The key is shown once, straight after it is created, so copy it then. More about keys and scopes

Keep it out of your code. In a terminal, put it in an environment variable:

export QP_API_KEY="qk_0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"

2. Check the key works

Any active key can read the organisation it belongs to, whatever its scopes, so this is a good first call.

Request
curl -s "https://www.quickpolicy.co.uk/api/organizations/current" \
  -H "Authorization: Bearer $QP_API_KEY"
Response (shortened)
{
  "success": true,
  "organization": {
    "id": "cm3org0001",
    "name": "Acme Health Ltd",
    "plan": {
      "name": "Professional"
    }
  }
}

A 401 with the code UNAUTHORIZED means the key is wrong, deleted or past its expiry date. Check you copied all of it, including the qk_ at the start.

3. List your published policies

Request
curl -s "https://www.quickpolicy.co.uk/api/policies?status=PUBLISHED" \
  -H "Authorization: Bearer $QP_API_KEY"
Response (shortened)
{
  "policies": [
    {
      "id": "cm3pol0001",
      "title": "Data Protection Policy",
      "category": "DATA_PROTECTION",
      "status": "PUBLISHED",
      "version": 3
    }
  ],
  "visibility": {
    "canReadDraftPolicies": true
  }
}

Take an id from the list and read that policy in full, text included:

Request
curl -s "https://www.quickpolicy.co.uk/api/policies/cm3pol0001" \
  -H "Authorization: Bearer $QP_API_KEY"

A 403 with the code INSUFFICIENT_SCOPE means the key does not have read:policies. Keys cannot be edited, so create a new one with the right scope.

4. Incidents (if your plan includes them)

Request
curl -s "https://www.quickpolicy.co.uk/api/incidents?severity=high&limit=20" \
  -H "Authorization: Bearer $QP_API_KEY"

Incidents need the read:incidents scope and a plan that includes incident management. The response is paged; see rate limits and paging.