Quick Start
Make your first API call in under 5 minutes.
Prerequisites
- A GoValid account (Sign up free)
- An API key or user credentials
curlor any HTTP client
Step 1: Get Your API Key
- Log in to my.govalid.org
- Go to Account → API Keys
- Click Create New Key
- Copy your key
Step 2: Test the Connection
Verify your API key works:
curl https://api.govalid.org/api/v1/health/ \
-H "Authorization: Bearer YOUR_API_KEY"
Expected response:
{
"status": "healthy",
"version": "1.1.0"
}
Step 3: Create Your First QR Code
curl -X POST https://api.govalid.org/api/v1/qr/ \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "My First QR Code",
"qr_type": "url",
"content": "https://example.com"
}'
Response:
{
"id": "abc123",
"title": "My First QR Code",
"qr_type": "url",
"content": "https://example.com",
"qr_image": "https://api.govalid.org/media/qr/abc123.png",
"short_url": "https://govalid.org/q/abc123",
"created_at": "2025-01-29T12:00:00Z"
}
Step 4: Retrieve Your QR Codes
curl https://api.govalid.org/api/v1/qr/ \
-H "Authorization: Bearer YOUR_API_KEY"
Response:
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": "abc123",
"title": "My First QR Code",
"qr_type": "url",
"scan_count": 0,
"created_at": "2025-01-29T12:00:00Z"
}
]
}
Common QR Types
| Type | Description | Example Content |
|---|---|---|
url | Website link | https://example.com |
text | Plain text | Hello World |
email | Email address | [email protected] |
phone | Phone number | +1234567890 |
vcard | Contact card | JSON with contact details |
document | Document verification | Document metadata |
Code Examples
Python
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.govalid.org/api/v1"
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
# Create a QR code
response = requests.post(
f"{BASE_URL}/qr/",
headers=headers,
json={
"title": "My QR Code",
"qr_type": "url",
"content": "https://example.com"
}
)
print(response.json())
JavaScript (Node.js)
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.govalid.org/api/v1';
const headers = {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
};
// Create a QR code
axios.post(`${BASE_URL}/qr/`, {
title: 'My QR Code',
qr_type: 'url',
content: 'https://example.com'
}, { headers })
.then(response => console.log(response.data))
.catch(error => console.error(error));
PHP
<?php
$apiKey = 'YOUR_API_KEY';
$baseUrl = 'https://api.govalid.org/api/v1';
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "$baseUrl/qr/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer $apiKey",
"Content-Type: application/json"
],
CURLOPT_POSTFIELDS => json_encode([
'title' => 'My QR Code',
'qr_type' => 'url',
'content' => 'https://example.com'
])
]);
$response = curl_exec($ch);
curl_close($ch);
print_r(json_decode($response, true));
Next Steps
- API Reference - Full endpoint documentation
- Code Examples - More use cases
- Authentication - Advanced auth options