Authentication
Every GhostFlow API request requires two things:
- Authentication — an API key (
gf_...) in theAuthorizationheader - Team context — your Team ID in the
X-Team-Idheader
curl https://devcore.getghostflow.io/api/v1/campaigns \ -H "Authorization: Bearer gf_your_api_key_here" \ -H "X-Team-Id: your-team-uuid-here"Why X-Team-Id?
Section titled “Why X-Team-Id?”GhostFlow is a multi-tenant platform — one user can belong to multiple teams (organizations). The X-Team-Id header tells the API which team’s data to access. The dashboard handles this automatically when you switch teams in the sidebar (team selector), but when calling the API directly you must include it.
API Keys
Section titled “API Keys”GhostFlow uses API keys prefixed with gf_ for programmatic access. Keys are passed via the Authorization header using the Bearer scheme:
Authorization: Bearer gf_abc123def456...Creating API Keys
Section titled “Creating API Keys”Generate keys from the Settings → API Keys page in your dashboard, or programmatically:
curl -X POST https://devcore.getghostflow.io/api/v1/auth/api-keys \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "X-Team-Id: YOUR_TEAM_ID" \ -H "Content-Type: application/json" \ -d '{ "name": "Production Key", "permissions": ["read:campaigns", "write:campaigns", "read:stats"] }'Finding Your Team ID
Section titled “Finding Your Team ID”-
Log in to the GhostFlow Dashboard
-
Open your browser DevTools (F12 or Ctrl+Shift+I)
-
Go to the Network tab
-
Perform any action (e.g., reload the page)
-
Click any request to the API and look for the
x-team-idheader in Request Headers — that UUID is your Team ID
Permissions (Scopes)
Section titled “Permissions (Scopes)”Each API key can be scoped to specific permissions. Scopes follow the action:resource pattern:
| Scope | Description |
|---|---|
read:campaigns | List and view campaigns |
write:campaigns | Create, update, delete campaigns |
read:domains | List and view domains |
write:domains | Create, update, delete domains |
read:offers | List and view offers |
write:offers | Create, update, delete offers |
read:sources | List and view traffic sources |
write:sources | Create, update, delete sources |
read:networks | List and view affiliate networks |
write:networks | Create, update, delete networks |
read:stats | Access statistics and reports |
read:billing | View subscription and billing info |
admin | Full administrative access |
Legacy permissions (read, write, admin) are still supported and automatically expanded:
read→ allread:*scopeswrite→ allread:*+write:*scopesadmin→ all scopes
Key Management
Section titled “Key Management”| Action | Endpoint | Method |
|---|---|---|
| List keys | /api/v1/auth/api-keys | GET |
| Create key | /api/v1/auth/api-keys | POST |
| Delete key | /api/v1/auth/api-keys/{id} | DELETE |
| Revoke key | /api/v1/auth/api-keys/{id}/revoke | PUT |
| Regenerate key | /api/v1/auth/api-keys/{id}/regenerate | POST |
| Audit log | /api/v1/auth/api-keys/{id}/audit-log | GET |
Security Best Practices
Section titled “Security Best Practices”- Use least-privilege scopes — Only grant the permissions each integration needs
- Rotate keys regularly — Use the regenerate endpoint to get a new secret
- Never commit keys — Use environment variables or secret managers
- Monitor usage — Check the audit log for unexpected API activity
- Revoke compromised keys immediately — Revoking is instant and cannot be undone
JWT Tokens
Section titled “JWT Tokens”For browser-based access (dashboard), GhostFlow uses short-lived JWT access tokens with refresh token rotation. API keys are preferred for server-to-server integrations.