Developer API

Plug Consenta into
any application

A small, stateless REST API for de-identifying data at the edge. Anonymise records, tokenise identifiers and measure re-identification risk from your own systems — without sending Consenta anything it keeps. Authenticate with a single API key and you are integrated.

Nothing identifiable is stored

Every endpoint is a stateless transformation. Consenta processes only the records in your request and never reads or writes its own patient, consent or dataset records. No field values or identifiers are persisted — only aggregate call counts and signed provenance metadata for audit. Data is stored only if you explicitly submit an anonymised dataset for marketplace listing.

Deterministic by design

Pseudonyms are HMAC-based and stable: the same value always yields the same token for your organisation, and never across organisations. De-identification is reproducible, so results can be joined and re-run reliably.

Privacy guarantees you can measure

k-anonymity is enforced by suppressing equivalence classes smaller than k, and l-diversity is reported per sensitive column — so you can prove disclosure risk was controlled, not just asserted.

Authentication

Every request is authenticated with an organisation API key. Organisation administrators create and revoke keys from the Organisation Portal under API Keys. Send the key as a bearer token (or the x-api-key header). The full key is shown only once at creation — store it securely.

Authorization: Bearer ck_live_xxxxxxxxxxxxxxxxxxxxxxxx

Endpoints

POST/api/v1/anonymise

Anonymise a batch

Suppress direct identifiers, apply stable pseudonyms, generalise quasi-identifiers and enforce k-anonymity. Returns de-identified rows plus a disclosure-risk report.

POST/api/v1/schema/detect

Detect a treatment plan

Dry run. Send a sample of records and get back the rules Consenta would apply — without any data being transformed or returned. Review, tune, then pass the plan to /anonymise.

POST/api/v1/assess

Assess re-identification risk

Return only the disclosure-risk report — k-anonymity status, quasi-identifiers, l-diversity and suppression count. No transformed data comes back.

POST/api/v1/pseudonymise

Tokenise identifiers

Map identifier values to stable, non-reversible tokens. Tokens match those emitted by /anonymise, so you can tokenise on your side and still join against anonymised datasets.

POST/api/v1/datasets/submit

List on the Consenta marketplace

Send anonymised records back with their signed provenance object to queue the dataset for Consenta review and marketplace listing. Under the Consenta Data Licence, Consenta-processed data may only be sold through Consenta.

POST/api/v1/provenance/verify

Verify dataset provenance

Public, no key needed. Confirms a provenance record was issued by Consenta and, if records are supplied, that they are exactly the output it was issued for.

GET/api/v1/health

Health & credential check

Confirm the API is up and verify your key echoes the correct organisation before sending real data.

GET/api/v1/openapi.json

OpenAPI specification

Machine-readable OpenAPI 3.0 spec. Import into Postman or generate a typed SDK in any language. No key required to read it.

Example request

Anonymise a batch of records. When you omit an explicit schema, Consenta auto-detects a treatment plan from the field names and values. Identifiers are suppressed or tokenised, quasi-identifiers are generalised, and rows that would breach k-anonymity are suppressed.

Request
curl -X POST "$CONSENTA_BASE_URL/api/v1/anonymise" \
  -H "Authorization: Bearer ck_live_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "records": [
      { "patientId": "P-1001", "name": "Jane Doe", "dob": "1984-06-12", "postcode": "M13 9PL", "diagnosis": "asthma" },
      { "patientId": "P-1002", "name": "John Roe", "dob": "1979-02-03", "postcode": "M14 5TP", "diagnosis": "asthma" }
    ],
    "k": 3
  }'
Response
{
  "records": [
    { "patientId": "subj-9f3a1c72b0d4", "dob": "20–24", "postcode": "M13", "diagnosis": "asthma" }
  ],
  "report": {
    "inputRecords": 2,
    "outputRecords": 0,
    "suppressedRecords": 2,
    "k": 3,
    "kAnonymitySatisfied": true,
    "quasiIdentifiers": ["dob", "postcode"],
    "lDiversity": [{ "field": "diagnosis", "minDistinctValues": 1 }],
    "autoDetected": true
  },
  "apiVersion": "v1"
}

Limits & conventions

Rate limit

60 requests per minute per API key. Exceeding it returns HTTP 429 with a retryAfter hint.

Batch size

Up to 50,000 records and 8 MB per request. Split larger datasets into batches.

Errors

Standard HTTP codes: 400 invalid body, 401 missing/invalid key, 403 missing scope, 413 too large, 429 rate limited.

Versioning

All endpoints are namespaced under /api/v1. Responses include an apiVersion field.

Ready to integrate?

Organisation administrators can generate an API key from the Organisation Portal today. If you represent a partner application and would like access, get in touch and we will help you plan the integration.