usewrit-app Automations API

Event → action rules (change_detected, webhook_received, workflow lifecycle).

Operations 7

GET /v1/automations List automations #
POST /v1/automations Create an automation #
GET /v1/automations/{id} Get one automation #
PATCH /v1/automations/{id} Update an automation #
DELETE /v1/automations/{id} Delete an automation #
POST /v1/automations/{id}/enable Enable / disable an automation #
POST /v1/automations/{id}/run Fire an automation now #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/usewrit-app:usewrit-app-automations-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

usewrit-app-automations-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Writ Agent Automations API
  version: 0.1.0
  license:
    name: MIT
    identifier: MIT
  description: 'Loopback HTTP API of the Writ local agent (`writ-agentd`), the daemon embedded in the

    Writ desktop app and the self-host build. This document is generated against the Rust

    daemon source (`writ-agent/src/local/`), which is the wire truth.


    ## Transport


    - Plain HTTP on `127.0.0.1:8131` (default; `WRIT_PORT` env overrides).

    - Optional HTTPS twin on `127.0.0.1:8132`, served with a certificate minted by a

    per-install, name-constrained local CA (`~/.writ/tls/ca.pem`). Clients must trust that

    CA file (or pin it) to use the TLS port; the payloads are identical on both ports.

    - The daemon enforces a DNS-rebind guard: `Host`/`Origin` must be loopback. Talk to

    `127.0.0.1`, not `localhost`.


    ## Errors


    Domain errors are JSON `{"error": "", "code": ""}` (see the

    `Error` schema). Codes include `bad_request`, `unauthorized`, `forbidden`, `not_found`,

    `vault_locked` (HTTP 423), `too_many_requests`, `device_capacity` (HTTP 409),

    `captcha_required` (HTTP 402), `internal`.


    **Caveat:** some 4xx bodies are `text/plain`, not JSON — axum framework rejections

    (e.g. a JSON body that fails to deserialize returns

    `Failed to deserialize the JSON body into the target type: missing field ''url''` as

    plain text with a 4xx status). Clients must tolerate non-JSON error bodies.


    ## List envelopes


    The wire is deliberately documented as-is (SDKs normalize; this spec does not):


    - `{"data": [...], "count": n}` — workflows, personas, persona runs, secrets, files, keys

    - `{"data": [...], "count": n, "total": n}` — runs

    - **bare JSON array** — monitors, monitor selectors, extractors, automations,

    `/v1/changes/recent`

    - bespoke objects — `/v1/monitors/{id}/changes`, `/v1/data`, the workflow-data table'
servers:
- url: http://127.0.0.1:8131
  description: Plain-HTTP loopback listener (default port; WRIT_PORT overrides).
- url: https://127.0.0.1:8132
  description: HTTPS twin of the same API, terminated with a certificate from the per-install local CA at ~/.writ/tls/ca.pem. Trust that CA (or pin it) in your HTTP client.
security:
- bearerAuth: []
tags:
- name: Automations
  description: Event → action rules (change_detected, webhook_received, workflow lifecycle).
