> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spade.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Incremental category trigger operations at account scope

> Perform incremental operations on category action triggers at the account scope.

Supports two operations:
- **add**: Register new category triggers or update existing ones. Only the submitted triggers are affected—existing registrations are preserved. If a trigger ID already exists, its registration is replaced (upsert). All registrations are processed synchronously.
- **remove**: Remove category triggers by trigger ID. Removed triggers are excluded from enrichment lookups. Trigger IDs that are not currently active are silently ignored (idempotent).

Successful `add` operations return `201`; successful `remove` operations return `200`.

**Limit:** The total number of active triggers at a scope cannot exceed 300. An `add` operation that would push the total past this limit will receive a `400` error.

**Important:** Only one operation can be in progress per scope at a time. Concurrent requests return 409.

To learn more about action triggers, please read the [Category Action Triggers Guide](https://docs.spade.com/reference/category-action-triggers-guide).



## OpenAPI

````yaml /api-reference/spec.yml patch /category-action-triggers
openapi: 3.1.0
info:
  title: Spade API
  description: >-
    Documentation for Spade's card transaction enrichment API and related
    endpoints. We offer sandbox and production environments on both the east
    coast and west coast to enable ultra low latency enrichment for realtime
    applications. Each environment requires different API keys. To inquire about
    API keys, please contact your Spade representative or reach out to
    <hello@spade.com>.
  version: 2.7.3
servers:
  - url: https://east.sandbox.spade.com
    description: East coast sandbox environment
  - url: https://east.api.spade.com
    description: East coast production environment
  - url: https://west.sandbox.spade.com
    description: West coast sandbox environment
  - url: https://west.api.spade.com
    description: West coast production environment
  - url: https://sandbox.v2.spadeapi.com
    description: East coast sandbox environment (deprecated)
  - url: https://v2.spadeapi.com
    description: East coast production environment (deprecated)
  - url: https://sandbox.west.v2.spadeapi.com
    description: West coast sandbox environment (deprecated)
  - url: https://west.v2.spadeapi.com
    description: West coast production environment (deprecated)
security:
  - ApiKeyAuth: []
tags:
  - name: Card Enrichment
    description: Enrich card transactions
  - name: Transfer Enrichment
    description: Enrich transfers
  - name: Category Personalization
    description: Create custom categories and personalize enrichments
  - name: Feedback and Reporting
    description: Provide feedback on card events or report enrichment errors
  - name: Merchant Matching
    description: Match your merchants to Spade counterparties and locations
  - name: Merchant Search
    description: Search for Spade merchants
  - name: Merchant Action Triggers
    description: >-
      Register merchant action triggers and receive triggered actions in
      enrichment responses
  - name: Category Action Triggers
    description: >-
      Register category action triggers and receive triggered actions in
      enrichment responses
paths:
  /category-action-triggers:
    patch:
      tags:
        - Category Action Triggers
      summary: Incremental category trigger operations at account scope
      description: >-
        Perform incremental operations on category action triggers at the
        account scope.


        Supports two operations:

        - **add**: Register new category triggers or update existing ones. Only
        the submitted triggers are affected—existing registrations are
        preserved. If a trigger ID already exists, its registration is replaced
        (upsert). All registrations are processed synchronously.

        - **remove**: Remove category triggers by trigger ID. Removed triggers
        are excluded from enrichment lookups. Trigger IDs that are not currently
        active are silently ignored (idempotent).


        Successful `add` operations return `201`; successful `remove` operations
        return `200`.


        **Limit:** The total number of active triggers at a scope cannot exceed
        300. An `add` operation that would push the total past this limit will
        receive a `400` error.


        **Important:** Only one operation can be in progress per scope at a
        time. Concurrent requests return 409.


        To learn more about action triggers, please read the [Category Action
        Triggers
        Guide](https://docs.spade.com/reference/category-action-triggers-guide).
      operationId: categoryActionTriggersPatch
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CategoryActionTriggerPatchRequest'
            examples:
              add:
                summary: Add category triggers
                value:
                  operation: add
                  categoryTriggers:
                    - id: groceries-reward
                      categoryId: 005-001-000-000
                      action:
                        type: REWARD
                        rewardPercent: 2
                        offerId: groceries-2x
              remove:
                summary: Remove category triggers
                value:
                  operation: remove
                  triggerIds:
                    - block-gambling
        required: true
      responses:
        '200':
          description: Remove operation completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActionTriggerPatchResponse'
        '201':
          description: Add operation completed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoryActionTriggerStatusResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Unauthorized'
        '409':
          description: A registration is already in progress for this scope
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                    examples:
                      - >-
                        An action trigger registration is already in progress
                        for this scope.
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CategoryActionTriggerPatchRequest:
      type: object
      description: >-
        Request body for incremental category action trigger operations.


        - For `add`: `categoryTriggers` is required. `triggerIds` is optional
        and ignored if provided.

        - For `remove`: `triggerIds` is required and must be a non-empty list.
      required:
        - operation
      properties:
        operation:
          type: string
          enum:
            - add
            - remove
          description: >-
            The operation to perform:

            - `add`: Register new category triggers or update existing ones

            - `remove`: Remove category triggers (excluded from enrichment
            lookups)
          examples:
            - add
        categoryTriggers:
          type: array
          description: >-
            List of category triggers to add. Required for the `add` operation.


            If a trigger ID already exists, the old registration is replaced
            (upsert behavior).


            **Field requirements:**

            - `id`, `categoryId`, and `action` are always required
          minItems: 1
          maxItems: 300
          items:
            $ref: '#/components/schemas/CategoryTriggerItem'
        triggerIds:
          type:
            - array
            - 'null'
          description: >-
            List of trigger IDs to remove. Required and must be non-empty for
            the `remove` operation.


            Trigger IDs that are not currently active are silently ignored
            (idempotent).


            For `add` operations, this field is optional and ignored if provided
            — you may pass `null`, `[]`, or omit it entirely.
          items:
            type: string
            maxLength: 512
          examples:
            - - travel-reward-1
              - block-gambling
    ActionTriggerPatchResponse:
      type: object
      description: Response for the remove PATCH operation.
      properties:
        status:
          type: string
          enum:
            - succeeded
          examples:
            - succeeded
        version:
          type: integer
          description: The version number of this operation.
          examples:
            - 5
    CategoryActionTriggerStatusResponse:
      type: object
      description: >-
        Response containing the status of a category action trigger
        registration.
      properties:
        status:
          type: string
          description: >
            The current status of the action trigger registration. Category
            trigger registrations are processed synchronously, so the status is
            always one of:

            - `succeeded`: Registration complete, triggers are now active

            - `failed`: Registration failed, check your request and retry
          enum:
            - succeeded
            - failed
          examples:
            - succeeded
        version:
          type: integer
          description: >-
            The version number of this registration. Increments with each PUT,
            PATCH, or DELETE request to this scope.
          examples:
            - 1
        categoryTriggers:
          type: array
          description: >-
            The list of active category triggers registered for this scope.
            Present on GET responses; omitted on PUT and PATCH responses.
          items:
            type: object
            properties:
              id:
                type: string
                description: The trigger ID as provided during registration.
                examples:
                  - travel-reward-1
              categoryId:
                type: string
                description: >-
                  The category ID associated with this trigger, as provided
                  during registration.
                examples:
                  - 020-001-000-000
              action:
                type: object
                description: >-
                  The action data associated with this trigger, as provided
                  during registration.
                additionalProperties: true
                examples:
                  - type: REWARD
                    rewardPercent: 3
        totalCount:
          type: integer
          description: >-
            The total number of active category triggers registered for this
            scope. Present on GET responses; omitted on PUT and PATCH responses.
          examples:
            - 10
    CategoryTriggerItem:
      type: object
      description: A category trigger to register for action matching.
      required:
        - id
        - categoryId
        - action
      properties:
        id:
          type: string
          description: >-
            Your identifier for this trigger, unique within the scope you are
            registering against. This ID will be returned in the `actions` field
            of enrichment responses when this trigger matches a transaction.
          maxLength: 512
          examples:
            - travel-reward-1
        categoryId:
          type: string
          description: >-
            The Spade category ID to match against. Category IDs use the format
            `xxx-xxx-xxx-xxx` where each `x` is a digit — use [`GET
            /categories`](https://docs.spade.com/api-reference/category-personalization/get-all-default-and-custom-integration-level-categories)
            to discover valid IDs.
          maxLength: 15
          pattern: ^\d{3}-\d{3}-\d{3}-\d{3}$
          examples:
            - 020-001-000-000
        action:
          type: object
          description: >
            A custom JSON object that will be returned in the enrichment
            response when this trigger matches. Use this to store any data
            relevant to your use case (e.g., reward amounts, offer IDs, campaign
            metadata).


            The optional `type` field has reserved values with special behavior:

            - `BLOCK`: Adds `authRecommendation: "BLOCK"` to the action in the
            enrichment response. Use this to flag transactions that should be
            declined.

            - `ALLOW_ONLY`: Adds `authRecommendation: "ALLOW"` when the
            transaction matches a registered category. If the transaction does
            **not** match any `ALLOW_ONLY` trigger, the action is returned with
            `authRecommendation: "BLOCK"` (inverse semantics). Use this to
            create allowlists where only registered categories are permitted.

            - `REWARD`: No special behavior. Passed through as-is.

            - Any other value: Treated as a custom type and passed through
            as-is.
          properties:
            type:
              type: string
              description: >
                Optional action type. Reserved values `BLOCK` and `ALLOW_ONLY`
                have special authorization semantics (see above). All other
                values are passed through without modification.
              examples:
                - REWARD
                - BLOCK
                - ALLOW_ONLY
          additionalProperties: true
          examples:
            - type: REWARD
              rewardPercent: 3
              offerId: travel-3x-promo
            - type: BLOCK
              reason: Gambling not permitted
            - type: ALLOW_ONLY
  responses:
    BadRequest:
      description: Invalid input
      content:
        application/json:
          schema:
            type: object
            properties:
              invalidField:
                type: array
                items:
                  type: string
                  examples:
                    - This field is required.
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              details:
                type: string
                examples:
                  - Incorrect authentication credentials.
    InternalServerError:
      description: Unexpected Error
      content:
        application/json:
          schema:
            type: object
            properties:
              details:
                type: string
                examples:
                  - Internal server error.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      name: X-Api-Key
      in: header

````