Automations API

Create, manage, and delete automations that trigger scans automatically based on events like git pushes, pull requests, schedules, or custom webhooks.

Base URL

https://bugrit.com/api/v1/automations

Authentication

All endpoints require an API key with automations:read or automations:write permissions.

Authorization: Bearer YOUR_API_KEY

List Automations

GET/api/v1/automations

List all automations for your organization.

Query Parameters

ParameterTypeDescription
project_idstringFilter by project ID
enabledbooleanFilter by enabled status
trigger_typestringFilter by trigger type
pagenumberPage number (default: 1)
per_pagenumberItems per page (default: 20, max: 100)

Example Request

curl https://bugrit.com/api/v1/automations?project_id=proj-abc123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "automations": [
    {
      "id": "auto-xyz789",
      "name": "Scan on push to main",
      "projectId": "proj-abc123",
      "organizationId": "org-def456",
      "trigger": {
        "type": "github_push",
        "config": {
          "repository": "yourorg/yourrepo",
          "branches": ["main", "develop"]
        }
      },
      "action": {
        "type": "scan",
        "config": {
          "platform": "web",
          "tools": "all",
          "failOn": "critical"
        }
      },
      "enabled": true,
      "lastTriggeredAt": "2026-01-22T10:30:00Z",
      "triggerCount": 47,
      "createdAt": "2026-01-01T00:00:00Z",
      "updatedAt": "2026-01-22T10:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "perPage": 20,
    "total": 3
  }
}

Get Automation

GET/api/v1/automations/:automationId

Retrieve a single automation by ID.

Example Request

curl https://bugrit.com/api/v1/automations/auto-xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY"

Create Automation

POST/api/v1/automations

Create a new automation.

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name for the automation
projectIdstringYesProject to run scans against
triggerobjectYesTrigger configuration (see below)
actionobjectYesAction configuration (see below)
enabledbooleanNoWhether automation is active (default: true)

Trigger Types

github_push

Triggers on push to GitHub repository

{
  "type": "github_push",
  "config": {
    "repository": "owner/repo",
    "branches": ["main", "develop"]
  }
}
github_pr

Triggers on pull request events

{
  "type": "github_pr",
  "config": {
    "repository": "owner/repo",
    "events": ["opened", "synchronize"],
    "targetBranches": ["main"]
  }
}
gitlab_push

Triggers on push to GitLab repository

{
  "type": "gitlab_push",
  "config": {
    "projectPath": "group/project",
    "branches": ["main"]
  }
}
schedule

Triggers on a cron schedule

{
  "type": "schedule",
  "config": {
    "cron": "0 2 * * *",
    "timezone": "UTC"
  }
}
webhook

Triggers when webhook URL is called

{
  "type": "webhook",
  "config": {}
}
// Returns a unique webhook URL after creation

Action Configuration

{
  "type": "scan",
  "config": {
    "platform": "web",           // web, ios, android, desktop
    "tools": "all",              // all, security, quality, or array of tool IDs
    "sourceOverride": {          // Optional: override source from trigger
      "type": "url",
      "targetUrl": "https://staging.example.com"
    },
    "failOn": "critical",        // critical, high, medium, low, or null
    "notifications": {
      "slack": "#security-alerts",
      "email": ["team@example.com"]
    }
  }
}

Example Request

curl -X POST https://bugrit.com/api/v1/automations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Scan PRs to main",
    "projectId": "proj-abc123",
    "trigger": {
      "type": "github_pr",
      "config": {
        "repository": "yourorg/yourrepo",
        "events": ["opened", "synchronize"],
        "targetBranches": ["main"]
      }
    },
    "action": {
      "type": "scan",
      "config": {
        "platform": "web",
        "tools": ["security", "quality"],
        "failOn": "critical"
      }
    },
    "enabled": true
  }'

Example Response

{
  "automation": {
    "id": "auto-new123",
    "name": "Scan PRs to main",
    "projectId": "proj-abc123",
    "organizationId": "org-def456",
    "trigger": {
      "type": "github_pr",
      "config": {
        "repository": "yourorg/yourrepo",
        "events": ["opened", "synchronize"],
        "targetBranches": ["main"]
      }
    },
    "action": {
      "type": "scan",
      "config": {
        "platform": "web",
        "tools": ["security", "quality"],
        "failOn": "critical"
      }
    },
    "webhookUrl": null,
    "enabled": true,
    "triggerCount": 0,
    "createdAt": "2026-01-23T12:00:00Z",
    "updatedAt": "2026-01-23T12:00:00Z"
  }
}

Update Automation

PATCH/api/v1/automations/:automationId

Update an existing automation. All fields are optional.

Example Request

curl -X PATCH https://bugrit.com/api/v1/automations/auto-xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": false,
    "action": {
      "type": "scan",
      "config": {
        "platform": "web",
        "tools": "all",
        "failOn": "high"
      }
    }
  }'

Delete Automation

DELETE/api/v1/automations/:automationId

Permanently delete an automation.

Example Request

curl -X DELETE https://bugrit.com/api/v1/automations/auto-xyz789 \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "success": true,
  "message": "Automation deleted successfully"
}

Get Trigger History

GET/api/v1/automations/:automationId/history

View recent trigger events for an automation.

Example Response

{
  "history": [
    {
      "id": "trig-abc123",
      "automationId": "auto-xyz789",
      "triggeredAt": "2026-01-22T10:30:00Z",
      "triggerData": {
        "commitSha": "abc123def456",
        "branch": "main",
        "author": "developer@example.com"
      },
      "scanId": "scn-created123",
      "status": "completed",
      "duration": 180000
    }
  ],
  "pagination": {
    "page": 1,
    "perPage": 20,
    "total": 47
  }
}

AI Coding Assistant Prompt

Copy this to have your AI assistant work with the Automations API:

I need to create a Bugrit automation via the API. Here are the details:

API Base: https://bugrit.com/api/v1/automations
Auth: Bearer token in Authorization header

Help me create an automation that:
1. Triggers on [push to main / PR to main / schedule / webhook]
2. Runs a [security / full / specific tools] scan
3. Fails the build if [critical / high / any] issues are found
4. Notifies [Slack channel / email] on completion

Use curl commands and show me the expected response.

Error Codes

CodeMessageDescription
400Invalid trigger typeTrigger type not supported
400Invalid cron expressionSchedule trigger has invalid cron
403Project access deniedNo access to specified project
404Automation not foundAutomation ID doesn't exist
429Automation limit reachedMax automations for tier reached