paths:
  /v1/automations:
    get:
      operationId: listAutomations
      tags:
      - Automations
      summary: List automations
      description: 'Newest-first automation list. **Returns a bare JSON array.** JSON-TEXT columns are parsed on output: `conditions` is an object, `actions` an array, `blocks` an array or null.'
      parameters:
      - name: limit
        in: query
        description: Page size (clamped to 1..=500; default 100).
        schema:
          type: integer
          format: int64
          default: 100
      responses:
        '200':
          description: Bare array of automations.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Automation'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createAutomation
      tags:
      - Automations
      summary: Create an automation
      description: Requires a non-empty `name`; schema defaults fill `event_type` / `enabled` / `conditions` / `actions`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationCreate'
      responses:
        '200':
          description: The created automation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Automation'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /v1/automations/{id}:
    parameters:
    - $ref: '#/components/parameters/AutomationId'
    get:
      operationId: getAutomation
      tags:
      - Automations
      summary: Get one automation
      description: One automation or 404.
      responses:
        '200':
          description: The automation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Automation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      operationId: updateAutomation
      tags:
      - Automations
      summary: Update an automation
      description: Partial update (COALESCE); returns the refreshed row.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationUpdate'
      responses:
        '200':
          description: The refreshed automation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Automation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      operationId: deleteAutomation
      tags:
      - Automations
      summary: Delete an automation
      description: Hard-delete (executions cascade via FK).
      responses:
        '200':
          description: Deletion acknowledgement.
          content:
            application/json:
              schema:
                type: object
                required:
                - deleted
                - id
                properties:
                  deleted:
                    type: boolean
                  id:
                    type: integer
                    format: int64
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /v1/automations/{id}/enable:
    post:
      operationId: enableAutomation
      tags:
      - Automations
      summary: Enable / disable an automation
      description: Sets the `enabled` flag. The body is optional — an absent or empty body defaults to enabling. Returns the refreshed automation.
      parameters:
      - $ref: '#/components/parameters/AutomationId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationEnableRequest'
      responses:
        '200':
          description: The refreshed automation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Automation'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
  /v1/automations/{id}/run:
    post:
      operationId: runAutomation
      tags:
      - Automations
      summary: Fire an automation now
      description: 'Manual trigger — walks the automation''s block tree (conditions / branches / actions) and returns the execution outcome, including any `return_data` in `results`. When a status-gated event has no triggering context on a manual run, the response is `{status: "skipped", reason: ...}` instead.'
      parameters:
      - $ref: '#/components/parameters/AutomationId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutomationRunRequest'
      responses:
        '200':
          description: Execution outcome (executed or skipped).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AutomationRunResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    Error:
      type: object
      description: 'The daemon''s domain error body. NOTE: some 4xx responses (axum framework rejections) are `text/plain` instead of this JSON shape. Certain codes attach extra fields (e.g. `device_capacity` adds `would_use_units_per_min` / `budget_units_per_min`; `captcha_required` adds `captcha_type` / `url`).'
      required:
      - error
      - code
      properties:
        error:
          type: string
          description: 'Human-readable message (e.g. `not found: workflow 999999`).'
        code:
          type: string
          description: 'Stable machine code: `bad_request`, `unauthorized`, `forbidden`, `not_found`, `vault_locked`, `too_many_requests`, `captcha_required`, `device_capacity`, `cloud_unreachable`, `db_error`, `io_error`, `json_error`, `internal`, …'
      additionalProperties: true
    AutomationRunRequest:
      type: object
      description: Optional body — inputs handed to the flow's workflow actions.
      properties:
        inputs:
          type:
          - object
          - 'null'
    AutomationUpdate:
      type: object
      description: Partial PATCH body (`store::automations::AutomationPatch`), COALESCE semantics.
      properties:
        name:
          type:
          - string
          - 'null'
        description:
          type:
          - string
          - 'null'
        event_type:
          type:
          - string
          - 'null'
        target_id:
          type:
          - integer
          - 'null'
          format: int64
        target_selector_id:
          type:
          - integer
          - 'null'
          format: int64
        workflow_id:
          type:
          - integer
          - 'null'
          format: int64
        webhook_trigger_id:
          type:
          - integer
          - 'null'
          format: int64
        enabled:
          type:
          - integer
          - 'null'
          description: 0/1 integer flag.
        priority:
          type:
          - integer
          - 'null'
          format: int64
        conditions:
          description: Conditions object (or JSON string).
        actions:
          description: Actions array (or JSON string).
        blocks:
          description: Block tree (or JSON string).
    AutomationRunResult:
      description: Manual-run outcome — either an execution record or a skip notice (a status-gated event with no triggering context).
      oneOf:
      - type: object
        title: Executed
        required:
        - execution_id
        - status
        - results
        - error
        properties:
          execution_id:
            type: integer
            format: int64
          status:
            type: string
          results:
            description: Parsed action results (any JSON value; null on parse failure).
          error:
            type:
            - string
            - 'null'
      - type: object
        title: Skipped
        required:
        - status
        - reason
        properties:
          status:
            type: string
            const: skipped
          reason:
            type: string
    AutomationCreate:
      type: object
      description: Create body (`store::automations::NewAutomation`). `conditions` / `actions` / `blocks` accept a parsed JSON value or a JSON string.
      required:
      - name
      properties:
        name:
          type: string
        description:
          type:
          - string
          - 'null'
        event_type:
          type:
          - string
          - 'null'
        target_id:
          type:
          - integer
          - 'null'
          format: int64
        target_selector_id:
          type:
          - integer
          - 'null'
          format: int64
        workflow_id:
          type:
          - integer
          - 'null'
          format: int64
        webhook_trigger_id:
          type:
          - integer
          - 'null'
          format: int64
        enabled:
          type:
          - integer
          - 'null'
          description: 0/1 integer flag.
        priority:
          type:
          - integer
          - 'null'
          format: int64
        conditions:
          description: Conditions object (or JSON string). Defaults to `{}`.
        actions:
          description: Actions array (or JSON string). Defaults to `[]`.
        blocks:
          description: Block tree (or JSON string).
    Automation:
      type: object
      description: 'One automation. On output the JSON-TEXT columns are PARSED: `conditions` is an object, `actions` an array, `blocks` an array or null.'
      required:
      - id
      - event_type
      - name
      - enabled
      - conditions
      - actions
      - created_at
      properties:
        id:
          type: integer
          format: int64
        target_id:
          type:
          - integer
          - 'null'
          format: int64
        event_type:
          type: string
          description: '`change_detected` | `webhook_received` | `workflow_started` | `workflow_completed`.'
        target_selector_id:
          type:
          - integer
          - 'null'
          format: int64
        workflow_id:
          type:
          - integer
          - 'null'
          format: int64
        webhook_trigger_id:
          type:
          - integer
          - 'null'
          format: int64
        name:
          type: string
        description:
          type:
          - string
          - 'null'
        enabled:
          type: integer
          description: 0/1 integer flag.
        priority:
          type:
          - integer
          - 'null'
          format: int64
        conditions:
          type: object
          description: Parsed conditions object (parse failures degrade to `{}`).
          additionalProperties: true
        actions:
          type: array
          description: Parsed actions array (parse failures degrade to `[]`).
        blocks:
          type:
          - array
          - 'null'
          description: Parsed block tree, or null.
        last_triggered_at:
          type:
          - string
          - 'null'
        trigger_count:
          type:
          - integer
          - 'null'
          format: int64
        created_at:
          type: string
        updated_at:
          type:
          - string
          - 'null'
    AutomationEnableRequest:
      type: object
      description: Optional body — absent/empty defaults to enabling.
      properties:
        enabled:
          type: boolean
          default: true
  responses:
    NotFound:
      description: The addressed resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing/invalid bearer token, or the Origin/Host guard rejected the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: 'Invalid input. Domain validation errors use the JSON Error shape; axum body-deserialize rejections are `text/plain` with a bare message (e.g. `Failed to deserialize the JSON body into the target type: missing field ''url''`).'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
        text/plain:
          schema:
            type: string
  parameters:
    AutomationId:
      name: id
      in: path
      required: true
      description: Automation row id.
      schema:
        type: integer
        format: int64
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: "Every route (including `/v1/agent` and `/v1/health`) requires\n`Authorization: Bearer <token>`. Token families:\n\n- `wlt_…` — the runtime token from `runtime.json` (full access, used by the desktop\n  UI and SDK discovery).\n- `wlk_…` — a scoped API key minted via `POST /v1/keys` (CSV scopes `read|run|admin`;\n  `/v1/keys` itself requires the full-access token).\n- `wlo_…` — an OAuth 2.1 access token from the daemon's local authorization server\n  (`run` scope).\n\nTreat the token as an opaque string. The daemon additionally enforces a loopback\nOrigin/Host DNS-rebind guard.\n"