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

# Evaluate routing for an existing case (re-refer)

> Like /routing/evaluate but for an existing case: derives the case profile and attempt number, excludes already-referred firms, and returns the next round-robin selectedFirmId + roundRobinPosition. Read-only. Requires the firm to have routing-rule management enabled.



## OpenAPI

````yaml /api-reference/openapi.yml get /routing/re-refer
openapi: 3.0.3
info:
  title: CaseXchange Public API
  version: 1.0.0
  description: >-
    The CaseXchange Public API enables law firms to integrate referral
    management

    directly into their own systems.


    ## Authentication

    All requests must include an `X-API-Key` header containing a valid API key

    (format: `cxp_<hex>`). Keys are scoped to a firm and an access tier.


    ## Access Tiers

    | Tier | Description |

    |------|-------------|

    | `read_only` | GET endpoints — read data without mutation |

    | `standard` | read_only + create/update case referrals |

    | `full` | standard + delete, routing rules, bulk import, firm mutation |


    ## Rate Limiting

    Rate limits are enforced per API key. Exceeded limits return `429 Too Many
    Requests`.


    ## Pagination

    List endpoints accept `page` (default 1) and `limit` (default 20, max 100)
    query params.


    ## Response Format

    Successful responses are wrapped in `{ data: T, meta: { requestId, timestamp
    } }`.

    Errors are wrapped in `{ error: { code, message }, meta: { requestId,
    timestamp } }`.
  contact:
    name: CaseXchange API Support
    url: https://casexchange.com
servers:
  - url: https://api.casexchange.com/api/public/v1
    description: Production Public API base path
  - url: /api/public/v1
    description: Relative base path (for proxied docs/local environments)
security: []
tags:
  - name: Reference Data
    description: Case types, jurisdictions, and counties
  - name: Firms
    description: Firm directory and profile management
  - name: Cases
    description: Case referral lifecycle and actions
  - name: Sent Cases
    description: 'Sender-side case management: create, track, and refer/route cases you own'
  - name: Documents
    description: Document upload, download, and management
  - name: Users
    description: User management within the caller's firm
  - name: Routing
    description: Referral routing rules
  - name: Analytics
    description: Dashboard and case analytics
  - name: Notifications
    description: Notification preferences and email management
  - name: Med Cases
    description: Med Xchange cases and their nested referrals to medical providers
  - name: MedEx Documents
    description: Med Xchange case document listing and download
  - name: Import
    description: Bulk case import/update via CSV
  - name: Salesforce
    description: Org-facing endpoints consumed by the CaseXchange managed package
paths:
  /routing/re-refer:
    get:
      tags:
        - Routing
      summary: Evaluate routing for an existing case (re-refer)
      description: >-
        Like /routing/evaluate but for an existing case: derives the case
        profile and attempt number, excludes already-referred firms, and returns
        the next round-robin selectedFirmId + roundRobinPosition. Read-only.
        Requires the firm to have routing-rule management enabled.
      operationId: evaluateReReferRouting
      parameters:
        - name: caseId
          in: query
          required: true
          schema:
            type: string
          description: Case id, referral id, or reference number
        - name: tier
          in: query
          schema:
            type: integer
          description: Override the case tier for this evaluation
      responses:
        '200':
          description: Routing decision (data is null when no rule matches)
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/RoutingEvaluation'
                  meta:
                    type: object
                    properties:
                      requestId:
                        type: string
                        example: req_f2dbe1d3f6ad4a7bb5b4c9f2
                      timestamp:
                        type: string
                        format: date-time
                    required:
                      - requestId
                      - timestamp
                required:
                  - data
                  - meta
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                  meta:
                    type: object
                    properties:
                      requestId:
                        type: string
                        example: req_f2dbe1d3f6ad4a7bb5b4c9f2
                      timestamp:
                        type: string
                        format: date-time
                    required:
                      - requestId
                      - timestamp
                required:
                  - error
                  - meta
        '403':
          description: API key tier does not permit this action
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                  meta:
                    type: object
                    properties:
                      requestId:
                        type: string
                        example: req_f2dbe1d3f6ad4a7bb5b4c9f2
                      timestamp:
                        type: string
                        format: date-time
                    required:
                      - requestId
                      - timestamp
                required:
                  - error
                  - meta
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
                  meta:
                    type: object
                    properties:
                      requestId:
                        type: string
                        example: req_f2dbe1d3f6ad4a7bb5b4c9f2
                      timestamp:
                        type: string
                        format: date-time
                    required:
                      - requestId
                      - timestamp
                required:
                  - error
                  - meta
      security:
        - apiKeyAuth: []
components:
  schemas:
    RoutingEvaluation:
      type: object
      nullable: true
      description: >-
        The routing decision for a case profile, or null when no active rule
        matches.
      properties:
        rule:
          type: object
          properties:
            id:
              type: string
              format: uuid
            name:
              type: string
        selectedFirmId:
          type: string
          format: uuid
          nullable: true
          description: >-
            The firm the round-robin pointer currently selects — send here. Null
            when the pick is an external-contact assignment (no CaseXchange
            firm).
        roundRobinPosition:
          type: integer
          description: >-
            Opaque echo token — pass this back unchanged as roundRobinPosition
            (with rule.id as routingRuleId) into POST /sent-cases or POST
            /sent-cases/{id}/refer to advance the rule's round-robin pointer
            server-side. It is NOT an index into the assignments array returned
            here; to find the rotation's pick, use assignments[0] or match
            selectedFirmId.
        assignments:
          type: array
          description: >-
            All active assignments for the matched rule, ordered starting at the
            round-robin selection (then the rest of the configured order,
            wrapping). assignments[0] is always the rotation's pick — the same
            firm as selectedFirmId when the pick is a CaseXchange firm. When the
            pick is an external-contact assignment, assignments[0].firmId (and
            selectedFirmId) are null — callers that send to assignments[0] must
            treat a null firmId as "no auto-routable firm" and fall back to
            manual selection. The order changes between calls as the pointer
            advances; do not rely on positional stability except that index 0 is
            the current pick.
          items:
            type: object
            properties:
              firmId:
                type: string
                format: uuid
                nullable: true
              firmName:
                type: string
                nullable: true
              referralInstructions:
                type: string
                nullable: true
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Public API key (starts with cxp_). Required on every request.

````