GitOpsHQ Docs
Governance & Security

API Keys and Automation

Configure project API keys, service accounts, and inbound webhooks for CI/CD pipeline integration.

Overview

GitOpsHQ provides three mechanisms for programmatic access and automation:

MechanismScopeUse Case
Project API KeysSingle projectProject-scoped CI/CD operations
Service Account TokensOrganization-wideCross-project automation, fleet management
Inbound WebhooksPer-project endpointEvent-driven image updates and status sync

Each mechanism has different security characteristics, scoping rules, and lifecycle management. Choose the right one based on your automation requirements.


Project API Keys

Project API keys provide project-scoped programmatic access to the GitOpsHQ API. They are the simplest way to integrate a single project's CI/CD pipeline with GitOpsHQ.

Key Format

All project API keys use the prefix gohq_ followed by a random token:

gohq_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8

The gohq_ prefix allows security tools and secret scanners to identify GitOpsHQ keys in code repositories.

Creating a Project API Key

UI Route: Project Settings → IAM → API Keys

Open the project, go to Settings, select the IAM section, and click API Keys.

Create New Key

Click Create API Key. Provide:

FieldDescriptionRequired
NameDescriptive label (e.g., "GitHub Actions Deploy")Yes
ScopesPermissions granted to this keyYes

Copy the Key

The full API key is displayed only once at creation time. Copy it immediately and store it in your CI/CD platform's secret management.

GitOpsHQ stores a hashed version of the key. The original key cannot be retrieved after this dialog is closed. If you lose the key, you must create a new one.

Configure in CI/CD

Use the key in your pipeline's API calls via the Authorization header:

curl -H "Authorization: Bearer gohq_a1b2c3d4..." \
  https://app.gitopshq.io/api/v2/projects/{slug}/releases

Available Scopes

ScopePermissions Granted
readRead project configuration, releases, deployments, drift status
writeCreate/update values, create releases, trigger promotions
adminFull administrative access to the project
image:updateTrigger image tag updates for specific services

Path Restrictions

API key access is restricted by a fixed global path allowlist defined in the backend middleware (apiKeyPathAllowed). Only pre-approved API paths accept API key authentication. Requests to paths outside the allowlist are rejected with 403 Forbidden. This is not configurable per key.

Key Rotation

Create a Replacement Key

Create a new API key with the same scopes and configuration as the old one.

Update Consumers

Update all CI/CD pipelines and integrations to use the new key.

Verify

Confirm that all pipelines are functioning with the new key by checking recent API call logs.

Delete the Old Key

Delete the old key from GitOpsHQ. Any requests using the old key will immediately fail.


Service Accounts

Service accounts are organization-scoped machine identities for automation that needs access across multiple projects or to organization-level resources.

When to Use Service Accounts vs. API Keys

CriterionProject API KeyService Account Token
ScopeSingle projectOrganization-wide
Use caseProject-specific CI/CDCross-project automation, fleet management
Multiple tokensNo (one key = one token)Yes (one account, many tokens)
Role-based accessScope-basedRole-based (viewer, member, admin)
Action patternsFixed global path allowlistAllowed action patterns
AvailabilityAll tiersEnterprise tier

Creating a Service Account

UI Route: IAM Center → Service Accounts

From the main navigation, go to IAM Center and select Service Accounts.

Create Service Account

Click Create Service Account. Provide:

FieldDescription
NameDescriptive name (e.g., "CI/CD Pipeline Bot")
DescriptionPurpose and owner of this service account
RoleBase role: viewer, member, or admin

Create a Token

After the service account is created, navigate to its detail page and click Create Token.

FieldDescription
DescriptionToken purpose (e.g., "GitHub Actions Token")
ScopesSpecific scopes to restrict the token
Allowed ActionsAction pattern list (e.g., projects.*.releases.create)
ExpirationToken lifetime

The token is displayed once. It uses the prefix ghqs_:

ghqs_x9y8z7w6v5u4t3s2r1q0p9o8n7m6l5k4j3i2

Token Features

Multiple Tokens per Account

A single service account can have multiple tokens. This is useful for:

  • Different CI/CD platforms using the same identity
  • Token rotation without disrupting all consumers simultaneously
  • Different scope restrictions for different pipelines

Allowed Action Patterns

Action patterns provide fine-grained control over what operations a token can perform:

PatternMeaning
projects.*.releases.createCreate releases in any project
projects.my-project.*All operations on a specific project
clusters.*.commands.syncSync command on any cluster
org.members.readRead organization member list

Patterns use glob syntax: * matches a single segment, ** matches multiple segments.

Token Rotation

Tokens can be rotated independently of the service account:

  1. Create a new token on the same service account
  2. Update the consuming pipeline to use the new token
  3. Delete the old token

The service account's grants and role remain unchanged during token rotation.


Inbound Webhooks

Inbound webhooks allow external systems to trigger actions in GitOpsHQ via HTTP POST requests. GitOpsHQ provides two built-in webhook endpoints.

Image Update Webhook

Endpoint: POST /api/v1/webhooks/image-update

Triggers image tag updates across configured service deployments. See Environment Compare and Bulk Operations for full details.

Quick reference:

BODY='{"repository":"ghcr.io/myorg/api-gateway","tag":"v2.1.0","registry":"ghcr.io","digest":"sha256:abc123..."}'
TIMESTAMP=$(date +%s)
SIGNATURE=$(echo -n "${TIMESTAMP}.${BODY}" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | cut -d' ' -f2)

curl -X POST https://app.gitopshq.io/api/v1/webhooks/image-update \
  -H "Content-Type: application/json" \
  -H "X-GitOpsHQ-Signature: sha256=$SIGNATURE" \
  -H "X-GitOpsHQ-Timestamp: $TIMESTAMP" \
  -d "$BODY"

