PactbasePactbase DocsDocs
APIReference

Record consent

Record a decision

POST
/api/v1/consent

Records one decision made in your own app or backend. Call it from your server, never from a browser or app that would hold the key. Consent purposes left out of decisions count as not given. Retrying the same decisions within a minute returns the first event with duplicate: true.

Requires an API key with the consent:write scope.

Authorization

ApiKey
headerAuthorizationBearer <token>

An API key, pb_live_ followed by 43 characters. X-API-Key: <key> is also accepted.

Request Body

application/json
  1. body
collection_point*string
Length1 <= length <= 60
email*string
decisions*
website?string
Lengthlength <= 253
ip_address?|
user_agent?string
Lengthlength <= 512

Response Body

OK

application/json
  1. response
curl -X POST "https://example.com/api/v1/consent" \  -H "Content-Type: application/json" \  -d '{    "collection_point": "string",    "email": "string",    "decisions": {      "property1": true,      "property2": true    }  }'
{  "consent_event_id": "5b0e9c1d-2a3f-4b4c-8d5e-6f7a8b9c0d1e",  "duplicate": false,  "collection_point": {    "id": "be88e61c-2b3c-4d5e-8f6a-7b8c9d0e1f2a",    "slug": "newsletter",    "name": "Newsletter signup"  },  "notice_version": "4",  "purposes": [    {      "id": "36ff83e5-1a2b-4c3d-9e4f-5a6b7c8d9e0f",      "name": "Newsletter",      "lawful_basis": "consent",      "status": "granted"    },    {      "id": "8a1c4d2e-5b6f-4a7b-8c9d-0e1f2a3b4c5d",      "name": "Order delivery",      "lawful_basis": "legitimate_use",      "status": "notice_shown"    }  ]}
POST
/api/v1/portal-sessions

Returns a one-use link (valid 10 minutes) that opens Manage my data without an emailed code, for a person your app has already signed in. Call it from your server each time the person taps; never store or log the link.

Requires an API key with the consent:write scope.

Authorization

ApiKey
headerAuthorizationBearer <token>

An API key, pb_live_ followed by 43 characters. X-API-Key: <key> is also accepted.

Request Body

application/json
  1. body
email*string

Response Body

OK

application/json
  1. response
curl -X POST "https://example.com/api/v1/portal-sessions" \  -H "Content-Type: application/json" \  -d '{    "email": "string"  }'
{  "url": "https://v1.pactbase.in/portal/acme/preferences#s=Xk2...",  "expires_at": "2026-10-20T10:40:00.000Z"}