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

# Create transaction rule

>  

Use this endpoint to create a new transaction rule. The newly-created `transaction_rule` object will be returned if successful.


## OpenAPI

````yaml openapi/nexus/v1.yaml POST /transaction_rules
openapi: 3.0.0
info:
  contact:
    name: Nexus API
    url: https://www.mx.com
  version: 1.0.0
  title: Nexus API
  description: >-
    Legacy clients can use Nexus API for all their connectivity needs. If you
    are a new client refer to our Platform API. Review our [Nexus API
    Guides](/nexus) for more information.
servers:
  - url: https://int-data.moneydesktop.com/
  - url: https://data.moneydesktop.com/
security:
  - sessionToken: []
tags:
  - name: accounts
  - name: beats
  - name: budgets
  - name: categories
  - name: extended transaction history
  - name: goals
  - name: holdings
  - name: identity
  - name: insights
  - name: institutions
  - name: jobs
  - name: member credentials
  - name: members
  - name: merchants
  - name: microdeposits
  - name: monthly cash flow profile
  - name: notifications
  - name: scheduled payments
  - name: sessions
  - name: spending plan
  - name: taggings
  - name: tags
  - name: transaction rules
  - name: transactions
  - name: user
  - name: verification
paths:
  /transaction_rules:
    post:
      tags:
        - transaction rules
      summary: Create transaction rule
      description: >-
        Use this endpoint to create a new transaction rule. The newly-created
        `transaction_rule` object will be returned if successful.
      operationId: createTransactionRule
      requestBody:
        required: true
        content:
          application/vnd.mx.nexus.v1+json:
            schema:
              $ref: '#/components/schemas/TransactionRuleCreateRequestBody'
      responses:
        '200':
          content:
            application/vnd.mx.api.v1+json:
              schema:
                $ref: '#/components/schemas/TransactionRuleResponseBody'
          description: OK
components:
  schemas:
    TransactionRuleCreateRequestBody:
      properties:
        transaction_rule:
          $ref: '#/components/schemas/TransactionRuleCreateRequest'
      type: object
    TransactionRuleResponseBody:
      properties:
        transaction_rule:
          $ref: '#/components/schemas/TransactionRuleResponse'
      type: object
    TransactionRuleCreateRequest:
      properties:
        category_guid:
          example: CAT-b1de2a04-db08-b6ed-f6fe-ca2f5b11c2d0
          type: string
        description:
          example: Wal-mart food storage
          type: string
        match_description:
          example: Wal-mart
          type: string
      required:
        - category_guid
        - match_description
      type: object
    TransactionRuleResponse:
      properties:
        category_guid:
          example: CAT-b1de2a04-db08-b6ed-f6fe-ca2f5b11c2d0
          nullable: true
          type: string
        created_at:
          example: '2018-10-02T22:00:50+00:00'
          nullable: true
          type: string
        description:
          example: Wal-mart food storage
          nullable: true
          type: string
        guid:
          example: TXR-a080e0f9-a2d4-4d6f-9e03-672cc357a4d3
          nullable: true
          type: string
        match_description:
          example: Wal-mart
          nullable: true
          type: string
        updated_at:
          example: '2018-10-02T23:54:40+00:00'
          nullable: true
          type: string
        user_guid:
          example: USR-22fc3203-b3e6-8340-43db-8e50b2f56995
          nullable: true
          type: string
      type: object
  securitySchemes:
    sessionToken:
      description: >
        ### MX Session Token 

        - Request an API token using the read API token endpoint in the MX SSO
        API.

        - Exchange an API token for a session token. 
          - A session token is obtained by sending a POST request to /sessions
          - The session token will be used in each request made for the user. It should be passed in an `MD-SESSION-TOKEN` HTTP header as shown below.
          - This session token is valid for 30 minutes from the time it was created. The 30 minute expiration counter is refreshed with each call.
          - If you send a request with an expired session token you'll receive an error code of `4011`.

        ```

        curl -i https://int-data.moneydesktop.com/accounts \

        -H 'MD-SESSION-TOKEN:
        CWforZl1Vn2vC_v6H4rnQRT1DoWpDouJAV-_5TBmiQRAtA8rsOG_BoajTiOSsL0A3bd-bmHXlA-eQzc9ywItKg'
        \

        -H 'Content-Type: application/vnd.mx.nexus.v1+json' \

        -H 'Accept: application/vnd.mx.nexus.v1+json'

        ```


        In documentation code examples, replace `<API_KEY_VALUE>` with the
        session token.
      type: apiKey
      name: MD-SESSION-TOKEN
      in: header

````