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

# Move a rule

> Move one ACTIVE or SUSPENDED rule to first/last or before/after a rule in the destination set from the supplied expected_rule_configuration_version. Source and destination positions are atomically renumbered to 1..N.

Moves an `ACTIVE` or `SUSPENDED` rule within its current set or into another set. Supply the destination `rule_set_id`, a semantic `position`, and the current `expected_rule_configuration_version`.

Scrip renumbers the source and destination sequences in one transaction. Archived rules cannot move.


## OpenAPI

````yaml POST /v1/rules/{id}/move
openapi: 3.0.3
info:
  contact:
    email: support@scrip.dev
    name: Scrip Support
  description: >-
    Scrip is the operating system for rewards programs. Use this REST API to
    define earn and redemption rules, issue and redeem assets, and track every
    movement in a double-entry ledger. Full guides and reference:
    https://docs.scrip.dev


    Core concepts:

    - **Programs**: Containers for incentive logic (e.g., "Q1 Sales Bonus",
    "Customer Loyalty")

    - **Assets**: The currency or points being tracked (e.g., "Bonus Points",
    "Cash Rewards")

    - **Participants**: Users who earn and spend assets (identified by
    external_id)

    - **Groups**: Collections of participants for team-based incentives

    - **Rules**: Automated reward logic triggered by events

    - **Events**: Actions that trigger rule evaluation (e.g., "purchase",
    "referral")


    Response formats:

    - **Collection endpoints** return: {"data": [...], "pagination":
    {"has_more": true, "next_cursor": "..."}}

    - **Single-resource endpoints** return the resource directly

    - **Errors** return: {"code": "...", "message": "...", "details": {...}} —
    `details` is an optional object, present on input errors only
  license:
    name: Proprietary
  termsOfService: https://scrip.dev/terms
  title: Scrip API
  version: '1.0'
servers:
  - url: https://api.scrip.dev
security: []
tags:
  - description: >-
      Manage incentive programs. Programs are the top-level container for all
      incentive logic.
    name: Programs
  - description: >-
      Manage asset types (currencies, points). Assets define what participants
      can earn and spend.
    name: Assets
  - description: >-
      Manage participants and their balances. Participants are identified by
      external_id from your system.
    name: Participants
  - description: Manage participant groups for team-based incentives.
    name: Groups
  - description: >-
      Manage automated reward rules. Rules define conditions and actions
      triggered by events.
    name: Rules
  - description: Ingest events that trigger rule evaluation and reward distribution.
    name: Events
  - description: Transfer assets between participants.
    name: Transfers
  - description: Access ledger summaries and program activity reports.
    name: Reporting
  - description: >-
      Redeem participant balances for rewards. Supports raw amount redemptions
      and catalog item redemptions.
    name: Redemptions
  - description: >-
      Manage the reward catalog. Create and manage redeemable items with
      inventory tracking.
    name: Rewards
  - description: >-
      Schedule and manage automated event dispatching. Automations generate
      events on cron schedules, at specific times, or by evaluating participant
      state.
    name: Automations
  - description: >-
      Manage tier types and levels within programs. Tiers define status
      hierarchies that participants progress through based on qualification
      rules.
    name: Tiers
  - description: Inspect double-entry ledger records for auditing and reconciliation.
    name: Journal Entries
  - description: >-
      Manage webhook endpoints and delivery logs. Webhooks notify your
      application of real-time events via HTTP POST with HMAC-SHA256 signatures.
    name: Webhooks
