Prerequisites
Before you begin, make sure you have:
- An Anchora VaaS API key (sign up at anchora.co.in/waitlist)
- Basic understanding of REST APIs
- cURL, JavaScript, or Python installed
Step-by-Step Guide
Get Your API Key
Sign up for an Anchora VaaS account and get your API key from the dashboard. Your API key looks like: dcp_live_xxxxxxxxxxxx
Create Your First Anchor
Use the /v1/anchor/encrypted endpoint to anchor your first piece of data. This encrypts your data and creates an immutable blockchain record.
curl -X POST https://api.anchora.io/v1/anchor/encrypted \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "data": { "name": "Alice Smith", "email": "alice@example.com", "certificateId": "CERT-2024-001" }, "encryptionKey": "your-32-character-encryption-key!!", "mutableFields": ["email"], "immutableFields": ["name", "certificateId"], "hashFields": ["email"] }'
Receive the Response
The API returns a record ID and hash. Save the record ID - you'll use it to retrieve and verify your data.
{
"success": true,
"recordId": "rec_abc123xyz789",
"hash": "0x7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa...",
"status": "QUEUED",
"encrypted": true,
"fieldInfo": {
"totalFields": 3,
"mutableFields": ["email"],
"immutableFields": ["name", "certificateId"],
"hashedFields": ["email"]
},
"timestamp": "2024-01-31T10:30:00Z",
"processingTime": "45ms"
}
Retrieve Your Record
Use the record ID to retrieve metadata about your anchored record.
curl -X GET https://api.anchora.io/v1/records/rec_abc123xyz789 \ -H "Authorization: Bearer YOUR_API_KEY"
Decrypt Your Data
Use your encryption key to decrypt and retrieve the original data.
curl -X POST https://api.anchora.io/v1/records/rec_abc123xyz789/decrypt \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"encryptionKey": "your-32-character-encryption-key!!"}'
Understanding Field Types
Mutable Fields
Fields that can be updated after creation. Perfect for data that changes over time (email, address, status). Updates are tracked with version history.
Immutable Fields
Fields that cannot be changed once anchored. Use for permanent data (SSN, certificate IDs, document hashes). The blockchain guarantees these never change.
Hash Fields
Fields indexed for privacy-preserving search. You can search by hash without exposing the actual data. Perfect for finding records by email or ID.