Advanced API
Facts & Audit Trails
Record arbitrary data as verified facts and retrieve them for compliance or verification.
Facts let you record arbitrary data — documents, events, agreements — as immutable, verified entries. Once committed, a fact can be queried by its content hash and independently verified. Use facts to build audit trails, prove document integrity, and support compliance workflows.
Requires an API key in the X-Api-Key header:
-H "X-Api-Key: pk_live_PUBLIC.SECRET"
Base URL: https://balance-api.pacspace.io
Commit a Fact
Record a new fact in the verification layer.
curl -X POST https://balance-api.pacspace.io/api/v1/facts \
-H "X-Api-Key: pk_live_PUBLIC.SECRET" \
-H "Content-Type: application/json" \
-d '{
"content": "Contract signed by Alice and Bob on 2025-06-01",
"metadata": {
"type": "contract_signature",
"parties": ["alice@example.com", "bob@example.com"],
"documentId": "doc-789"
}
}'
Response 202 Accepted
{
"statusCode": 202,
"data": {
"contentHash": "sha256_a1b2c3d4e5f6...",
"status": "queued",
"message": "Fact accepted and queued for verification.",
"createdAt": "2025-06-01T12:00:00.000Z"
}
}
The
contentHashis a deterministic hash of the content you submitted. Use it to query and verify the fact later.
Query a Fact
Retrieve a previously recorded fact by its content hash.
curl https://balance-api.pacspace.io/api/v1/facts/sha256_a1b2c3d4e5f6 \
-H "X-Api-Key: pk_live_PUBLIC.SECRET"
Response 200 OK
{
"statusCode": 200,
"data": {
"contentHash": "sha256_a1b2c3d4e5f6...",
"content": "Contract signed by Alice and Bob on 2025-06-01",
"metadata": {
"type": "contract_signature",
"parties": ["alice@example.com", "bob@example.com"],
"documentId": "doc-789"
},
"verified": true,
"verifiedAt": "2025-06-01T12:00:15.000Z",
"createdAt": "2025-06-01T12:00:00.000Z"
}
}
Verify a Fact
Independently verify that a fact exists and has been confirmed in the verification layer.
curl https://balance-api.pacspace.io/api/v1/facts/sha256_a1b2c3d4e5f6/verify \
-H "X-Api-Key: pk_live_PUBLIC.SECRET"
Response 200 OK
{
"statusCode": 200,
"data": {
"contentHash": "sha256_a1b2c3d4e5f6...",
"verified": true,
"verifiedAt": "2025-06-01T12:00:15.000Z",
"verificationProof": {
"timestamp": "2025-06-01T12:00:15.000Z",
"batchId": "batch_xyz789"
}
}
}
If the fact has not yet been verified:
{
"statusCode": 200,
"data": {
"contentHash": "sha256_a1b2c3d4e5f6...",
"verified": false,
"status": "pending"
}
}
Request & Response Fields
Commit Request
| Field | Type | Required | Description |
|---|---|---|---|
content | string | Yes | The data to record (text, serialized JSON, etc.) |
metadata | object | No | Additional context stored alongside the fact |
Query / Verify Response
| Field | Type | Description |
|---|---|---|
contentHash | string | Deterministic hash of the recorded content |
content | string | Original content (only in query response) |
metadata | object | Associated metadata |
verified | boolean | Whether verification has completed |
verifiedAt | string | ISO 8601 timestamp of verification |
verificationProof | object | Proof details (only in verify response) |
Use Cases
Document Audit Trail
Record every version of a document as a fact:
const crypto = require('crypto');
async function recordDocumentVersion(document, version) {
const content = JSON.stringify({
documentId: document.id,
version: version,
hash: crypto.createHash('sha256').update(document.body).digest('hex'),
author: document.lastEditedBy,
timestamp: new Date().toISOString()
});
const response = await fetch('https://balance-api.pacspace.io/api/v1/facts', {
method: 'POST',
headers: {
'X-Api-Key': process.env.PACSPACE_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
content,
metadata: {
type: 'document_version',
documentId: document.id,
version
}
})
});
return response.json();
}
Compliance Verification
Later, verify that a recorded fact hasn't been altered:
async function verifyFact(contentHash) {
const response = await fetch(
`https://balance-api.pacspace.io/api/v1/facts/${contentHash}/verify`,
{
headers: { 'X-Api-Key': process.env.PACSPACE_API_KEY }
}
);
const result = await response.json();
return result.data.verified;
}
Error Responses
| Status | Meaning |
|---|---|
400 | Invalid request — check required fields |
401 | Invalid or missing API key |
402 | Insufficient credits |
404 | Fact not found for the given content hash |
429 | Rate limit exceeded |
500 | Server error — retry with exponential backoff |
See Error Handling for full details.
Endpoints Summary
| Endpoint | Method | Description |
|---|---|---|
/api/v1/facts | POST | Commit a new fact |
/api/v1/facts/:contentHash | GET | Query a fact by hash |
/api/v1/facts/:contentHash/verify | GET | Verify a fact's status |
Last updated February 11, 2026