Visão Geral
A API GreenGate permite validar áreas rurais brasileiras contra 6 camadas oficiais de dados ambientais, gerando relatórios PDF auditáveis em menos de 2 minutos.
Base URL
https://api.greengate.com.br/api/v1
Características
- ✅ 6 Camadas Oficiais: PRODES, FUNAI, ICMBio, IBAMA, INCRA, Amazônia Legal
- ✅ Validação Rápida: Resultados em menos de 2 minutos
- ✅ Relatórios PDF: Documentos auditáveis com QR Code
- ✅ Score de Risco: Algoritmo proprietário 0-100
- ✅ RESTful: Arquitetura padrão HTTP
💡 Nota: Esta API está em produção e é utilizada por empresas para conformidade EUDR e triagem ambiental.
Autenticação
A API utiliza autenticação via API Key enviada no header de cada requisição.
Obtendo sua API Key
Entre em contato via greengatebrasil@gmail.com para solicitar acesso.
Como usar
Inclua o header x-api-key em todas as requisições:
curl -H "x-api-key: SUA_API_KEY_AQUI" \
https://api.greengate.com.br/api/v1/validations
⚠️ Segurança: Nunca exponha sua API key em código público (frontend, repositórios Git, etc). Use variáveis de ambiente.
Endpoints Principais
POST /validations
Cria uma nova validação geoespacial a partir de um polígono GeoJSON.
Headers
| Parâmetro | Tipo | Descrição |
|---|---|---|
| x-api-key obrigatório | string | Sua chave de autenticação |
| Content-Type | string | application/json |
Body (JSON)
| Campo | Tipo | Descrição |
|---|---|---|
| geometry obrigatório | GeoJSON | Polígono no formato GeoJSON (type: Polygon ou MultiPolygon) |
| property_name opcional | string | ⚠️ Use anonymous identifiers only (e.g., "Farm #12345", "Property A"). Treated as potentially sensitive - will be redacted ([REDACTED]) in public verification. DO NOT use real property names. |
| metadata opcional | object | ⚠️ Internal reference IDs only (CAR code, farm ID). DO NOT include personal data (CPF, names, addresses) |
Exemplo de Requisição
{
"geometry": {
"type": "Polygon",
"coordinates": [[
[-54.123, -12.456],
[-54.123, -12.467],
[-54.134, -12.467],
[-54.134, -12.456],
[-54.123, -12.456]
]]
},
"property_name": "Farm #12345",
"metadata": {
"car": "MT-1234567890123456789012345678901234",
"internal_id": "farm-abc-123"
}
}
Resposta (201 Created)
{
"validation_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"created_at": "2025-12-25T10:30:00Z",
"estimated_completion": "2025-12-25T10:32:00Z"
}
GET /validations/{validation_id}
Retorna o status e resultado de uma validação.
Parâmetros de URL
| Parâmetro | Tipo | Descrição |
|---|---|---|
| validation_id | UUID | ID da validação retornado no POST |
Resposta (200 OK)
{
"validation_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "completed",
"score": 87,
"risk_level": "low",
"area_ha": 1234.56,
"results": {
"prodes": { "overlap": false, "area_ha": 0 },
"indigenous_lands": { "overlap": true, "area_ha": 45.2, "names": ["TI Xingu"] },
"conservation_units": { "overlap": false, "area_ha": 0 },
"ibama_embargoes": { "overlap": false, "count": 0 },
"quilombola": { "overlap": false, "area_ha": 0 },
"legal_amazon": { "inside": true }
},
"pdf_url": "https://api.greengate.com.br/reports/550e8400.pdf",
"qr_code_url": "https://api.greengate.com.br/reports/verify/GG-a7f3k9m2p5q8",
"completed_at": "2025-12-25T10:31:45Z"
}
GET /reports/verify/{report_code}
Verificação pública de autenticidade de relatórios via QR Code.
📌 Nota: Este endpoint é público (não requer API key) e pode ser acessado por qualquer pessoa com o código do relatório.
🔐 Security & Privacy:
- Report codes: Cryptographically secure random format (high entropy) to prevent enumeration attacks
- Property names: Automatically redacted to
[REDACTED]in public verification - treated as potentially sensitive data - Two-level verification: Public endpoint shows minimal info (valid/invalid, score, date). Full details require API key authentication
- Rate limiting: Aggressive limits on public endpoint to prevent abuse
Parâmetros de URL
| Parâmetro | Tipo | Descrição |
|---|---|---|
| report_code | string | Código do relatório (formato: GG-{random} - cryptographically secure) |
Resposta (200 OK)
{
"verified": true,
"report_code": "GG-a7f3k9m2p5q8",
"property_name": "[REDACTED]",
"validation_date": "2025-12-25T10:31:45Z",
"score": 87,
"risk_level": "low",
"pdf_url": "https://api.greengate.com.br/reports/550e8400.pdf"
}
Exemplos de Código
Python (requests)
import requests
import json
API_KEY = "sua_api_key_aqui"
BASE_URL = "https://api.greengate.com.br/api/v1"
headers = {
"x-api-key": API_KEY,
"Content-Type": "application/json"
}
# Criar validação
payload = {
"geometry": {
"type": "Polygon",
"coordinates": [[
[-54.123, -12.456],
[-54.123, -12.467],
[-54.134, -12.467],
[-54.134, -12.456],
[-54.123, -12.456]
]]
},
"property_name": "Farm #12345"
}
response = requests.post(
f"{BASE_URL}/validations",
headers=headers,
json=payload
)
validation = response.json()
validation_id = validation["validation_id"]
# Consultar resultado
result = requests.get(
f"{BASE_URL}/validations/{validation_id}",
headers=headers
).json()
print(f"Score: {result['score']}")
print(f"PDF: {result['pdf_url']}")
JavaScript (fetch)
const API_KEY = 'sua_api_key_aqui';
const BASE_URL = 'https://api.greengate.com.br/api/v1';
// Criar validação
const response = await fetch(`${BASE_URL}/validations`, {
method: 'POST',
headers: {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
geometry: {
type: 'Polygon',
coordinates: [[
[-54.123, -12.456],
[-54.123, -12.467],
[-54.134, -12.467],
[-54.134, -12.456],
[-54.123, -12.456]
]]
},
property_name: 'Farm #12345'
})
});
const validation = await response.json();
const validationId = validation.validation_id;
// Aguardar processamento (2 minutos)
await new Promise(r => setTimeout(r, 120000));
// Consultar resultado
const result = await fetch(
`${BASE_URL}/validations/${validationId}`,
{ headers: { 'x-api-key': API_KEY } }
).json();
console.log(`Score: ${result.score}`);
console.log(`PDF: ${result.pdf_url}`);
cURL
#!/bin/bash
API_KEY="sua_api_key_aqui"
BASE_URL="https://api.greengate.com.br/api/v1"
# Criar validação
RESPONSE=$(curl -s -X POST "$BASE_URL/validations" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"geometry": {
"type": "Polygon",
"coordinates": [[
[-54.123, -12.456],
[-54.123, -12.467],
[-54.134, -12.467],
[-54.134, -12.456],
[-54.123, -12.456]
]]
},
"property_name": "Farm #12345"
}')
VALIDATION_ID=$(echo $RESPONSE | jq -r '.validation_id')
# Aguardar processamento
sleep 120
# Consultar resultado
curl -s "$BASE_URL/validations/$VALIDATION_ID" \
-H "x-api-key: $API_KEY" | jq '.'
Códigos de Erro
| Código HTTP | Erro | Descrição |
|---|---|---|
| 400 | Bad Request | Geometria inválida ou parâmetros incorretos |
| 401 | Unauthorized | API key inválida ou ausente |
| 404 | Not Found | Validação não encontrada |
| 429 | Too Many Requests | Rate limit excedido (máx 100 req/min) |
| 500 | Internal Server Error | Erro interno do servidor |
Formato de Resposta de Erro
{
"error": {
"code": "INVALID_GEOMETRY",
"message": "O polígono fornecido não é válido",
"details": "Self-intersection detected at coordinates [-54.123, -12.456]"
}
}
Rate Limits
📊 Limites:
- 100 requisições por minuto por API key
- 1000 validações por dia
- Headers de resposta incluem: X-RateLimit-Remaining
Suporte
Precisa de ajuda? Entre em contato:
- 📧 Email: greengatebrasil@gmail.com
- 🌐 Site: www.greengate.com.br