paths:
  /v1/rules/{id}/move:
    post:
      tags:
        - Rules
      summary: Move a rule
      description: >-
        Move one ACTIVE or SUSPENDED rule to first/last or before/after a rule
        in the destination set from the supplied
        expected_rule_configuration_version. Source and destination positions
        are atomically renumbered to 1..N.
      operationId: moveRule
      parameters:
        - description: Rule ID
          in: path
          name: id
          required: true
          schema:
            format: uuid
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handlers.MoveRuleRequest'
        description: Destination rule set and semantic position
        required: true
        x-originalParamName: request
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.MoveRuleResponse'
          description: OK
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrBadRequestResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrUnauthorizedResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrForbiddenResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrNotFoundResponse'
          description: Not Found
        '409':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/handlers.ErrRuleConfigurationVersionConflictResponse
          description: Conflict
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrUnprocessableResponse'
          description: Unprocessable Entity
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/handlers.ErrInternalResponse'
          description: Internal Server Error
      security:
        - ApiKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    handlers.MoveRuleRequest:
      additionalProperties: false
      properties:
        expected_rule_configuration_version:
          description: >-
            Current rule_configuration_version from the configuration read
            endpoint. A stale value rejects the request.
          example: 3
          minimum: 1
          type: integer
        position:
          allOf:
            - $ref: '#/components/schemas/handlers.SemanticPositionRequest'
          description: Semantic destination within the destination rule set.
        rule_set_id:
          description: Destination rule-set ID. It may be the rule's current set.
          format: uuid
          type: string
      required:
        - expected_rule_configuration_version
        - position
        - rule_set_id
      type: object
    handlers.MoveRuleResponse:
      properties:
        destination_rules:
          description: Complete renumbered sequence in the destination set.
          items:
            $ref: '#/components/schemas/handlers.PositionedRuleResponse'
          type: array
        rule:
          allOf:
            - $ref: '#/components/schemas/handlers.PositionedRuleResponse'
          description: Moved rule in its final position.
        rule_configuration_version:
          description: Resulting program rule-configuration version.
          example: 4
          type: integer
        source_rule_set_id:
          description: Rule set that contained the rule before the move.
          format: uuid
          type: string
        source_rules:
          description: Complete renumbered sequence left in the source set.
          items:
            $ref: '#/components/schemas/handlers.PositionedRuleResponse'
          type: array
      type: object
    handlers.ErrBadRequestResponse:
      additionalProperties: false
      properties:
        code:
          description: Code is the machine-readable error code
          example: bad_request
          type: string
        details:
          allOf:
            - $ref: '#/components/schemas/handlers.ErrorDetails'
          description: >-
            Details provides optional structured error context (field errors,
            etc.)
        message:
          description: Message is the human-readable error description
          example: Invalid request parameters
          type: string
      type: object
    handlers.ErrUnauthorizedResponse:
      properties:
        code:
          description: Code is the machine-readable error code
          example: unauthorized
          type: string
        details:
          allOf:
            - $ref: '#/components/schemas/handlers.ErrorDetails'
          description: Details provides optional structured error context
        message:
          description: Message is the human-readable error description
          example: Missing or invalid credentials
          type: string
      type: object
    handlers.ErrForbiddenResponse:
      properties:
        code:
          description: Code is the machine-readable error code
          example: forbidden
          type: string
        details:
          allOf:
            - $ref: '#/components/schemas/handlers.ErrorDetails'
          description: Details provides optional structured error context
        message:
          description: Message is the human-readable error description
          example: Insufficient permissions for this action
          type: string
      type: object
    handlers.ErrNotFoundResponse:
      properties:
        code:
          description: Code is the machine-readable error code
          example: not_found
          type: string
        details:
          allOf:
            - $ref: '#/components/schemas/handlers.ErrorDetails'
          description: Details provides optional structured error context
        message:
          description: Message is the human-readable error description
          example: Resource not found
          type: string
      type: object
    handlers.ErrRuleConfigurationVersionConflictResponse:
      properties:
        code:
          example: rule_configuration_version_conflict
          type: string
        details:
          $ref: >-
            #/components/schemas/handlers.RuleConfigurationVersionConflictDetails
        message:
          example: Rule configuration changed since this mutation was planned
          type: string
      type: object
    handlers.ErrUnprocessableResponse:
      properties:
        code:
          description: Code is the machine-readable error code
          example: unprocessable
          type: string
        details:
          allOf:
            - $ref: '#/components/schemas/handlers.ErrorDetails'
          description: Details provides optional structured error context
        message:
          description: Message is the human-readable error description
          example: Business rule violation
          type: string
      type: object
    handlers.ErrInternalResponse:
      properties:
        code:
          description: Code is the machine-readable error code
          example: internal_error
          type: string
        message:
          description: Message is the human-readable error description
          example: An internal error occurred
          type: string
      type: object
    handlers.SemanticPositionRequest:
      additionalProperties: false
      oneOf:
        - not:
            required:
              - reference_id
          properties:
            placement:
              enum:
                - first
                - last
              type: string
          required:
            - placement
        - properties:
            placement:
              enum:
                - before
                - after
              type: string
          required:
            - placement
            - reference_id
      properties:
        placement:
          description: Placement within the destination collection.
          enum:
            - first
            - last
            - before
            - after
          example: before
          type: string
        reference_id:
          description: >-
            Stable sibling ID. Required for before/after and omitted for
            first/last.
          example: 550e8400-e29b-41d4-a716-446655440000
          format: uuid
          type: string
      required:
        - placement
      type: object
    handlers.PositionedRuleResponse:
      properties:
        id:
          description: Stable rule ID.
          format: uuid
          type: string
        name:
          description: Rule display name.
          type: string
        order:
          description: Position within the containing rule set.
          type: integer
        rule_set_id:
          description: Rule set containing the rule after the mutation.
          format: uuid
          type: string
        status:
          description: ACTIVE or SUSPENDED lifecycle status.
          enum:
            - ACTIVE
            - SUSPENDED
          type: string
      type: object
    handlers.ErrorDetails:
      description: >-
        Optional structured details about the error. Always a JSON object: a
        `fields` array for validation errors, or flat
        field/reason/expected/received properties for other input errors.
      properties:
        expected:
          description: Expected value or format (non-validation input errors)
          example: uuid
          type: string
        field:
          description: Field name that caused the error (non-validation input errors)
          example: asset_id
          type: string
        fields:
          description: >-
            Fields lists each offending input field on validation_error
            responses.
          items:
            $ref: '#/components/schemas/handlers.ErrorFieldDetail'
          type: array
        reason:
          description: Machine-readable reason code (non-validation input errors)
          example: invalid
          type: string
        received:
          description: Value that was received (non-validation input errors)
          example: not-a-uuid
          type: string
      type: object
    handlers.RuleConfigurationVersionConflictDetails:
      properties:
        current_rule_configuration_version:
          example: 4
          type: integer
        expected_rule_configuration_version:
          example: 3
          type: integer
        instruction:
          example: Refetch the rule configuration and replan the mutation.
          type: string
      type: object
    handlers.ErrorFieldDetail:
      description: >-
        A single field-level error: which input field failed, why, and (where
        known) the expected and received values.
      properties:
        expected:
          description: >-
            Expected value or format. Usually a string; for "one of" constraints
            it

            is an array of the allowed values.
        field:
          description: Field name that caused the error
          example: amount
          type: string
        message:
          description: Human-readable explanation (validation errors only)
          example: This field is required
          type: string
        reason:
          description: Machine-readable reason code
          example: required
          type: string
        received:
          description: Value that was received
          example: '-10.00'
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: API key passed in the X-API-Key header.
      in: header
      name: X-API-Key
      type: apiKey
    BearerAuth:
      description: Bearer token passed in the Authorization header (e.g. "Bearer sk_...").
      in: header
      name: Authorization
      type: apiKey

````