---
title: "Generate representment plan"
method: POST
path: "/dispute/disputes/{disputeId}/evidences/generate-plan"
tags: ["Disputes"]
---

# Generate representment plan

`POST /dispute/disputes/{disputeId}/evidences/generate-plan`

## Request

- Base URL: `https://api.staging.payrails.io`
- URL: `https://api.staging.payrails.io/dispute/disputes/{disputeId}/evidences/generate-plan`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/payrails/apis/payrails-api-reference/docs/dispute/disputes/:disputeId/evidences/generate-plan/post.ts> (a function with typed inputs; its response is checked against the schema)

Generate a representment plan for a dispute.

## Path parameters

- `disputeId` string, uuid, required

## Headers

- `x-idempotency-key` string, uuid, required

## Response `200`

Dispute representment plan generated.

- object
  - `disputeId` string, uuid, required: Unique identifier of the dispute in Payrails.
  - `providerResponseId` string: Provider response identifier for representment plan generation.
  - `createdAt` string, date-time, required: Date and time when the representment plan was created in Payrails.
  - `updatedAt` string, date-time, required: Date and time when the representment plan was last updated in Payrails.
  - `status` 'GeneratingPlan' | 'PlanReady' | 'StoringEvidences' | 'LabelingEvidences' | 'EvidencesReady' | 'GeneratingRepresentment' | 'RepresentmentReady' | 'Submitted', required: Status of the representment plan lifecycle.
  - `recommendation` string: Recommended action for the merchant (e.g. "defend" or "accept").
  - `rationale` string: Explanation supporting the recommendation.
  - `defenseReasons` object[]: Defense reason codes with evidence options, grouped by provider reason code.
    - `code` string, required: Adyen defense document type code.
    - `title` string, required: Human-readable name for this defense document type.
    - `description` string, required: Explanation of what this defense document type covers.
    - `selected` boolean, required: Whether this defense type is the recommended selection.
    - `options` object[], required: Evidence suggestions within this defense type.
      - `position` integer, required: Ordering position of this option within the defense type.
      - `slug` string: Machine-readable identifier for the evidence type.
      - `title` string, required: Suggested title for this evidence.
      - `description` string, required: Suggested details to include for this evidence.
      - `required` boolean, required: Whether this evidence is mandatory for the defense.
      - `evidenceInfo` object: Display metadata for the already-uploaded evidence file, present when evidenceId is set.
        - `displayTitle` string: Human-readable file name or title of the uploaded evidence.
        - `contentType` string: MIME type of the uploaded evidence file.
        - `contentLength` integer: Size of the uploaded evidence file in bytes.

## Other responses

- `400`: Bad Request.
- `401`: Unauthorized.
- `403`: Forbidden.
- `404`: Not Found.
- `429`: Too Many Requests.
- `500`: Internal Server Error.

---

[API](https://skmtc.dev/payrails/apis/payrails-api-reference.md) - [All operations](https://skmtc.dev/payrails/apis/payrails-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/payrails/apis/payrails-api-reference/revisions/9dd2f0158582?raw)
