Keep Rules API

The rules API from Keep — 2 operation(s) for rules.

GitHub OpenAPI

Operations 4

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /rules List data retention rules · Get Rules #
Ask an LLM
“Which data retention rules are configured for my Keep account?”
“What SQL and CEL queries do my retention rules use?”
Tell an agent
List all data retention rules.
Show every retention rule with its SQL and CEL queries.
POST /rules Create a data retention rule · Create Rule #
Ask an LLM
“How do I keep only the latest N records per group and delete the rest?”
“Can a new retention rule require approval before it takes effect?”
Tell an agent
Create retention rule {ruleName} running SQL {sqlQuery} and CEL {celQuery} every {timeframeInSeconds} {timeUnit}.
Add retention rule {ruleName} that resolves on {resolveOn} and requires approval.
PUT /rules/{rule_id} Update a data retention rule · Update Rule #
Ask an LLM
“Can I change the SQL query of an existing retention rule?”
“Is it possible to rename a retention rule?”
Tell an agent
Update retention rule {rule_id} with a new SQL query.
Rename retention rule {rule_id}.
DELETE /rules/{rule_id} Delete a data retention rule · Delete Rule #
Ask an LLM
“How do I remove a data retention rule?”
“Can I delete a retention rule that is still in use?”
Tell an agent destructive · confirm first
Delete retention rule {rule_id}.
Remove the data retention rule {rule_id}.

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/keep:keep-rules-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

keep-rules-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Keep Rules API
  description: Rest API powering https://platform.keephq.dev and friends 🏄‍♀️
  version: 0.24.5
tags:
- name: Rules
paths:
  /rules:
    get:
      tags:
      - Rules
      summary: Get Rules
      operationId: get_rules_rules_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
      - API Key: []
      - HTTPBasic: []
      - OAuth2PasswordBearer: []
    post:
      tags:
      - Rules
      summary: Create Rule
      operationId: create_rule_rules_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RuleCreateDto'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - API Key: []
      - HTTPBasic: []
      - OAuth2PasswordBearer: []
  /rules/{rule_id}:
    put:
      tags:
      - Rules
      summary: Update Rule
      operationId: update_rule_rules__rule_id__put
      parameters:
      - required: true
        schema:
          type: string
          title: Rule Id
        name: rule_id
        in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - API Key: []
      - HTTPBasic: []
      - OAuth2PasswordBearer: []
    delete:
      tags:
      - Rules
      summary: Delete Rule
      operationId: delete_rule_rules__rule_id__delete
      parameters:
      - required: true
        schema:
          type: string
          title: Rule Id
        name: rule_id
        in: path
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - API Key: []
      - HTTPBasic: []
      - OAuth2PasswordBearer: []
components:
  schemas:
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RuleCreateDto:
      properties:
        ruleName:
          type: string
          title: Rulename
        sqlQuery:
          type: object
          title: Sqlquery
        celQuery:
          type: string
          title: Celquery
        timeframeInSeconds:
          type: integer
          title: Timeframeinseconds
        timeUnit:
          type: string
          title: Timeunit
        groupingCriteria:
          items: {}
          type: array
          title: Groupingcriteria
          default: []
        groupDescription:
          type: string
          title: Groupdescription
        requireApprove:
          type: boolean
          title: Requireapprove
          default: false
        resolveOn:
          type: string
          title: Resolveon
          default: never
      type: object
      required:
      - ruleName
      - sqlQuery
      - celQuery
      - timeframeInSeconds
      - timeUnit
      title: RuleCreateDto
  securitySchemes:
    API_Key:
      type: apiKey
      in: header
      name: X-API-KEY
    HTTPBasic:
      type: http
      scheme: basic
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: token
x-provenance:
  method: harvested
  publisher: Keep
  source: https://docs.keephq.dev/openapi.json
  note: split by refine-openapis from the provider's own published document, verified by fetch (openapi/_original/*.fetch.json);
    stamped by stamp-openapi-provenance.py (roadmap#793)