Skip to main content

Quickstart — Your First Verification in 5 Minutes

This guide will walk you through generating and verifying your first Optropic code. By the end, you'll understand the core API workflow.

Prerequisites

1. Get Your API Key

  1. Log in to Optropic Studio
  2. Navigate to Settings → API Keys
  3. Click Create API Key
  4. Copy the key — it starts with optr_live_ or optr_test_
Store Your Key Securely

Your API key is shown only once. Store it in a secure location like a password manager or environment variable.

2. Generate an Authenticated Code

Use the /code/generate endpoint to create a cryptographically signed GS1 Digital Link.

cURL

curl -X POST https://api.optropic.com/api/v1/code/generate \
-H "x-api-key: optr_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"gtin": "04260799580008",
"serialNumber": "DEMO-001",
"batchNumber": "BATCH-2026"
}'

JavaScript (fetch)

const response = await fetch('https://api.optropic.com/api/v1/code/generate', {
method: 'POST',
headers: {
'x-api-key': 'optr_live_YOUR_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
gtin: '04260799580008',
serialNumber: 'DEMO-001',
batchNumber: 'BATCH-2026',
}),
});

const data = await response.json();
console.log(data.url); // The GS1 Digital Link URL

Python

import requests

response = requests.post(
'https://api.optropic.com/api/v1/code/generate',
headers={
'x-api-key': 'optr_live_YOUR_KEY',
'Content-Type': 'application/json',
},
json={
'gtin': '04260799580008',
'serialNumber': 'DEMO-001',
'batchNumber': 'BATCH-2026',
}
)

data = response.json()
print(data['url']) # The GS1 Digital Link URL

Response

{
"url": "https://id.optropic.com/01/04260799580008/21/DEMO-001/10/BATCH-2026?sig=abc123...",
"gtin": "04260799580008",
"serial": "DEMO-001",
"batch": "BATCH-2026",
"signature": "abc123...",
"keyId": "key-001"
}

3. Verify the Code

Take the URL from step 2 and verify it using the /code/verify endpoint.

curl -X POST https://api.optropic.com/api/v1/code/verify \
-H "x-api-key: optr_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://id.optropic.com/01/04260799580008/21/DEMO-001/10/BATCH-2026?sig=abc123..."
}'

Response

{
"verdict": "AUTHENTIC",
"confidence": 0.95,
"gtin": "04260799580008",
"serial": "DEMO-001",
"batch": "BATCH-2026",
"checks": {
"signature": {
"passed": true,
"keyId": "key-001"
},
"format": {
"passed": true,
"standard": "GS1_DIGITAL_LINK"
}
},
"scanNumber": 1,
"firstSeen": "2026-02-18T10:30:00Z"
}

4. Understanding the Result

FieldDescription
verdictAUTHENTIC, COUNTERFEIT, or SUSPICIOUS
confidence0.0 to 1.0 — how confident the system is
checks.signature.passedWhether the Ed25519 signature is valid
scanNumberHow many times this code has been scanned

What's Next?

Rate Limits

TierGenerateVerify
Free100/day1,000/day
Starter1,000/day10,000/day
EnterpriseUnlimitedUnlimited

See Rate Limits for details.