Grant decrypt access
curl --request POST \
--url https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access \
--header 'Content-Type: application/json' \
--data '
{
"userId": "usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f",
"keyId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}
'import requests
url = "https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access"
payload = {
"userId": "usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f",
"keyId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
userId: 'usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f',
keyId: 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d'
})
};
fetch('https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access",
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([
'userId' => 'usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f',
'keyId' => 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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 := "https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access"
payload := strings.NewReader("{\n \"userId\": \"usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f\",\n \"keyId\": \"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f\",\n \"keyId\": \"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f\",\n \"keyId\": \"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"tokenId": "tok_9a8b7c6d-5e4f-3a2b-1c0d-e9f8a7b6c5d4",
"userId": "usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f",
"keyId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"purpose": "decrypt",
"grantedAt": "2025-12-18T10:35:00Z",
"expiresAt": "2025-12-18T10:38:00Z",
"sourceIp": "192.168.1.100"
}
}{
"success": false,
"error": {
"code": "GRANT_ERROR",
"message": "Failed to grant access"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Receipt Decryption (Card Issuer)
Grant Decrypt Access
Issue a short-lived access token (2-3 minutes) for receipt decryption. The source IP is logged for audit purposes. Maximum 5 active tokens per user.
POST
/
api
/
v1
/
keys
/
grant-access
Grant decrypt access
curl --request POST \
--url https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access \
--header 'Content-Type: application/json' \
--data '
{
"userId": "usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f",
"keyId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}
'import requests
url = "https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access"
payload = {
"userId": "usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f",
"keyId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
userId: 'usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f',
keyId: 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d'
})
};
fetch('https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access",
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([
'userId' => 'usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f',
'keyId' => 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$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 := "https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access"
payload := strings.NewReader("{\n \"userId\": \"usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f\",\n \"keyId\": \"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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("https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access")
.header("Content-Type", "application/json")
.body("{\n \"userId\": \"usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f\",\n \"keyId\": \"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.digitalreceiptprotocol.org/api/v1/keys/grant-access")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"userId\": \"usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f\",\n \"keyId\": \"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"tokenId": "tok_9a8b7c6d-5e4f-3a2b-1c0d-e9f8a7b6c5d4",
"userId": "usr_f8e7d6c5-b4a3-4c2d-1e0f-9a8b7c6d5e4f",
"keyId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"purpose": "decrypt",
"grantedAt": "2025-12-18T10:35:00Z",
"expiresAt": "2025-12-18T10:38:00Z",
"sourceIp": "192.168.1.100"
}
}{
"success": false,
"error": {
"code": "GRANT_ERROR",
"message": "Failed to grant access"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Body
application/json
⌘I