Skip to content

Authentication

Every GhostFlow API request requires two things:

  1. Authentication — an API key (gf_...) in the Authorization header
  2. Team context — your Team ID in the X-Team-Id header
Terminal window
curl https://devcore.getghostflow.io/api/v1/campaigns \
-H "Authorization: Bearer gf_your_api_key_here" \
-H "X-Team-Id: your-team-uuid-here"

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.

GhostFlow uses API keys prefixed with gf_ for programmatic access. Keys are passed via the Authorization header using the Bearer scheme:

Terminal window
Authorization: Bearer gf_abc123def456...

Generate keys from the Settings → API Keys page in your dashboard, or programmatically:

Terminal window
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"]
}'
  1. Log in to the GhostFlow Dashboard

  2. Open your browser DevTools (F12 or Ctrl+Shift+I)

  3. Go to the Network tab

  4. Perform any action (e.g., reload the page)

  5. Click any request to the API and look for the x-team-id header in Request Headers — that UUID is your Team ID

Each API key can be scoped to specific permissions. Scopes follow the action:resource pattern:

ScopeDescription
read:campaignsList and view campaigns
write:campaignsCreate, update, delete campaigns
read:domainsList and view domains
write:domainsCreate, update, delete domains
read:offersList and view offers
write:offersCreate, update, delete offers
read:sourcesList and view traffic sources
write:sourcesCreate, update, delete sources
read:networksList and view affiliate networks
write:networksCreate, update, delete networks
read:statsAccess statistics and reports
read:billingView subscription and billing info
adminFull administrative access

Legacy permissions (read, write, admin) are still supported and automatically expanded:

  • read → all read:* scopes
  • write → all read:* + write:* scopes
  • admin → all scopes
ActionEndpointMethod
List keys/api/v1/auth/api-keysGET
Create key/api/v1/auth/api-keysPOST
Delete key/api/v1/auth/api-keys/{id}DELETE
Revoke key/api/v1/auth/api-keys/{id}/revokePUT
Regenerate key/api/v1/auth/api-keys/{id}/regeneratePOST
Audit log/api/v1/auth/api-keys/{id}/audit-logGET
  1. Use least-privilege scopes — Only grant the permissions each integration needs
  2. Rotate keys regularly — Use the regenerate endpoint to get a new secret
  3. Never commit keys — Use environment variables or secret managers
  4. Monitor usage — Check the audit log for unexpected API activity
  5. Revoke compromised keys immediately — Revoking is instant and cannot be undone

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.