---
title: File
url: amazon-pay-api-v2/file.html
---

* TOC
{:toc}
{::options toc_levels="3" /}

***

## Overview

Upload and manage files for dispute evidence and other documentation needs. The API supports common file formats and provides secure upload URLs.

<script>
  function keySpecifics(){
    const keyQuery = "?environmentSpecificKeys=";
    const currentSetting = window.location.search?.split("?environmentSpecificKeys=")[1] ?? 'false';
    const newSetting = currentSetting === 'false' ? 'true' : 'false';
    window.location = window.location.origin + window.location.pathname + keyQuery + newSetting // +  window.location.hash (not included as it feels weird to jump down)
  }
</script>
<div style="display:none" class="environmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId <b>_does not_</b> have an environment prefix (does not begin with 'SANDBOX' or 'LIVE') follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
  <div markdown="span" class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> If your publicKeyId has an environment prefix (for example: SANDBOX-AFVX7ULWSGBZ5535PCUQOY7B) follow <a href='#' onclick='keySpecifics()' rel='noopener noreferrer'>these instructions</a> instead.</div>
</div>


Supported operations:

<div style="display:none" class="environmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#ustab" data-toggle="tab">US</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#eutab" data-toggle="tab">EU / UK</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#jptab" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="ustab" markdown="block">   
<div markdown="block">
* **Upload File** - POST https://pay-api.amazon.com/:version/files
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="eutab" markdown="block">
<div markdown="block">
* **Upload File** - POST https://pay-api.amazon.eu/:version/files
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jptab" markdown="block">
<div markdown="block">
* **Upload File** - POST https://pay-api.amazon.jp/:version/files
</div>
  </div>
</div>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<ul id="profileTabs" class="nav nav-tabs">
  <li class="nav-item"><a class="active nav-link noExtIcon" href="#ustabNESK" data-toggle="tab">US</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#eutabNESK" data-toggle="tab">EU / UK</a></li>
  <li class="nav-item"><a class="nav-link noExtIcon" href="#jptabNESK" data-toggle="tab">JP</a></li>
</ul>
<div class="tab-content">
  <div role="tabpanel" class="tab-pane active" id="ustabNESK" markdown="block">   
<div markdown="block">
* **Upload File** - POST https://pay-api.amazon.com/:environment/:version/files
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="eutabNESK" markdown="block">
<div markdown="block">
* **Upload File** - POST https://pay-api.amazon.eu/:environment/:version/files
</div>
  </div>
  <div role="tabpanel" class="tab-pane" id="jptabNESK" markdown="block">
<div markdown="block">
* **Upload File** - POST https://pay-api.amazon.jp/:environment/:version/files
</div>
  </div>
</div>
</div>

### File Object

<table width="100%" border="1">
    <tbody>
        <tr id='PDP9CANnxUg'>
            <td id='s:PDP9CANnxUg;PDP9CAuq5ca' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Property
                <br /></td>
            <td id='s:PDP9CANnxUg;PDP9CA8E4CV' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='PDP9CA4XqGQ'>
            <td id='s:PDP9CA4XqGQ;PDP9CAuq5ca' style='vertical-align: top;'>id<br><br>Type: string
                <br /></td>
            <td id='s:PDP9CA4XqGQ;PDP9CA8E4CV' style='vertical-align: top;'>Unique identifier for referencing the file<br><br><br>
                <br /></td>
        </tr>
        <tr id=''>
            <td id='PDP9CAEkyVK' style='vertical-align: top;'>type<br /><br />Type: <a href="#supported-file-types">filetype [Enum]</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>File format (jpg, pdf, etc.)
                <br /></td>
        </tr>
        <tr id=''>
            <td id='PDP9CAEkyVK' style='vertical-align: top;'>purpose<br><br>Type: <a href="#filepurpose">filePurpose [Enum]</a>
                <br /></td>
            <td id='' style='vertical-align: top;'>Intended use (e.g., disputeEvidence)<br><br><br>
                <br /></td>
        </tr>
        <tr id='PDP9CAEkyVK'>
            <td id='' style='vertical-align: top;'>size<br /><br />Type: int
                <br /></td>
            <td id='' style='vertical-align: top;'>File size in bytes
                <br /></td>
        </tr>
        <tr id='PDP9CAOadtI'>
            <td id='s:PDP9CAOadtI;PDP9CAuq5ca' style='vertical-align: top;'>uploadTimestamp<br><br>Type: dateTime
                <br /></td>
            <td id='s:PDP9CAOadtI;PDP9CA8E4CV' style='vertical-align: top;'>Upload time in ISO 8601 format
                <br /></td>
        </tr>
        <tr id='PDP9CA0nAGy'>
            <td id='s:PDP9CA0nAGy;PDP9CAuq5ca' style='vertical-align: top;'>url<br><br>Type: String
                <br /></td>
            <td id='s:PDP9CA0nAGy;PDP9CA8E4CV' style='vertical-align: top;'>Download URL for the file
                <br /></td>
        </tr>
        <tr id='PDP9CAEkyVK'>
            <td id='s:PDP9CAEkyVK;PDP9CAuq5ca' style='vertical-align: top;'>urlExpirationTimestamp<br><br>Type: dateTime
                <br /></td>
            <td id='s:PDP9CAEkyVK;PDP9CA8E4CV' style='vertical-align: top;'>URL expiration time
                <br /></td>
        </tr>
    </tbody>
</table>

#### Enum

