Skip to main content
POST
Add an evidence library document
Payrails attaches library documents to new disputes by kind: terms and policies to every dispute, product descriptions to not-as-described disputes. Each dispute gets the version that was valid at the time of purchase.
  • validFrom may be in the past, or in the future for a scheduled version. Until that date the document has no currentVersion.
  • Without workspaceId the document applies to every workspace. Callers limited to some workspaces must set workspaceId to one of theirs; they get 403 for a merchant-wide document.
  • Returns 404 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.

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.

Body

multipart/form-data
title
string
required
Maximum string length: 200
Example:

"Terms & conditions"

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
file
file
required

The document.

workspaceId
string<uuid>

Workspace the document belongs to. Omit to apply it to every workspace.

validFrom
string<date-time>

When version 1 starts to apply. Defaults to now; may be in the past or the future. Until it starts, the document has no currentVersion.

Response

Document and its version 1 created.

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

Which new disputes Payrails attaches the document to, derived from its kind.

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

Number of disputes that use any version of the document. For a caller limited to some workspaces, only disputes in those workspaces count.

workspaceId
string<uuid>

Absent when the document applies to every workspace.

archivedAt
string<date-time>
currentVersion
object

The version valid now. Absent when every version starts in the future.

lastUsedAt
string<date-time>

When a dispute last started to use a version of the document. For a caller limited to some workspaces, only disputes in those workspaces count.

versions
object[]

All versions, lowest first. Returned by create (version 1 only), get, add version and archive; not returned by list.

usages
object[]

The latest 100 dispute links to a version of the document, newest first, one entry per link; usedInCount is the total. Returned by get, add version and archive; not returned by list.

Maximum array length: 100