Skip to main content
POST
/
v1
/
consent
/
email
/
{email}
/
{brief}
Create consent by email
curl --request POST \
  --url http://localhost:3000/v1/consent/email/{email}/{brief} \
  --header 'Content-Type: application/json' \
  --header 'X-Bunker-Token: <api-key>' \
  --data '
{
  "status": "accept",
  "message": "<string>",
  "who": "<string>",
  "starttime": "<string>",
  "endtime": "<string>",
  "lawfulbasis": "consent",
  "module": "api",
  "referencecode": "<string>",
  "lastmodifiedby": "<string>"
}
'
import requests

url = "http://localhost:3000/v1/consent/email/{email}/{brief}"

payload = {
"status": "accept",
"message": "<string>",
"who": "<string>",
"starttime": "<string>",
"endtime": "<string>",
"lawfulbasis": "consent",
"module": "api",
"referencecode": "<string>",
"lastmodifiedby": "<string>"
}
headers = {
"X-Bunker-Token": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-Bunker-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
status: 'accept',
message: '<string>',
who: '<string>',
starttime: '<string>',
endtime: '<string>',
lawfulbasis: 'consent',
module: 'api',
referencecode: '<string>',
lastmodifiedby: '<string>'
})
};

fetch('http://localhost:3000/v1/consent/email/{email}/{brief}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/v1/consent/email/{email}/{brief}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'accept',
'message' => '<string>',
'who' => '<string>',
'starttime' => '<string>',
'endtime' => '<string>',
'lawfulbasis' => 'consent',
'module' => 'api',
'referencecode' => '<string>',
'lastmodifiedby' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Bunker-Token: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "http://localhost:3000/v1/consent/email/{email}/{brief}"

payload := strings.NewReader("{\n \"status\": \"accept\",\n \"message\": \"<string>\",\n \"who\": \"<string>\",\n \"starttime\": \"<string>\",\n \"endtime\": \"<string>\",\n \"lawfulbasis\": \"consent\",\n \"module\": \"api\",\n \"referencecode\": \"<string>\",\n \"lastmodifiedby\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-Bunker-Token", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("http://localhost:3000/v1/consent/email/{email}/{brief}")
.header("X-Bunker-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"accept\",\n \"message\": \"<string>\",\n \"who\": \"<string>\",\n \"starttime\": \"<string>\",\n \"endtime\": \"<string>\",\n \"lawfulbasis\": \"consent\",\n \"module\": \"api\",\n \"referencecode\": \"<string>\",\n \"lastmodifiedby\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("http://localhost:3000/v1/consent/email/{email}/{brief}")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Post.new(url)
request["X-Bunker-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"accept\",\n \"message\": \"<string>\",\n \"who\": \"<string>\",\n \"starttime\": \"<string>\",\n \"endtime\": \"<string>\",\n \"lawfulbasis\": \"consent\",\n \"module\": \"api\",\n \"referencecode\": \"<string>\",\n \"lastmodifiedby\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "ok"
}
{
"status": "error",
"message": "user with this email already exists"
}
{
"status": "error",
"message": "missing X-Bunker-Token header"
}
{
"status": "error",
"message": "user not found"
}

Authorizations

X-Bunker-Token
string
header
required

Root access token for Databunker API

Path Parameters

email
string<email>
required

User email address

brief
string
required

Consent brief (unique identifier, max 64 chars)

Maximum string length: 64
Pattern: ^[a-z0-9-]+$

Body

status
enum<string>
default:accept

Consent status

Available options:
accept,
cancel
message
string

Text message describing consent

who
string

Free text for internal usage

starttime
string

Date & time to automatically enable consent (Unix time or duration like '10d')

endtime
string

Consent expiration date (Unix time or duration like '1m')

lawfulbasis
enum<string>
default:consent

Legal basis for processing

Available options:
consent,
contract-agreement,
legal-obligations
module
string
default:api

Module type (e.g., phone-consent, contract, app-consent, web-consent, email-consent)

referencecode
string

Internal document or contract ID

lastmodifiedby
string

Name of person who last modified this record

Response

Consent created successfully

status
enum<string>
required
Available options:
ok
Example:

"ok"