Server-side encrypted PAN/CVV (PCI DSS Level 1)
curl --request POST \
--url https://sandbox.apocor.ai/v1/cards/{id}/payment-details \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"encryption": {
"public_key_pem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\n-----END PUBLIC KEY-----"
}
}
'import requests
url = "https://sandbox.apocor.ai/v1/cards/{id}/payment-details"
payload = { "encryption": { "public_key_pem": "-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...
-----END PUBLIC KEY-----" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
encryption: {
public_key_pem: '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\n-----END PUBLIC KEY-----'
}
})
};
fetch('https://sandbox.apocor.ai/v1/cards/{id}/payment-details', 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://sandbox.apocor.ai/v1/cards/{id}/payment-details",
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([
'encryption' => [
'public_key_pem' => '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...
-----END PUBLIC KEY-----'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://sandbox.apocor.ai/v1/cards/{id}/payment-details"
payload := strings.NewReader("{\n \"encryption\": {\n \"public_key_pem\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\\n-----END PUBLIC KEY-----\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox.apocor.ai/v1/cards/{id}/payment-details")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"encryption\": {\n \"public_key_pem\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\\n-----END PUBLIC KEY-----\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.apocor.ai/v1/cards/{id}/payment-details")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"encryption\": {\n \"public_key_pem\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\\n-----END PUBLIC KEY-----\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"algorithm": "RSA_OAEP_SHA256_AES_256_GCM",
"encryptedKey": "base64...",
"iv": "base64...",
"authTag": "base64...",
"ciphertext": "base64...",
"expiresIn": 120
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "Applicant must be approved"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Not found"
}
}Cards — view PAN/CVV (Method 1 & 2)
Server-side encrypted PAN/CVV (PCI DSS Level 1)
Method 2 — Server-side encrypted reveal. PCI DSS Level 1 organizations only (pciRevealEnabled must be true).
Hybrid encryption (RSA_OAEP_SHA256_AES_256_GCM):
- Generate an RSA-2048+ key pair; keep the private key in your HSM/KMS.
- Send the public key PEM in
encryption.public_key_pem. - Apocor returns an envelope — never plaintext PAN/CVV.
- Decrypt: RSA-OAEP (SHA-256) unwrap
encryptedKey→ AES-256-GCM decryptciphertextwithiv+authTag.
Decrypted JSON: { pan, cvv, expMonth, expYear, bin, lastFour, cardId }.
Full walkthrough + Node decrypt sample: https://docs.apocor.ai/guides/viewing-card-details
Without PCI Level 1, use Method 1: GET /v1/cards/{id}/secure-details + Apocor Widget.js.
POST
/
v1
/
cards
/
{id}
/
payment-details
Server-side encrypted PAN/CVV (PCI DSS Level 1)
curl --request POST \
--url https://sandbox.apocor.ai/v1/cards/{id}/payment-details \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"encryption": {
"public_key_pem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\n-----END PUBLIC KEY-----"
}
}
'import requests
url = "https://sandbox.apocor.ai/v1/cards/{id}/payment-details"
payload = { "encryption": { "public_key_pem": "-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...
-----END PUBLIC KEY-----" } }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
encryption: {
public_key_pem: '-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\n-----END PUBLIC KEY-----'
}
})
};
fetch('https://sandbox.apocor.ai/v1/cards/{id}/payment-details', 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://sandbox.apocor.ai/v1/cards/{id}/payment-details",
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([
'encryption' => [
'public_key_pem' => '-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...
-----END PUBLIC KEY-----'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://sandbox.apocor.ai/v1/cards/{id}/payment-details"
payload := strings.NewReader("{\n \"encryption\": {\n \"public_key_pem\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\\n-----END PUBLIC KEY-----\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox.apocor.ai/v1/cards/{id}/payment-details")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"encryption\": {\n \"public_key_pem\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\\n-----END PUBLIC KEY-----\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.apocor.ai/v1/cards/{id}/payment-details")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"encryption\": {\n \"public_key_pem\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...\\n-----END PUBLIC KEY-----\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"algorithm": "RSA_OAEP_SHA256_AES_256_GCM",
"encryptedKey": "base64...",
"iv": "base64...",
"authTag": "base64...",
"ciphertext": "base64...",
"expiresIn": 120
}
}{
"error": {
"code": "INVALID_REQUEST",
"message": "Applicant must be approved"
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Not found"
}
}Authorizations
Bearer access token obtained from POST /v1/oauth/token using your Apocor API key.
Path Parameters
Resource identifier.
Body
application/json
Show child attributes
Show child attributes
Response
Encrypted payment details envelope (RSA-OAEP + AES-256-GCM).
Show child attributes
Show child attributes