# Auth Rule

## 200 Auth Rule

### Object
- **token**: Auth Rule Token
- **uuid**: required

### State
- **state**: string (enum) - required. The state of the Auth Rule.
  - `ACTIVE`
  - `INACTIVE`

### Program Level
- **program_level**: boolean - required. Whether the Auth Rule applies to all authorizations on the card program.

### Card Tokens
- **card_tokens**: array of uuids - required. Card tokens to which the Auth Rule applies.
- **excluded_card_tokens**: array of uuids. Card tokens to which the Auth Rule does not apply.
- **excluded_account_tokens**: array of uuids. Account tokens to which the Auth Rule does not apply.
- **excluded_business_account_tokens**: array of uuids. Business account tokens to which the Auth Rule does not apply.
- **account_tokens**: array of uuids - required. Account tokens to which the Auth Rule applies.
- **business_account_tokens**: array of uuids - required. Business Account tokens to which the Auth Rule applies.

### Type
- **type**: string (enum) - required. The type of Auth Rule. For certain rule types, this determines the event stream during which it will be evaluated. For rules that can be applied to one of several event streams, the effective one is defined by the separate `event_stream` field.
  - `CONDITIONAL_BLOCK`: Deprecated. Use `CONDITIONAL_ACTION` instead. AUTHORIZATION event stream.
  - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
  - `MERCHANT_LOCK`: AUTHORIZATION event stream.
  - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, CARD_TRANSACTION_UPDATE, or ACH_PAYMENT_UPDATE event stream.
  - `TYPESCRIPT_CODE`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, ACH_CREDIT_RECEIPT, ACH_DEBIT_RECEIPT, CARD_TRANSACTION_UPDATE, or ACH_PAYMENT_UPDATE event stream.

### Versions
- **current_version**: null | object - required.
  - **draft_version**: null | object - required.

### Name
- **name**: string - required. Auth Rule Name.

### Event Stream
- **event_stream**: string (enum) - required. The event stream during which the rule will be evaluated.
  - `AUTHORIZATION`
  - `THREE_DS_AUTHENTICATION`
  - `TOKENIZATION`
  - `ACH_CREDIT_RECEIPT`
  - `ACH_DEBIT_RECEIPT`
  - `CARD_TRANSACTION_UPDATE`
  - `ACH_PAYMENT_UPDATE`

### Lithic Managed
- **lithic_managed**: boolean - required. Indicates whether this auth rule is managed by Lithic. If true, the rule cannot be modified or deleted by the user.

## 400 Bad Request

## 404 Not Found

## Example Request
```shell
curl --request PATCH \
     --url https://sandbox.lithic.com/v2/auth_rules/auth_rule_token \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "account_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "business_account_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ]
}'
```

## Example Response
```json
{
  "token": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "state": "ACTIVE",
  "program_level": true,
  "card_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "excluded_card_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "excluded_account_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "excluded_business_account_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "account_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "business_account_tokens": [
    "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  ],
  "type": "CONDITIONAL_BLOCK",
  "current_version": {
    "parameters": {
      "conditions": [
        {
          "attribute": "MCC",
          "operation": "IS_ONE_OF",
          "value": "string"
        }
      ]
    },
    "version": 0
  },
  "draft_version": {
    "parameters": {
      "conditions": [
        {
          "attribute": "MCC",
          "operation": "IS_ONE_OF",
          "value": "string"
        }
      ]
    },
    "version": 0,
    "state": "PENDING",
    "error": "string"
  },
  "name": "string",
  "event_stream": "AUTHORIZATION",
  "lithic_managed": true
}
```
