Skip to main content

What is the Public API?

The Public API lets you trigger Granite automations from anywhere:
  • Webhooks from other services
  • Cron jobs and schedulers
  • CI/CD pipelines
  • Custom applications
  • Integrations

How It Works

Quick Example

curl -X POST "https://api.getgranite.ai/api/your-org/generate-report" \
  -H "X-Granite-API-Key: gk_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{"month": "January", "year": 2024}'

Key Concepts

URL Structure

https://api.getgranite.ai/api/{org-slug}/{endpoint-slug}
PartExampleDescription
org-slugacme-corpYour organization’s slug
endpoint-sluggenerate-reportThe endpoint you created

Authentication

All API requests require an API key:
-H "X-Granite-API-Key: gk_live_abc123..."
Keep API keys secret. Never expose them in client-side code.

Response Modes

Default behavior - returns immediately with a run ID:
{
  "runId": "run_abc123",
  "status": "queued"
}
Poll for status later.

Common Use Cases

Use CaseExample
Scheduled reportsCron triggers daily report generation
Webhook handlingProcess incoming data from another service
CI/CD integrationRun tests or deployments
Form processingHandle submitted data
Data syncKeep systems in sync

Rate Limits

PlanLimit
Free100 requests/hour
Pro1,000 requests/hour
EnterpriseCustom

Security Best Practices

All Granite API endpoints use HTTPS. Never downgrade.
Create new keys and deprecate old ones every 90 days.
If one is compromised, only that integration is affected.
Check Analytics for unexpected patterns.

Next Steps