Automation — MDDB API

Triggers, crons, and webhook targets for automated workflows

List automation rules #

GET /v1/automation

Returns all automation rules (webhooks, triggers, crons). Optionally filter by type, or (2.19.0) by collection to list the sources syncing into it. Every sync and backup carries lastResult.

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
type query string Filter by rule type One of "webhook", "trigger", "cron".
collection query string (2.19.0) Only the rules acting on this collection — the syncs writing to it and the triggers watching it

Responses #

Status Description Body
200 List of automation rules object (application/json)
400 Automation is not initialized ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

Create automation rule #

POST /v1/automation

Create a new webhook target, trigger, or cron rule.

Authorization: BearerAuth or APIKeyAuth or none

Request body #

Required.

Content type application/json: AutomationRule

{
  "backup": {
    "bucket": "string",
    "collections": [
      "*"
    ],
    "keep": 0,
    "path": "string",
    "prefix": "mddb-",
    "storageConfig": {
      "accessKey": "AKIAIOSFODNN7EXAMPLE",
      "bucket": "my-mddb-bucket",
      "endpoint": "s3.amazonaws.com",
      "prefix": "mddb/",
      "region": "us-east-1",
      "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
      "useTLS": true
    },
    "target": "local"
  },
  "collection": "string",
  "conditionLogic": "and",
  "enabled": true,
  "events": [
    "insert"
  ],
  "lastResult": {
    "added": 0,
    "at": 0,
    "commit": "string",
    "commitUrl": "https://example.com/",
    "deleted": 0,
    "durationMs": 0,
    "error": "string",
    "failed": 0,
    "ref": "string",
    "status": "success",
    "unchanged": 0,
    "upToDate": false,
    "updated": 0
  },
  "method": "POST",
  "name": "string",
  "query": "string",
  "schedule": "string",
  "searchType": "fts",
  "sentimentEnabled": false,
  "sentimentMax": 0,
  "sentimentMin": 0,
  "sync": {
    "adopt": false,
    "bucket": "string",
    "collection": "string",
    "comments": true,
    "exclude": [
      "testdata/**"
    ],
    "forge": "github",
    "hookSecretRef": "string",
    "include": [
      "*.md"
    ],
    "lang": "string",
    "maxBytes": 10485760,
    "maxDocuments": 1000,
    "prefix": "string",
    "prune": false,
    "ref": "latest-release",
    "repositoryFrom": "string",
    "since": "2026-01-01",
    "source": "sitemap",
    "state": "all",
    "storageConfig": {
      "accessKey": "AKIAIOSFODNN7EXAMPLE",
      "bucket": "my-mddb-bucket",
      "endpoint": "s3.amazonaws.com",
      "prefix": "mddb/",
      "region": "us-east-1",
      "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
      "useTLS": true
    },
    "tokenSecretRef": "string",
    "url": "https://example.com/",
    "urls": [
      "https://example.com/"
    ]
  },
  "threshold": 0,
  "triggerId": "string",
  "type": "webhook",
  "url": "string",
  "webhookId": "string"
}

Responses #

Status Description Body
201 Rule created AutomationRule (application/json)
400 Validation error
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
413 The body is over MDDB_MAX_BODY_BYTES (32 MiB by default). ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

413 example (application/json)

{
  "error": "request body too large"
}

Get automation rule #

GET /v1/automation/{id}

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Responses #

Status Description Body
200 Automation rule AutomationRule (application/json)
404 Not found
400 The request is malformed (a body that is not JSON, a missing or invalid field, an unreadable body) or names a subsystem that is not initialized. The message says which. ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)

400 example (application/json)

{
  "error": "missing collection"
}

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

Update automation rule #

PUT /v1/automation/{id}

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Request body #

Required.

Content type application/json: AutomationRule