#### **filePurpose**
<table width="100%" border="1">
    <tbody>
        <tr id='PDP9CANnxUg'>
            <td id='s:PDP9CANnxUg;PDP9CAuq5ca' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Value
                <br /></td>
            <td id='s:PDP9CANnxUg;PDP9CA8E4CV' style='vertical-align: top; font-weight: bold; width: 70%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='PDP9CA4XqGQ'>
            <td id='s:PDP9CA4XqGQ;PDP9CAuq5ca' style='vertical-align: top;'>disputeEvidence
                <br /></td>
            <td id='s:PDP9CA4XqGQ;PDP9CA8E4CV' style='vertical-align: top;'>The file provided will be used as a dispute evidence
                <br /></td>
        </tr>
    </tbody>
</table>

### Upload files

The API provides a two-step process to upload files securely.

#### Step 1: Get Upload URL

First, request a secure upload URL:

#### Request

<div style="display:none" class="environmentSpecificKeys">
<code style="color: black">
curl "https://pay-api.amazon.com/v2/files" \ <br />
-X POST \ <br />
-H "authorization: Bearer YOUR_TOKEN" \ <br />
-H "x-amz-pay-date: 20201012T235046Z" \ <br />
-H "x-amz-pay-idempotency-key: YOUR_IDEMPOTENCY_KEY" \ <br />
-d @request_body <br />
</code>
</div>
<div style="display:none" class="notEnvironmentSpecificKeys">
<code style="color: black">
curl "https://pay-api.amazon.com/:environment/v2/files" \ <br />
-X POST \ <br />
-H "authorization: Bearer YOUR_TOKEN" \ <br />
-H "x-amz-pay-date: 20201012T235046Z" \ <br />
-H "x-amz-pay-idempotency-key: YOUR_IDEMPOTENCY_KEY" \ <br />
-d @request_body <br />
</code>
</div>

#### Request body

```
{
    "type" : "jpg",
    "purpose" : "disputeEvidence"
}
```

#### Request parameters

<table width="100%" border="1">
    <tbody>
        <tr id='PDP9CAQSM5J'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>Name
                <br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAkAlRX' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Location
                <br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAn6CQD' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Description
                <br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAkesJe;PDP9CAXfdYQ' style='vertical-align: top;'>x-amz-pay-idempotency-key<br><b>(required)</b><br><br>Type: String
                <br /></td>
            <td id='s:PDP9CAkesJe;PDP9CAkAlRX' style='vertical-align: top;'>Header
                <br /></td>
            <td id='s:PDP9CAkesJe;PDP9CAn6CQD' style='vertical-align: top;'>Unique key to prevent duplicate uploads. For detailed guidance on creating and using idempotency keys, see Idempotency.
                <br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAkesJe;PDP9CAXfdYQ' style='vertical-align: top;'>type<br><br>Type: String
                <br /></td>
            <td id='s:PDP9CAkesJe;PDP9CAkAlRX' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:PDP9CAkesJe;PDP9CAn6CQD' style='vertical-align: top;'>File format (jpg, png, pdf)
                <br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAkesJe;PDP9CAXfdYQ' style='vertical-align: top;'>purpose<br><br>Type: String
                <br /></td>
            <td id='s:PDP9CAkesJe;PDP9CAkAlRX' style='vertical-align: top;'>Body
                <br /></td>
            <td id='s:PDP9CAkesJe;PDP9CAn6CQD' style='vertical-align: top;'>Upload reason (disputeEvidence)
                <br /></td>
        </tr>
    </tbody>
</table>

#### Supported file types

<table width="100%" border="1">
    <tbody>
        <tr id='PDP9CAQSM5J'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top; font-weight: bold; width: 30%;' class='bold'>fileType<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top; font-weight: bold; width: 20%;' class='bold'>Description<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top; font-weight: bold; width: 50%;' class='bold'>Content-Type<br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>csv<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>CSV files<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>text/csv<br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>pdf<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>PDF documents<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>application/pdf<br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>xls/xlsx<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>Excel spreadsheets<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>application/vnd.ms-excel (xls)<br />application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx)<br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>doc/docx<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>Word documents<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>application/msword (doc)<br />application/vnd.openxmlformats-officedocument.wordprocessingml.document (docx)<br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>ods<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>OpenDocument spreadsheets<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>application/vnd.oasis.opendocument.spreadsheet<br /></td>
        </tr>
        <tr id='PDP9CAkesJe'>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>jpg/png<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>Image files<br /></td>
            <td id='s:PDP9CAQSM5J;PDP9CAXfdYQ' style='vertical-align: top;'>image/jpeg (jpg)<br />image/png (png)<br /></td>
        </tr>
    </tbody>
</table>

#### Response

The API returns:

```
{
    "id": "file_sdcjscbjckndjhckj",
    "type" : "jpg",
    "purpose": "disputeEvidence",
    "uploadTimestamp": "20190714T155300Z",
    "url": "https://pay-api.amazon.com/v1/files/file_sdcjscbjckndjhckj/contents",
    "urlExpirationTimeStamp": "20190714T155300Z"
}
```


#### Step 2: Upload your file

Send your file to the returned URL:

<code style="color: black">
curl "YOUR_PRESIGNED_URL" \ <br />
-X PUT \ <br />
-H "Content-Type: application/pdf" \ <br />
-T "/path/to/file" <br />
</code>

File Requirements:
* Maximum size: 2MB
* Files must be relevant dispute evidence

After uploading, use the returned fileId when submitting dispute evidence.