ArgoCD Webhook

Endpoint: POST /api/v1/webhooks/argocd

Receives sync status events from ArgoCD. Used as a secondary status reporting channel alongside the agent's gRPC connection.

Webhook Security

Both webhook endpoints use HMAC-SHA256 signature verification. The signature is computed over timestamp + "." + body, not just the body alone.

HeaderValue
X-GitOpsHQ-Signaturesha256=<HMAC-SHA256(shared_secret, timestamp + "." + raw_request_body)>
X-GitOpsHQ-TimestampUnix timestamp of when the request was signed (required)

Both headers are required for verification. The shared secret is configured per-project in Project Settings → Webhooks.


Outbound Webhooks

GitOpsHQ can send notifications to external systems when events occur. Outbound webhooks complement inbound webhooks by closing the feedback loop.

Supported Channels

ChannelTierDescription
HTTP EndpointFreePOST to any URL with JSON payload
SlackProRich message to a Slack channel via webhook URL
DiscordProFormatted message to a Discord channel
Microsoft TeamsProAdaptive card to a Teams channel
EmailProEmail notification to configured addresses

Configuring Outbound Webhooks

UI Route: Project Settings → Notifications → Webhooks

Add a Channel

Click Add Channel and select the channel type. Provide the endpoint URL or channel configuration.

Select Event Triggers

Choose which events should trigger a notification:

Event CategoryEvents
ReleasesCreated, approved, deployed, rolled back, failed
DriftDetected, resolved, critical
ClustersConnected, disconnected, command executed
GovernanceViolation created, resolved, break-glass activated
ImagesUpdated via webhook, updated via bulk operation

Test Delivery

Click Send Test to verify the channel is configured correctly. A test payload is sent and the delivery result is shown.

Enable

Toggle the channel to Active. Notifications will be sent for all configured events going forward.

Delivery History

Each outbound webhook channel maintains a delivery log showing:

FieldDescription
TimestampWhen the notification was sent
EventWhich event triggered the notification
StatusSuccess (2xx), failed (4xx/5xx), or timeout
ResponseHTTP status code and response body
RetryNot applicable (single delivery attempt)

Outbound webhook delivery is a single HTTP attempt with no automatic retries.


CI/CD Integration Patterns

Pattern 1: Build → Update → Promote

The most common pattern for automated deployments:

Loading diagram…
  1. CI builds and pushes a new image
  2. CI sends an image update webhook to GitOpsHQ
  3. GitOpsHQ auto-updates dev environment
  4. After verification, an operator promotes to staging (or auto-promotes if configured)
  5. After staging validation, an operator promotes to production (with approval if required)

Pattern 2: GitOps-Only (No Webhooks)

For teams that prefer full Git-driven workflows:

  1. CI builds and pushes a new image
  2. Developer updates the image tag in GitOpsHQ UI or via API
  3. Changes flow through the standard release → promote workflow

Pattern 3: Service Account for Fleet Operations

For platform teams managing many projects:

# List accessible projects
curl -H "Authorization: Bearer ghqs_..." \
  https://app.gitopshq.io/api/v2/projects

# List releases for one project and filter pending in your automation logic
curl -H "Authorization: Bearer ghqs_..." \
  https://app.gitopshq.io/api/v2/projects/{slug}/releases

# Create a release
curl -X POST -H "Authorization: Bearer ghqs_..." \
  -H "Content-Type: application/json" \
  -d '{"environment":"staging","tenantId":"tenant_01H5K...","title":"staging rollout"}' \
  https://app.gitopshq.io/api/v2/projects/{slug}/releases

# Deploy a release
curl -X POST -H "Authorization: Bearer ghqs_..." \
  https://app.gitopshq.io/api/v2/releases/{id}/deploy

Security Best Practices

PracticeDescription
Rotate keys every 90 daysSet a calendar reminder and enforce rotation through organizational policy.
Use minimum required scopesA CI pipeline that only updates images should only have image:update scope.
Prefer service accounts over personal tokensService accounts are auditable machine identities; personal tokens are tied to individual users who may leave the organization.
Store secrets in CI/CD secret managementNever hardcode API keys or webhook secrets in pipeline definitions. Use GitHub Actions secrets, GitLab CI variables, Jenkins credentials store, etc.
Monitor via audit logsRegularly review API key usage in the audit log. Investigate unexpected patterns.
Disable unused keys immediatelyWhen a pipeline is decommissioned, delete its API key the same day.
Use separate keys per pipelineEach CI/CD pipeline should have its own API key. Never share keys across pipelines.

Secret Scanner Integration

GitOpsHQ key prefixes (gohq_ and ghqs_) are registered with common secret scanning tools:

ToolSupport
GitHub Secret ScanningAuto-detects gohq_ and ghqs_ prefixes
GitLab Secret DetectionPattern matching for GitOpsHQ key formats
truffleHogCustom regex for gohq_ and ghqs_ patterns
gitleaksBuilt-in rule for GitOpsHQ keys

If a secret scanner detects a GitOpsHQ key in a public repository, rotate the key immediately. The exposed key should be considered compromised.


API Authentication Reference

All authenticated API requests use Bearer token authentication:

Authorization: Bearer <token>

Where <token> is either:

  • A project API key (gohq_...)
  • A service account token (ghqs_...)
  • A user session token (for interactive API usage)

Error Responses

StatusMeaningAction
401 UnauthorizedMissing or invalid tokenCheck the token is correct
403 ForbiddenToken is valid but lacks required scope or path accessReview the token's scopes
429 Too Many RequestsRate limit exceededBack off and retry with exponential delay

On this page