{
  "backup": {
    "bucket": "string",
    "collections": [
      "*"
    ],
    "keep": 0,
    "path": "string",
    "prefix": "mddb-",
    "storageConfig": {
      "accessKey": "AKIAIOSFODNN7EXAMPLE",
      "bucket": "my-mddb-bucket",
      "endpoint": "s3.amazonaws.com",
      "prefix": "mddb/",
      "region": "us-east-1",
      "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
      "useTLS": true
    },
    "target": "local"
  },
  "collection": "string",
  "conditionLogic": "and",
  "enabled": true,
  "events": [
    "insert"
  ],
  "lastResult": {
    "added": 0,
    "at": 0,
    "commit": "string",
    "commitUrl": "https://example.com/",
    "deleted": 0,
    "durationMs": 0,
    "error": "string",
    "failed": 0,
    "ref": "string",
    "status": "success",
    "unchanged": 0,
    "upToDate": false,
    "updated": 0
  },
  "method": "POST",
  "name": "string",
  "query": "string",
  "schedule": "string",
  "searchType": "fts",
  "sentimentEnabled": false,
  "sentimentMax": 0,
  "sentimentMin": 0,
  "sync": {
    "adopt": false,
    "bucket": "string",
    "collection": "string",
    "comments": true,
    "exclude": [
      "testdata/**"
    ],
    "forge": "github",
    "hookSecretRef": "string",
    "include": [
      "*.md"
    ],
    "lang": "string",
    "maxBytes": 10485760,
    "maxDocuments": 1000,
    "prefix": "string",
    "prune": false,
    "ref": "latest-release",
    "repositoryFrom": "string",
    "since": "2026-01-01",
    "source": "sitemap",
    "state": "all",
    "storageConfig": {
      "accessKey": "AKIAIOSFODNN7EXAMPLE",
      "bucket": "my-mddb-bucket",
      "endpoint": "s3.amazonaws.com",
      "prefix": "mddb/",
      "region": "us-east-1",
      "secretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
      "useTLS": true
    },
    "tokenSecretRef": "string",
    "url": "https://example.com/",
    "urls": [
      "https://example.com/"
    ]
  },
  "threshold": 0,
  "triggerId": "string",
  "type": "webhook",
  "url": "string",
  "webhookId": "string"
}

Responses #

Status Description Body
200 Rule updated AutomationRule (application/json)
400 The request is malformed (a body that is not JSON, a missing or invalid field, an unreadable body) or names a subsystem that is not initialized. The message says which. ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
404 The thing the request names does not exist. ErrorResponse (application/json)
413 The body is over MDDB_MAX_BODY_BYTES (32 MiB by default). ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)

400 example (application/json)

{
  "error": "missing collection"
}

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

404 example (application/json)

{
  "error": "not found"
}

413 example (application/json)

{
  "error": "request body too large"
}

Delete automation rule #

DELETE /v1/automation/{id}

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Responses #

Status Description Body
200 Rule deleted
400 The request is malformed (a body that is not JSON, a missing or invalid field, an unreadable body) or names a subsystem that is not initialized. The message says which. ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
404 The thing the request names does not exist. ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)

400 example (application/json)

{
  "error": "missing collection"
}

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

404 example (application/json)

{
  "error": "not found"
}

Run a sync or backup rule now #

POST /v1/automation/{id}/run

(2.19.0) Runs a cron rule's sync or backup at once, through the code its schedule fires — logged in the automation log, announced on the jobs SSE stream, firing its webhook — and sets lastRun. A disabled rule runs too. The run goes on in the background; follow jobId on GET /v1/jobs/stream. Needs a global administrator.

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Responses #

