Skip to main content
POST
Restore one archived version of an evidence library document
Restoring a version makes it active again. Other archived versions stay archived. Payrails attaches the newest version that is not archived to new disputes. If you restore an older version while a newer version is active, currentVersion stays the newer version, and new disputes get the newer version. If the document is archived, Payrails restores it too, so that it attaches to new disputes again.
  • Restoring a version that is not archived returns the document unchanged.
  • Returns 404 when the document or the version does not exist, or when the evidenceLibraryEnabled feature flag is off.

Authorizations

Authorization
string
header
required

You can use an OAuth2 JWT bearer token in the Authorization header of your API requests for supported endpoints: Authorization: Bearer <YOUR_JWT_HERE>. These tokens are valid for 10 minutes and can be requested via the access token endpoint endpoint.

Scopes

disputeevidences:update

Headers

x-idempotency-key
string<uuid>
required

Idempotency key to be used. Sending again the same key would return the same result without re-executing the update.

Path Parameters

documentId
string<uuid>
required

Identifier of the resource in Payrails.

version
integer<int64>
required

Number of the version to restore.

Required range: x >= 1

Response

The document with the restored version.

id
string<uuid>
required
kind
enum<string>
required

Kind of library document. terms and policy documents are attached to every dispute; productDescription documents to not-as-described disputes.

Available options:
terms,
policy,
productDescription
title
string
required
attachedTo
enum<string>
required
deprecated

Always matchingReasonCodes. Payrails attaches a document to a new dispute when the dispute's card network reason code is one of the document's reasonCodes. allDisputes is no longer returned.

Available options:
matchingReasonCodes,
allDisputes
createdAt
string<date-time>
required
updatedAt
string<date-time>
required
usedInCount
integer
required

Number of disputes that use any version of the document. If your credentials can access only some workspaces, only disputes in those workspaces count.

workspaceId
string<uuid>

Absent when the document applies to every workspace.

reasonCodes
enum<string>[] | null

The card network reason codes this document helps defend. Payrails AI suggests them when you add the document or a new version, and you can change them. null until Payrails AI or a person sets them. An empty list means that no reason code applies.

A card network reason code. Visa: 10.4 other fraud, card-absent; 13.1 merchandise or services not received; 13.2 cancelled recurring transaction; 13.3 not as described or defective; 13.6 credit not processed; 13.7 cancelled merchandise or services. Mastercard: 4837 no cardholder authorization; 4853 cardholder dispute; 4855 goods or services not provided.

Available options:
10.4,
13.1,
13.2,
13.3,
13.6,
13.7,
4837,
4853,
4855
reasonCodesSetBy
enum<string> | null

Who set reasonCodes. ai: Payrails AI. user: a person on your team in the Payrails portal. client: your system through the API. null until the reason codes are set. Payrails AI never replaces reason codes that a person or your system set.

Available options:
ai,
user,
client,
null
archivedAt
string<date-time>
currentVersion
object

The latest version that is not archived. New disputes get this version. Absent when every version is archived.

lastUsedAt
string<date-time>

When a dispute last started to use a version of the document. If your credentials can access only some workspaces, only disputes in those workspaces count.

versions
object[]

All versions of the document, oldest first. Returned by Add document (version 1 only), Get document, Add version, Archive document and Archive version. List documents does not return it.

usages
object[]

The 100 disputes that most recently started to use the document, newest first, with the version each one uses. A dispute that uses two versions appears twice. usedInCount is the total number of disputes. Returned by Get document, Add version, Archive document and Archive version. To see every dispute, use List the disputes that use an evidence library document.

Maximum array length: 100
history
object[]

The changes to the document, newest first, with who made each change and when. Returned by Get document only. For documents changed before this history existed, it shows only what their stored dates show. An archive and restore that happened before then does not appear.