Create a consent receipt
curl --request POST \
--url https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/consent-receipts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"customer_id": "<string>",
"purposes": [],
"terms_version": "<string>",
"privacy_policy_version": "<string>",
"connection_session_id": "<string>",
"evidence": {
"ip_address": "<string>",
"user_agent": "<string>",
"locale": "<string>",
"collected_at": "2023-11-07T05:31:56Z"
}
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer_id: '<string>',
purposes: [],
terms_version: '<string>',
privacy_policy_version: '<string>',
connection_session_id: '<string>',
evidence: {
ip_address: '<string>',
user_agent: '<string>',
locale: '<string>',
collected_at: '2023-11-07T05:31:56Z'
}
})
};
fetch('https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/consent-receipts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/consent-receipts"
payload = {
"customer_id": "<string>",
"purposes": [],
"terms_version": "<string>",
"privacy_policy_version": "<string>",
"connection_session_id": "<string>",
"evidence": {
"ip_address": "<string>",
"user_agent": "<string>",
"locale": "<string>",
"collected_at": "2023-11-07T05:31:56Z"
}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"app_id": "<string>",
"customer_id": "<string>",
"purposes": [
{
"purpose": "account_linking",
"status": "granted",
"granted_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"terms_version": "<string>",
"privacy_policy_version": "<string>",
"status": "active",
"granted_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}Consent
Create a consent receipt
Record purpose grants after the user accepts.
POST
/
v1
/
consent-receipts
Create a consent receipt
curl --request POST \
--url https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/consent-receipts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"customer_id": "<string>",
"purposes": [],
"terms_version": "<string>",
"privacy_policy_version": "<string>",
"connection_session_id": "<string>",
"evidence": {
"ip_address": "<string>",
"user_agent": "<string>",
"locale": "<string>",
"collected_at": "2023-11-07T05:31:56Z"
}
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
customer_id: '<string>',
purposes: [],
terms_version: '<string>',
privacy_policy_version: '<string>',
connection_session_id: '<string>',
evidence: {
ip_address: '<string>',
user_agent: '<string>',
locale: '<string>',
collected_at: '2023-11-07T05:31:56Z'
}
})
};
fetch('https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/consent-receipts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://swapnice-gateway-dev.ceo-cbc.workers.dev/v1/consent-receipts"
payload = {
"customer_id": "<string>",
"purposes": [],
"terms_version": "<string>",
"privacy_policy_version": "<string>",
"connection_session_id": "<string>",
"evidence": {
"ip_address": "<string>",
"user_agent": "<string>",
"locale": "<string>",
"collected_at": "2023-11-07T05:31:56Z"
}
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"app_id": "<string>",
"customer_id": "<string>",
"purposes": [
{
"purpose": "account_linking",
"status": "granted",
"granted_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
}
],
"terms_version": "<string>",
"privacy_policy_version": "<string>",
"status": "active",
"granted_at": "2023-11-07T05:31:56Z",
"revoked_at": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "consent_denied",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"code": "<string>",
"message": "<string>",
"field": "<string>"
}
]
}
}Record purpose grants after the user accepts.
Events for a purpose are rejected until this exists. Include
terms_version and privacy_policy_version.Authorizations
Headers
Body
application/json
Response
Consent receipt created.