Status Description Body
202 The run started AutomationRun (application/json)
400 The rule has no sync or backup ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
404 No such rule ErrorResponse (application/json)
405 Method not allowed (POST only) ErrorResponse (application/json)
409 The previous run of the rule is still going; the skip is logged ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)
503 The server runs no cron scheduler (MDDB_CRONS is off) ErrorResponse (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

Run a git sync, or refresh an issue, from a forge webhook #

POST /v1/automation/{id}/hook

(2.19.5) A forge's push or release webhook runs a git sync's rule now, as POST /v1/automation/{id}/run does. For an issues sync (2.19.11) an event about an issue, a comment or a pull request refreshes that one document and answers 200 with what it did; an event naming no item runs an incremental pass. The route takes no mddb credentials; the request is verified against the rule's hookSecretRef secret instead — X-Hub-Signature-256 (sha256=; GitHub, also sent by Gitea and Forgejo), X-Gitea-Signature or X-Forgejo-Signature (), or X-Gitlab-Token (the secret itself).

Authorization: none

Parameters #

Name In Type Description
id (required) path string
X-Hub-Signature-256 header string
X-Gitea-Signature header string
X-Forgejo-Signature header string
X-Gitlab-Token header string
X-GitHub-Event header string ping answers 200 without a run

Request body #

The forge's event, verified as it arrived; an issues sync reads the item it names.

Content type application/json: object

Responses #

Status Description Body
200 GitHub's ping, verified; or (2.19.11) the one item an issues sync refreshed object (application/json)
202 The run started AutomationRun (application/json)
401 No signature, or one that does not match ErrorResponse (application/json)
404 No rule with this id has a hook ErrorResponse (application/json)
405 Method not allowed (POST only) ErrorResponse (application/json)
409 The previous run of the rule is still going ErrorResponse (application/json)
413 The body is over 25 MB ErrorResponse (application/json)
503 The secret cannot be opened, or no cron scheduler runs ErrorResponse (application/json)

Refresh a synced collection now #

POST /v1/sync/refresh

(2.19.11, INT-023) Refreshes the sync rules writing to the collection — with number, that one issue or pull request of each issues sync, at once; without, an incremental run of each sync rule (as POST /v1/automation/{id}/run). Gated as a write of the collection, so an MCP key limited to it may call it (MCP tool sync_refresh); it never runs a rule writing elsewhere. At most once every 30 s per rule. See docs/AUTOMATIONS.md#issues-and-pull-requests.

Authorization: BearerAuth or APIKeyAuth or none

Request body #

Required.

Content type application/json: object

Property Type Description
collection (required) string
number integer The issue or pull request to refresh; omitted runs an incremental pass Minimum 0.
{
  "collection": "string",
  "number": 0
}

Responses #

Status Description Body
200 What each rule's refresh did SyncRefreshResult (application/json)
400 No collection, or a negative number ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
404 No sync rule writes to the collection (with number, no issues sync) ErrorResponse (application/json)
405 Method not allowed (POST only) ErrorResponse (application/json)
429 Every rule was refreshed less than 30 s ago; Retry-After says when to try again object (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

The default forge tokens #

GET /v1/forge-tokens

(2.19.11, INT-023) Host → the stored secret a git or issues sync on that host reads with when neither its rule nor its collection's repository names one. Kept with the stored secrets. Global admin.

Authorization: BearerAuth or APIKeyAuth or none

Responses #

Status Description Body
200 The map ForgeTokens (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
503 The secret store is not loaded ErrorResponse (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

Replace the default forge tokens #

PUT /v1/forge-tokens

(2.19.11) Replaces the whole map. A host is a lower-case host name with an optional port, compared exactly with a repository URL's host; every secret must exist and cannot be deleted while named (409 usedBy "default:"). Global admin.

Authorization: BearerAuth or APIKeyAuth or none

Request body #

Required.

Content type application/json: ForgeTokens

{
  "defaults": {
    "github.com": "github-token"
  }
}

Responses #

Status Description Body
200 The map as stored ForgeTokens (application/json)
400 A host that is not a host name, an unknown secret, or more than 100 hosts ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
503 The secret store is not loaded ErrorResponse (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

Test trigger (dry run) #

POST /v1/automation/{id}/test

Execute a trigger's search and return matching documents without firing the webhook.

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
id (required) path string

Responses #

Status Description Body
200 Test results object (application/json)
400 Not a trigger rule (only triggers can be tested), or the test failed ErrorResponse (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
404 The thing the request names does not exist. ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}

404 example (application/json)

{
  "error": "not found"
}

List automation execution logs #

GET /v1/automation-logs

Returns automation execution logs ordered newest-first with cursor-based pagination. Requires MDDB_AUTOMATION_LOGS != "disable".

Authorization: BearerAuth or APIKeyAuth or none

Parameters #

Name In Type Description
limit query integer Max entries per page Default 50. Minimum 1. Maximum 500.
cursor query string Pagination cursor from previous response
ruleId query string Filter by rule ID
status query string Filter by execution status One of "success", "error", "skipped".

Responses #

Status Description Body
200 Automation logs object (application/json)
401 Auth is on (MDDB_AUTH_ENABLED=true) and the request carries no credentials, an invalid or expired JWT, or an unknown API key. ErrorResponse (application/json)
403 The caller lacks the permission the route needs (SEC-019 access gate, auth on: read, write or admin on the collections the request names), or a write meets read-only mode (MDDB_MODE=read or the protocol's own mode). ErrorResponse (application/json)
404 Automation logs are disabled ErrorResponse (application/json)
429 The client is over the API rate limit (MDDB_RATE_LIMIT_ENABLED=true, MDDB_RATE_LIMIT_REQUESTS per MDDB_RATE_LIMIT_WINDOW seconds). A call that embeds can also be refused by the collection's daily embedding budget, with a QuotaExceeded body. Since v2.19.8 (GO-054) a request over its tenant's or its credential's rate or concurrency limit is refused with a TenantLimit body. anyOf RateLimitError | TenantLimit (application/json)

401 example (application/json)

{
  "error": "missing authentication"
}

403 example (application/json)

{
  "error": "forbidden"
}